Skip to content

Deployment

Deployment takes an approved version and puts it live behind the public runtime, so callers can invoke your function by slug without knowing anything about prompts, models, or versions.

A version moves through a fixed path before it can serve traffic:

create version → submit → approve → deploy → invoke
  • submit runs the design gate (the contract must-haves).
  • approve freezes the version and compiles it to an artifact.
  • deploy points the function’s public endpoint at that approved version.

The same sequence in the SDK (from the quickstart):

c.versions.submit(v["id"])
c.versions.approve(v["id"])
c.deployments.deploy(fn["id"], v["id"])

Deployed functions are called on the public runtime (/v1/run/{slug}) with a per-function invoke key (fnk_…) — never a personal token. Mint a key, then call the function by slug:

key = c.keys.invoke.mint(fn["id"], name="prod") # fnk_… shown once
result = c.function(fn["slug"], api_key=key["key"]).run(document="")
print(result.ok, result.output, result.meta["cost_usd"], result.trace_id)

Invoke keys are deliberately narrow: one key calls one function’s runtime and nothing else. Hand them to the systems that call your function, not to people. Credential kinds are covered in authentication.

Because every approved version is a frozen, compiled artifact, rolling back is re-pointing the deployment at a previous version — no rebuild, no redeploy of code. Keep the last known-good version approved so you can switch back instantly if a new one misbehaves.

Every invocation lands as a trace in the same pipeline you used during evaluation:

c.functions.health(fn["id"]) # is my function okay?
c.traces.list(function_id=fn["id"]) # recent executions
c.traces.flag(trace_id) # a bad output → straight into a dataset

Flagging a production trace turns a real-world failure into a regression dataset row, so the next version’s evaluation covers the case that broke. That closes the loop: production feeds evaluation, evaluation gates deployment.

  • Evaluation — prove the next version before you promote it.
  • API reference — the deployment, key, and trace endpoints.