I want my coding agents to iterate on preprocessors and facet prompts for the Topics pipeline and push them to Braintrust through bt. Right now bt functions push can't ship either:
- Facets require
function_data: {type: "facet", prompt, no_match_pattern, preprocessor: {id}}. The runner only collects what the SDK registers, and the SDK has no facet builder.
- Preprocessors that Topics will actually run must be
data.type: "inline" + runtime: "quickjs". SDK push bundles via esbuild instead, and the server rejects invocation with 400: Brainstore preprocessor aggregate only supports built-in 'thread' and inline quickjs preprocessors.
The backend handles both shapes — bt topics config enable already POSTs to /insert-functions (src/topics/api.rs:1015-1060). Today the workaround is curling that endpoint directly, which bypasses bt's auth/profile resolution.
What would solve this
A manifest path on bt functions push:
bt functions push --manifest path/to/function.json -p <project>
JSON matches what /insert-functions accepts. Facet:
{
"name": "my-lens-issues",
"slug": "my-lens-issues-v1",
"function_type": "facet",
"function_data": {
"type": "facet",
"prompt": "...",
"no_match_pattern": "^NONE",
"preprocessor": { "id": "<preprocessor-function-id>", "type": "function" }
}
}
Inline-quickjs preprocessor:
{
"name": "my-lens-preprocessor",
"slug": "my-lens-preprocessor-v1",
"function_type": "preprocessor",
"function_data": {
"type": "code",
"data": {
"type": "inline",
"code": "function handler({ span_attributes, input }) { /* ... */ }",
"runtime_context": { "runtime": "quickjs", "version": "ES2023" }
}
}
}
Skip the runner for this path; reuse existing auth/project/if_exists plumbing.
Happy to send a PR — already have a draft.
I want my coding agents to iterate on preprocessors and facet prompts for the Topics pipeline and push them to Braintrust through
bt. Right nowbt functions pushcan't ship either:function_data: {type: "facet", prompt, no_match_pattern, preprocessor: {id}}. The runner only collects what the SDK registers, and the SDK has no facet builder.data.type: "inline"+runtime: "quickjs". SDK push bundles via esbuild instead, and the server rejects invocation with400: Brainstore preprocessor aggregate only supports built-in 'thread' and inline quickjs preprocessors.The backend handles both shapes —
bt topics config enablealready POSTs to/insert-functions(src/topics/api.rs:1015-1060). Today the workaround iscurling that endpoint directly, which bypassesbt's auth/profile resolution.What would solve this
A manifest path on
bt functions push:JSON matches what
/insert-functionsaccepts. Facet:{ "name": "my-lens-issues", "slug": "my-lens-issues-v1", "function_type": "facet", "function_data": { "type": "facet", "prompt": "...", "no_match_pattern": "^NONE", "preprocessor": { "id": "<preprocessor-function-id>", "type": "function" } } }Inline-quickjs preprocessor:
{ "name": "my-lens-preprocessor", "slug": "my-lens-preprocessor-v1", "function_type": "preprocessor", "function_data": { "type": "code", "data": { "type": "inline", "code": "function handler({ span_attributes, input }) { /* ... */ }", "runtime_context": { "runtime": "quickjs", "version": "ES2023" } } } }Skip the runner for this path; reuse existing auth/project/
if_existsplumbing.Happy to send a PR — already have a draft.