Claude Platform Docs

Sessions

Create Session
$client->beta->sessions->create(Agent agent, string environmentID, ?BetaManagedAgentsBudgetLimit budget, ?list<InitialEvent> initialEvents, ?array<string,string> metadata, ?list<Resource> resources, ?string title, ?list<string> vaultIDs, ?list<AnthropicBeta> betas): BetaManagedAgentsSession
POST/v1/sessions
List Sessions
$client->beta->sessions->list(?string agentID, ?int agentVersion, ?\Datetime createdAtGt, ?\Datetime createdAtGte, ?\Datetime createdAtLt, ?\Datetime createdAtLte, ?string deploymentID, ?bool includeArchived, ?int limit, ?string memoryStoreID, ?Order order, ?string page, ?list<Status> statuses, ?list<AnthropicBeta> betas): BidirectionalPageCursor<BetaManagedAgentsSession>
GET/v1/sessions
Get Session
$client->beta->sessions->retrieve(string sessionID, ?list<AnthropicBeta> betas): BetaManagedAgentsSession
GET/v1/sessions/{session_id}
Update Session
$client->beta->sessions->update(string sessionID, ?BetaManagedAgentsSessionAgentUpdate agent, ?BetaManagedAgentsBudgetLimit budget, ?array<string,string> metadata, ?string title, ?list<string> vaultIDs, ?list<AnthropicBeta> betas): BetaManagedAgentsSession
POST/v1/sessions/{session_id}
Delete Session
$client->beta->sessions->delete(string sessionID, ?list<AnthropicBeta> betas): BetaManagedAgentsDeletedSession
DELETE/v1/sessions/{session_id}
Archive Session
$client->beta->sessions->archive(string sessionID, ?list<AnthropicBeta> betas): BetaManagedAgentsSession
POST/v1/sessions/{session_id}/archive
Models
string model

A Claude model id. The model must be permitted as an advisor for this agent's model — see the sessions/threads/advisor spec.

Type type
string id

The id the buffered agent.message will carry if it is emitted. Matches the event_id on this preview's event_delta events.

Type type
string id

The agent ID.

Type type
?int version

The specific agent version to use. Omit to use the latest version. Must be at least 1 if specified.

string id

The id the buffered agent.thinking will carry if it is emitted. Start-only — no event_delta events follow.

Type type
string id

The agent ID.

Type type

Replacement MCP server list. Full replacement: the provided array becomes the MCP servers. Send an empty array to clear; omit to preserve the agent's servers.

?Model model

Replacement model. Accepts the model string, e.g. claude-opus-5, or a model_config object. Omit to use the agent's model.

Replacement skill list. Full replacement: the provided array becomes the skills. Send an empty array to clear; omit to preserve the agent's skills.

?string system

Replacement system prompt. Up to 100,000 characters. Set to null to clear the agent's system prompt; omit to preserve it.

?list<Tool> tools

Replacement tool list. Full replacement: the provided array becomes the tool configuration. Send an empty array to clear; omit to preserve the agent's tools.

?int version

The specific agent version to use. Omit to use the latest version.

string name

Branch name to check out.

Type type
BetaMonetaryAmount maxListCost

A monetary amount in a specific currency.

Type type
?int ephemeral1hInputTokens

Tokens used to create 1-hour ephemeral cache entries.

?int ephemeral5mInputTokens

Tokens used to create 5-minute ephemeral cache entries.

string sha

Full commit SHA to check out.

Type type
string id
Type type

Regular text content.

Type type
?int index

Which entry in the previewed event's content array this fragment lands in. Insert content as that entry when the index is new; append to the existing entry otherwise.

One fragment of the previewed event. The delta type is named for the previewed event's field it streams into: agent.message events stream content_delta fragments, each a partial element of the content array.

string eventID

The id of the event being previewed. Matches event.id on the corresponding event_start and the buffered event that reconciles the preview.

Type type
One of the following:
"agent.message"
"agent.thinking"
string fileID

ID of a previously uploaded file.

Type type
?string mountPath

Mount path in the container. Defaults to /mnt/session/uploads/<file_id>.

string authorizationToken

GitHub authorization token used to clone the repository.

