Lifecycle at a glance
Create
POST /agents creates an agent and its first version. On creation the platform validates the whole configuration up front so a run never starts against an invalid setup:
- The knowledge base exists and is accessible with your key.
- The model is a supported, available model.
- Any connected apps the agent references are authenticated and ready to call.
- The schedule (if provided) is a valid cron expression.
- Any delegates (other agents this one can hand off to) resolve.
id and agentVersion: 1.
The knowledge base is fixed at creation and defines the agent’s private retrieval corpus for its whole lifetime. To point an agent at different content, create a new agent on that knowledge base. See Agents overview.
Configure & deploy
Editing an agent’s goal, instructions, model, or tool set and callingPOST /agents/:id/deploy publishes a new version. Versioning is what makes agents safe to iterate on: each deploy is an immutable, numbered snapshot, and in-flight runs are unaffected by a deploy that lands mid-run.
Run
A run is a single execution of the agent. Start one withPOST /agents/:id/messages for a complete response, or POST /agents/:id/messages/stream for live progress and final content over SSE (see Chat lifecycle for the event model). Starting a run creates both a run record and an associated chat.
Reproducibility
Each run pins a snapshot of the agent’s goal, instructions, model, and tools at the moment it starts. This makes the run attributable to a stable core configuration even if you deploy a new version while it is still going; model output itself can still vary. Two elements resolve to their latest definition at run time rather than being pinned:- Skills — reusable capabilities resolve to their current version when the run begins.
- Delegates — the target agents of any handoff resolve at call time.
Continuing a run
To add turns to an existing run, pass itschat_id on your next message. New turns attach to the same run and chat, preserving the conversation and its pinned snapshot.
A single agent supports single-hop delegation — an agent can delegate to another agent to complete part of a task, and that delegate returns its result to the caller.
Schedule & scheduled execution
Attach a cron schedule to run an agent headless on a recurring basis. The scheduler owns the trigger, so you can enable or disable a schedule without redeploying the agent. When a scheduled run fires, it executes with these guarantees:Bound identity
The run executes under a fixed, bound identity so access and attribution are consistent on every trigger.
Credit pre-check
Available credits are checked before work begins, so a run only starts with a positive balance.
Idempotent triggers
Each scheduled occurrence runs once. Retries reuse the same occurrence, so a retry never double-runs.
Headless
No client connection is required — results are persisted to the run and its chat for you to read later.
Stop & terminal states
Stop an in-flight run withPOST /agents/:id/runs/:runId/stop. Every run resolves to exactly one terminal state.
completed
completed
The run produced a final answer and finished normally.
failed
failed
The run ended before producing a final answer. Any work completed up to that point — intermediate output, sources, and usage — is preserved on the run, so you can inspect what was produced. Best practice: treat
failed as “no final answer yet” and read the partial output before deciding whether to start a fresh run.cancelled
cancelled
The run was stopped explicitly through the stop endpoint.
Endpoint summary
| Action | Method & path |
|---|---|
| Create agent (version 1) | POST /agents |
| Deploy (new version) | POST /agents/:id/deploy |
| Run (complete response) | POST /agents/:id/messages |
| Run (streamed response) | POST /agents/:id/messages/stream |
| Continue a run | POST /agents/:id/messages with chat_id |
| Stop a run | POST /agents/:id/runs/:runId/stop |
Next steps
Agents overview
How agents fit into knowledge bases and the platform.
Agents API
Full request and response schemas for every agent endpoint.
Delegation
Compose agents with single-hop handoffs.
Chat lifecycle
Understand the run’s underlying conversation and streaming.