Run an agent
POST /v1/agents/{agent_id}/sessions- Permission
write:sessions- Tokens
- API key, CLI user token, Sandbox token
Start a one-shot session from a saved Claude Code agent. Supply input when it declares an input schema; otherwise supply prompt. Send exactly one.
Path parameters
Request
Tighten this run's spend cap, in US dollars. May only lower the agent's own session budget; a higher number, or one above the organization's ceiling, is a 400.
The typed payload for an agent that declares input.json_schema. Required when the agent declares a schema; rejected when it does not. Validated against the schema and rendered through input.message, or as formatted JSON if no template is set. The rendered message must be non-empty. Cannot be combined with prompt.
{}objectArbitrary string key/value metadata stored on the session.
The initial user message, passed verbatim to Claude. Required when the agent declares no input.json_schema; rejected when it does. Must contain non-whitespace text and cannot be combined with input.
Response
The session.