Create a session
Lifecycle
Create a session
Launch a new agent run.
POST
Create a session
Creates a new session that runs an agent against the given task. The session starts in
pending status and transitions to running once the agent launches.
Returns the created Session object with status pending.
Headers
Optional idempotency key (max 128 characters). Safe retry within 24 hours: reusing the same key with a different body returns
422.Request body
Either a catalog identifier (string, e.g. Inline agent, with environments nested under it:See Browser for its config and fields.
"h/web-surfer-holo3-1-35b") or an inline Agent object. An inline agent must include its own environments (at most one per kind), unless it is a pure manager that only delegates to subagents; the session resolves only agent and reads everything else (environments, skills, subagents) from there.Using a catalog id (environments come from the agent’s stored spec):Initial messages queued before the agent’s first step. Usually a single user message describing the task.Each message has:
type(string):"user_message"message(string): The instruction or task description.images(array, optional): Base64 data URIs to attach (e.g.data:image/png;base64,...).caller_id(string, optional): Identifies the message sender. Defaults touser; leave it unset for normal user input.
Cap on the number of steps the agent may take, where each step is one decide-and-act cycle. On reaching the cap the agent is asked to produce a final answer from what it has so far (it is not hard-killed), so you still get a structured result. Defaults to a runtime value when omitted.
Cap on wall-clock seconds. On reaching the cap, like
max_steps, the agent is asked for a final answer rather than terminated abruptly. Omit it to run uncapped.Switches between one-shot and interactive. Leave it
null for a one-shot task: the session ends as soon as the agent answers. Set it (in seconds) to keep the session open for follow-up messages: after each answer the session enters the idle status and waits this long for your next message before terminating.Tag for grouping related sessions. You can later query all sessions with
GET /sessions?group_id=....ID of a parent session, for multi-agent orchestration. The parent’s status endpoint will include this session in its
subagent_session_ids list.A JSON Schema the final answer must conform to. When set, the agent returns structured data matching the schema instead of free-form text, and
answer is an object rather than a string. Leave it null for free-form text.Response
Unique session identifier.
The original session request body.
Session status object with
status: "pending" for a newly created session.ISO 8601 timestamp.
Examples
Basic session
Reference a catalog agent; its stored spec supplies the environments:Response
With idempotency key
With an inline agent and explicit browser environment
Pass an inlineAgent instead of a catalog id when you want to override the environments (or any other field) on a per-session basis. Environments must be nested under agent.
Child session (multi-agent)
Errors
| Status | Cause |
|---|---|
409 | An Idempotency-Key from a still in-flight request was reused before it completed. Retry after Retry-After. |
422 | Request body failed validation, or an Idempotency-Key was reused with a different body. |
429 | Concurrency quota exceeded. See Rate limits. |