Type type
string url

Github URL of the repository

?Checkout checkout

Branch or commit to check out. Defaults to the repository's default branch.

?string mountPath

Mount path in the container. Defaults to /workspace/<repo-name>.

string memoryStoreID

The memory store ID (memstore_...). Must belong to the caller's organization and workspace.

Type type
?Access access

Access mode for an attached memory store.

?string instructions

Per-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars.

list<Agent> agents

Agents the coordinator may spawn as session threads, each resolved to a specific version.

Type type

Agents the coordinator may spawn as session threads. 1–20 entries. Each entry is an agent ID string, a versioned {"type":"agent","id","version"} reference, or {"type":"self"} to allow recursive self-invocation. Entries must reference distinct agents (after resolving self and string forms); at most one self. Referenced agents must exist, must not be archived, and must not themselves have multiagent set (depth limit 1).

Type type
One of the following:
string
string id

The agent ID.

Type type
?int version

The specific agent version to use. Omit to use the latest version. Must be at least 1 if specified.

string model

A Claude model id. The model must be permitted as an advisor for this agent's model — see the sessions/threads/advisor spec.

Type type
?\Datetime completedAt

A timestamp in RFC 3339 format

string description

What the agent should produce.

?string explanation

Grader's verdict text from the most recent evaluation. For satisfied, explains why criteria are met; for needs_revision (intermediate), what's missing; for failed, why unrecoverable.

int iteration

0-indexed revision cycle the outcome is currently on.

string outcomeID

Server-generated outc_ ID for this outcome.

string result

Current evaluation state. pending before the agent begins work; running while producing or revising; evaluating while the grader scores; satisfied/max_iterations_reached/failed/interrupted are terminal.

Type type
?int webFetchRequests

Number of server-executed web fetch requests.

?int webSearchRequests

Number of server-executed web search requests.

string id
?string description

Model identifier and configuration.

Resolved coordinator topology with full agent definitions for each roster member.

string name
list<Skill> skills
?string system
list<Tool> tools
Type type
int version

Replacement MCP server list. Full replacement: the provided array becomes the new value. Send an empty array to clear; omit to preserve.

?list<Tool> tools

Replacement tool list. Full replacement: the provided array becomes the new value. Send an empty array to clear; omit to preserve.

list<Agent> agents

Full agent definitions the coordinator may spawn as session threads.

Type type
?float activeSeconds

Cumulative time in seconds the session spent in running status. Excludes idle time.

?float durationSeconds

Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update.

string id

Unique identifier for this event.

\Datetime processedAt

A timestamp in RFC 3339 format

Type type

Resolved agent definition for a session. Snapshot of the agent at session creation time.

A hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches max_list_cost.

?array<string,string> metadata

The session's full metadata bag after the update. Present when the update set non-empty metadata; absent when metadata was unchanged or cleared to empty.

?string title

The session's new title. Present only when the update changed it.

?float activeSeconds

Cumulative time in seconds during which the session had at least one thread in running status. Overlapping activity from concurrent threads is counted once, unlike stats.active_seconds, which sums each thread's own active time. This is the duration the session's runtime cost is priced on.

Prompt-cache creation token usage broken down by cache lifetime.

?int cacheReadInputTokens

Total tokens read from prompt cache.

?int inputTokens

Total input tokens consumed across all turns.

?BetaMonetaryAmount listCost

A monetary amount in a specific currency.

?int outputTokens

Total output tokens generated across all turns.

Cumulative count of server-executed tool invocations, broken down by tool.

string id

Unique identifier for this event.

\Datetime processedAt

A timestamp in RFC 3339 format

Type type

Point-in-time snapshot of a session's cumulative usage.

A hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches max_list_cost.

The previewed event's type and id. The event type determines which delta types the preview's event_delta events carry: agent.message events stream content_delta fragments; agent.thinking previews are start-only — no deltas follow, and the buffered agent.thinking with the same id concludes them.

Type type
One of the following:
string id

The id the buffered agent.message will carry if it is emitted. Matches the event_id on this preview's event_delta events.

Type type
string id

The id the buffered agent.thinking will carry if it is emitted. Start-only — no event_delta events follow.

Type type
string text

