App SDK: bda.fn
Source: _generated/app-sdk.md in the local directory context-collection (not yet on origin/platform), synced 2026-09-26. Do not edit this page here; change the source and run yarn sync:studio.
That source is itself generated (by arch/context-collection/build.py from bicycle-studio-api ae03438 data_apps/app_sdk.py GUIDE (LANDING: not on origin/platform yet)); change its source and re-run its build.
LANDING.
dataapp_sdk/GET /api/data-apps/sdkexist on commit ae03438, not onorigin/platform. Until it merges and deploys, the tool is missing on preview.
bda.fn: call a published function or workflow from a template-built app.
- Put these files at the paths shown (next to the template's
src/studio/types.ts). - Declare what the app calls in
bda.manifest.json, pinned:"functions": {"<local_name>": {"ref": "fn:<tenant>/<name>@<n>"}}for a function,{"ref": "wf:<tenant>/<slug>@<n>"}for a published workflow. Publishing a version that adds or re-pins one is confirmed by a person in Studio. - In app code, name the LOCAL name only (never a ref); start runs from a button's onClick (the sandbox has no forms):
import { bda } from './studio/bda.js'
const out = await bda.fn.call('<local_name>', input) // waits, returns the output (throws a BdaError in words)
const started = await bda.fn.call('<local_name>', input, { wait: false, reuse: '6h' }) // queued Invocation at once
const watch = bda.fn.watch(started.invocation_id, batch => show(batch.items)) // progress lines in words
const final = await watch.done // terminal Invocation (status, output, usage)
const value = bda.fn.outputOf(final) // output, or throws for failed / cancelled
await bda.fn.cancel(started.invocation_id) // a Cancel button
reuse ("6h", at most "24h") answers from the viewer's own recent run of the same call: always pass it for a call made
on page load and show "as of <created_at>" with a Refresh ({ refresh: true }). It does not apply to workflows. A
workflow's output is its run receipt; a send is not delivered until its state is "sent". Render output as text,
never as HTML. The run happens as the viewer, and shows in Studio's Runs with the same trace as any other caller.
Per-function snippets: the function's or workflow's "Use it in an app" tab in Studio (workflow_guide over MCP).