Skip to main content
Orchestrations coordinate multiple agents across multi-domain tasks. A coordinator agent analyzes incoming messages and delegates subtasks to specialized entity agents based on their role descriptions, then synthesizes the entity responses into a single reply.

Common Patterns

Create an orchestration, add entity agents with clear role descriptions, then use the streaming endpoint. The coordinator handles delegation. Keep entity role descriptions specific and non-overlapping so the coordinator can route cleanly.

CRUD

POST /api/orchestrations

Create an orchestration.

GET /api/orchestrations

List all orchestrations.

GET /api/orchestrations/

Get orchestration with its entities.
id
string
required
Orchestration ID

PUT /api/orchestrations/

Update orchestration config.
id
string
required
Orchestration ID

DELETE /api/orchestrations/

Delete an orchestration.
id
string
required
Orchestration ID

Entities

POST /api/orchestrations//entities

Add an agent as an entity.
id
string
required
Orchestration ID
entity_type
string
required
Use "agent". The route accepts any string ≤50 chars, but the orchestrator’s execution path only invokes entities where entity_type === "agent"; other values are stored but silently skipped at run time.
entity_ref_id
string
required
UUID of the agent to add.
role_description
string
Free-text role hint shown to the coordinator when delegating. Replaces the prior role field used in older docs examples.
config
object
Per-entity overrides; defaults to {}.
position
integer
Sort order in list responses; defaults to 0.
The route returns 400 if either entity_type or entity_ref_id is missing. List/PUT responses key off entity_ref_id and role_description, so any client trying to round-trip will see the same field names.

GET /api/orchestrations//entities

List entities in the orchestration.
id
string
required
Orchestration ID

PUT /api/orchestrations//entities/

Update an entity. Only role_description, config, and position are writable; any other top-level keys are silently ignored. entity_type and entity_ref_id are not updatable; create a new entity instead.
id
string
required
Orchestration ID
eid
string
required
Entity ID
role_description
string
Free-text role hint shown to the coordinator when delegating.
config
object
Per-entity overrides.
position
integer
Sort order in list responses.

DELETE /api/orchestrations//entities/

Remove an entity.
id
string
required
Orchestration ID
eid
string
required
Entity ID

Execution

POST /api/orchestrations//run/stream

Run orchestration with streaming SSE. Includes delegation events.
id
string
required
Orchestration ID

GET /api/orchestrations/runs/

Get orchestration run result.
run_id
string
required
Run ID

Hooks

These endpoints register hooks against an orchestration using the same ai.hooks model as agent hooks: event, type, config, matcher, enabled, and position.
Orchestration hooks are not executed yet. The CRUD endpoints below work (you can create, list, and delete hook rows), but the orchestration engine does not currently fire them at runtime, so a registered hook has no effect on an orchestration run today. Register them only for forward-compatibility. When execution lands, orchestration hooks will follow the agent hook contract (events such as OnRunStart/OnRunComplete, types http/rule/approval). The event and type you send are stored verbatim and not validated.Hooks attached to a member agent also do not fire while that agent runs inside an orchestration; only standalone agent runs execute hooks today. If you rely on an agent’s approval or policy hook, run that agent directly rather than as part of an orchestration until this lands.

POST /api/orchestrations//hooks

Add a hook.
id
string
required
Orchestration ID
event
string
required
Lifecycle event name. Stored verbatim; not validated.
type
string
required
Hook handler type: http, rule, or approval (see the agent hook contract).
config
object
required
Handler-specific configuration (for http, includes url).
matcher
string
Optional filter narrowing when the hook fires.
enabled
boolean
Defaults to true.
position
integer
Execution order within the event. Defaults to 0.

GET /api/orchestrations//hooks

List hooks for the orchestration, ordered by position.
id
string
required
Orchestration ID

DELETE /api/orchestrations//hooks/

Remove a hook.
id
string
required
Orchestration ID
hook_id
string
required
Hook ID

Sessions

Session-level reads on orchestrations. The streaming /run/stream endpoint returns a session_id you can use here to fetch history.

GET /api/orchestrations//sessions

List the most recent 100 sessions for an orchestration. Each entry includes session_id, run_count, first_message, last_activity_at, and created_at.
id
string
required
Orchestration ID

GET /api/orchestrations//sessions//messages

Assembled messages for a session. Each assistant message carries per-run reasoning replay metadata (reasoning_requested, reasoning_duration_ms, reasoning, events) so a chat UI can re-render the original “Thought for X.Xs” pill on refresh. Tool calls are attached per-message via tool_calls. The legacy top-level events field is preserved for older clients.
id
string
required
Orchestration ID
session_id
string
required
Session ID

Error Responses

Orchestration routes return {"error": "<message>"} (no structured error code field).
StatusDescription
400The orchestration has no entity agents; add at least one before running
400Hook POST is missing one of event, type, or config
404No orchestration exists with the given ID
404No hook exists with the given ID for this orchestration
404No orchestration session with the given ID