The text content.

Type type
string id

Unique identifier for this event.

System content blocks. Text-only.

Type type
?\Datetime processedAt

A timestamp in RFC 3339 format

string id

Unique identifier for this event.

string toolUseID

The id of the agent.tool_use event this result corresponds to, which can be found in the last session.status_idle event's stop_reason.event_ids field.

Type type
?list<Content> content

The result content returned by the tool.

?bool isError

Whether the tool execution resulted in an error.

?\Datetime processedAt

A timestamp in RFC 3339 format

?string sessionThreadID

Routes this result to a subagent thread. Copy from the agent.tool_use event's session_thread_id.

SessionsEvents

List Events
$client->beta->sessions->events->list(string sessionID, ?\Datetime createdAtGt, ?\Datetime createdAtGte, ?\Datetime createdAtLt, ?\Datetime createdAtLte, ?int limit, ?Order order, ?string page, ?list<string> types, ?list<AnthropicBeta> betas): PageCursor<ManagedAgentsSessionEvent>
GET/v1/sessions/{session_id}/events
Send Events
$client->beta->sessions->events->send(string sessionID, list<ManagedAgentsEventParams> events, ?list<AnthropicBeta> betas): ManagedAgentsSendSessionEvents
POST/v1/sessions/{session_id}/events
Stream Events
$client->beta->sessions->events->stream(string sessionID, ?list<BetaManagedAgentsDeltaType> eventDeltas, ?list<AnthropicBeta> betas): ManagedAgentsStreamSessionEvents
GET/v1/sessions/{session_id}/events/stream

SessionsResources

Add Session Resource
$client->beta->sessions->resources->add(string sessionID, string fileID, Type type, ?string mountPath, ?list<AnthropicBeta> betas): ManagedAgentsFileResource
POST/v1/sessions/{session_id}/resources
List Session Resources
$client->beta->sessions->resources->list(string sessionID, ?int limit, ?string page, ?list<AnthropicBeta> betas): PageCursor<ManagedAgentsSessionResource>
GET/v1/sessions/{session_id}/resources
Get Session Resource
$client->beta->sessions->resources->retrieve(string resourceID, string sessionID, ?list<AnthropicBeta> betas): ResourceGetResponse
GET/v1/sessions/{session_id}/resources/{resource_id}
Update Session Resource
$client->beta->sessions->resources->update(string resourceID, string sessionID, string authorizationToken, ?list<AnthropicBeta> betas): ResourceUpdateResponse
POST/v1/sessions/{session_id}/resources/{resource_id}
Delete Session Resource
$client->beta->sessions->resources->delete(string resourceID, string sessionID, ?list<AnthropicBeta> betas): ManagedAgentsDeleteSessionResource
DELETE/v1/sessions/{session_id}/resources/{resource_id}

SessionsThreads

List Session Threads
$client->beta->sessions->threads->list(string sessionID, ?int limit, ?string page, ?list<AnthropicBeta> betas): PageCursor<ManagedAgentsSessionThread>
GET/v1/sessions/{session_id}/threads
Get Session Thread
$client->beta->sessions->threads->retrieve(string threadID, string sessionID, ?list<AnthropicBeta> betas): ManagedAgentsSessionThread
GET/v1/sessions/{session_id}/threads/{thread_id}
Archive Session Thread
$client->beta->sessions->threads->archive(string threadID, string sessionID, ?list<AnthropicBeta> betas): ManagedAgentsSessionThread
POST/v1/sessions/{session_id}/threads/{thread_id}/archive

SessionsThreadsEvents

List Session Thread Events
$client->beta->sessions->threads->events->list(string threadID, string sessionID, ?int limit, ?string page, ?list<AnthropicBeta> betas): PageCursor<ManagedAgentsSessionEvent>
GET/v1/sessions/{session_id}/threads/{thread_id}/events
Stream Session Thread Events
$client->beta->sessions->threads->events->stream(string threadID, string sessionID, ?list<BetaManagedAgentsDeltaType> eventDeltas, ?list<AnthropicBeta> betas): ManagedAgentsStreamSessionThreadEvents
GET/v1/sessions/{session_id}/threads/{thread_id}/stream