Quick start
Start your first agent session from the CLI, Python, TypeScript, or curl.
These steps create an agent, start a session from it, wait for it to finish, and read its output.
Core concepts
| Concept | Meaning |
|---|---|
| Agent | An agent saves a prompt, an environment, permissions, and a budget. |
| Environment | An environment is the repositories, setup scripts, environment variables, and machine size a session starts with. |
| Session | A session is a conversation with Claude Code or Codex in its own cloud environment. |
Before you begin
Install the CLI
Sign in
Sign in with device auth. The CLI opens your browser to approve the login:
For CI, the SDKs, and curl, export an API key from API > API keys in the dashboard:
Install the SDK
Create your first session
Create an agent
Start it with {"input":{"description":"Reject expired reset tokens"}} instead of a prompt. The validated result is output.result on the session once the message is answered.
POST /v1/agents creates an agent without a repository file. Send the same fields as JSON under agent.
Start an agent session
Start the classify-change agent:
Typed input and output defines it. An agent with no input schema takes prompt instead of input.
Wait for it to finish
wait and --watch return when the session is idle or closed. wait returns how the message ended, one of completed, failed, stopped, or cancelled. --watch exits 0 only when the session has no error.
Read the output
It matches the agent's output.json_schema and is null until the agent submits it.
What's happening
When you start the agent, these happen in order.
- Ellipsis checks
inputagainst the agent'sinput.json_schema, returning422when it doesn't match. messagerenders asClassify this change: Reject expired reset tokens.- A new session starts with the agent's prompt, model, and budget.
- Claude Code answers the message in its own cloud environment.
- The validated result is saved as
output.resulton the session. - The session's
statusbecomesidleand it stays open for follow-ups.
Errors and retries
- Errors return
{"error": {"code": "...", "message": "..."}}. Branch oncode, notmessage. - Retry
429afterRetry-After, and5xxwith backoff. - A start that times out can still succeed. Send the same
idempotency_keywhen you retry it, and you get back the session the first request started. Keys are kept for 90 days.
Pagination
- Paginated routes take
limitandcursor. - Pass
next_cursoruntilhas_moreisfalse. - SDK iterators fetch every page.