Skip to main content

Try, test, publish, disable

The ladder​

Draft → validated → tested → published. A Code function is tested by its own tests (required); Ask AI and Agent functions are gated by evaluations, which are opt-in, so for them the ladder is draft → validated → published.

  • Every save of a file makes a new draft version and validates it on the spot.
  • Try it runs the draft once, as you, with a real input, and shows the run and its trace. Ask AI shows a cost cap ("Try it · up to $0.05") before you press it. Every Try is an ordinary run on the Runs page.
  • Tests (Code) run every case for real, with stand-in data (fixtures) for every capability the function calls out to, so a test never reads live data.
  • Publish makes version n the one callers pin. Publishing is always explicit.

Over MCP, the same loop​

function_create(name, title, app_id?) # name: lowercase letters, digits, underscores, up to 56 chars
function_put_file(name, "function.json", ...) # every put is a new draft version, validated at once
function_put_file(name, "main.py", ...) # or prompts/*.md for Ask AI
function_test(name, n) # Code: the package's tests on the real executor
function_publish(name, n) # code-only changes publish; anything wider asks a person
function_versions(name) / function_list(app_id?)

A zip works too: function_upload_url, upload, function_complete_upload.

Not on MCP yet (do them on the function's page in Studio, or over REST): reading one function's settings, a draft Try of an Ask AI or Agent function, changing exposure or audience, disable and enable, listing what uses it, the model catalogue, the function kinds, and Bicycle's function library. MCP tools for these are landing; until then a coding agent will ask you to do them in Studio rather than guess.

When a publish needs a person​

function_publish answers "A person must confirm this in Studio before v3 ..." with a link (/<workspace>/apps/functions/<name>?publish=v3) when the version:

  • is the first version of the function;
  • adds a capability, a model, a query, or widens the audience;
  • exposes the function to agents or MCP;
  • picks a bigger size or doubles the time limit.

That is not an error. The agent gives you the link; you open it, read the summary of what changes, and press Publish. A code-only change to an already-published Code function publishes without a review.

Exposing a function​

On the function's page: Apps, Workflows, Chat and agents, MCP. Apps and workflows are usually on. Chat and agents lets the app's chat and any agent that is granted the function call it as a tool. MCP makes it a tool named fn_<name> for coding agents connected to Studio. Switching on chat-and-agents or MCP is a person-only step.

Disable (there is no delete)​

Deleting a function is disabling it: apps, workflows and agents that pin a version keep working; new uses are refused with function_disabled; it leaves every picker; a Disabled tab lists it; Enable restores it. Only owners and admins can disable. Check what uses it first (the function's page lists dependents) and tell the people who own those.

Over REST: POST /api/studio/v1/functions/<name>:disable and :enable; GET /api/studio/v1/functions/<name>/dependents.

Versions and references​

A published function is called by its pinned reference fn:<tenant>/<name>@<n>. Apps, workflow steps and agent grants pin a version; publishing a new version never changes what they get until someone moves them. @latest is only for interactive calls.

Two people editing the same draft: the second save answers draft_conflict with who saved and when. Re-read, re-apply, and tell the other person if you touched the same lines.

Where the run shows up​

Every Try, test and call is one run with a trace: on the function's Runs tab, on the Runs page, and over REST at GET /api/studio/v1/invocations/<id>. A coding agent reads a call's result with functions_result(invocation_id, wait_s).

Checklist before you publish​

  • The input and output schemas describe what callers really send and get.
  • Tests (Code) cover the empty case and one real day.
  • Capabilities list only what the code uses; the calling app or workflow declares the query ids.
  • Exposure is the minimum: apps and workflows unless chat or MCP is the point.
  • The title says what it does in the person's words; the name is the stable id.