Claude Platform Docs

Sessions

Create Session
client.beta.sessions.create(SessionCreateParamsparams, RequestOptionsoptions?): BetaManagedAgentsSession
POST/v1/sessions
List Sessions
client.beta.sessions.list(SessionListParamsparams?, RequestOptionsoptions?): BidirectionalPageCursor<BetaManagedAgentsSession>
GET/v1/sessions
Get Session
client.beta.sessions.retrieve(stringsessionID, SessionRetrieveParamsparams?, RequestOptionsoptions?): BetaManagedAgentsSession
GET/v1/sessions/{session_id}
Update Session
client.beta.sessions.update(stringsessionID, SessionUpdateParamsparams, RequestOptionsoptions?): BetaManagedAgentsSession
POST/v1/sessions/{session_id}
Delete Session
client.beta.sessions.delete(stringsessionID, SessionDeleteParamsparams?, RequestOptionsoptions?): BetaManagedAgentsDeletedSession
DELETE/v1/sessions/{session_id}
Archive Session
client.beta.sessions.archive(stringsessionID, SessionArchiveParamsparams?, RequestOptionsoptions?): BetaManagedAgentsSession
POST/v1/sessions/{session_id}/archive
Models
BetaManagedAgentsAdvisorParams { model, type }

Platform advisor roster entry: a model the session's primary thread may consult mid-turn. At most one per roster; the entry occupies the roster name anthropic.advisor.

model: string

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

minLength1
maxLength256
type: "advisor"
BetaManagedAgentsAgentMessagePreview { id, type }
id: string

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

type: "agent.message"
BetaManagedAgentsAgentParams { id, type, version }

Specification for an Agent. Provide a specific version or use the short-form agent="agent_id" for the most recent version

id: string

The agent ID.

minLength1
maxLength128
type: "agent"
version?: number

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

formatint32
BetaManagedAgentsAgentThinkingPreview { id, type }
id: string

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

type: "agent.thinking"
BetaManagedAgentsAgentWithOverridesParams { id, type, mcp_servers, 5 more }

Reference to an agent plus optional configuration overrides. Each provided field replaces the agent's value for the caller's use; the agent resource is unchanged.

BetaManagedAgentsBranchCheckout { name, type }
name: string

Branch name to check out.

minLength1
maxLength255
type: "branch"
BetaManagedAgentsBudgetLimit { max_list_cost, type }

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

max_list_cost: BetaMonetaryAmount { amount, currency }

A monetary amount in a specific currency.

amount: string

Amount in minor units of the currency, as an integer decimal string with no leading zeros: "2500" is $25.00 and "50" is fifty cents. A string rather than a number so no float rounding is ever applied.

currency: BetaCurrency

Uppercase ISO-4217 currency code. USD is the only currency currently supported; the accepted set is closed and grows only when a new currency is priced.

type: "limit"
BetaManagedAgentsCacheCreationUsage { ephemeral_1h_input_tokens, ephemeral_5m_input_tokens }

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

ephemeral_1h_input_tokens?: number

Tokens used to create 1-hour ephemeral cache entries.

formatint32
ephemeral_5m_input_tokens?: number

Tokens used to create 5-minute ephemeral cache entries.

formatint32
BetaManagedAgentsCommitCheckout { sha, type }
sha: string

Full commit SHA to check out.

minLength7
maxLength64
type: "commit"
BetaManagedAgentsDeletedSession { id, type }

Confirmation that a session has been permanently deleted.

id: string
type: "session_deleted"
BetaManagedAgentsDeltaContent { content, type, index }
content: BetaManagedAgentsTextBlock { text, type }

Regular text content.

text: string

The text content.

minLength1
type: "text"
type: "content_delta"
index?: number

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.

formatuint32
BetaManagedAgentsDeltaEvent { delta, event_id, type }

An incremental update to an event that is still being streamed. Deltas are best-effort and may stop early; when the buffered event with id == event_id is produced it carries the complete content. A model request that ends early (an error or interrupt) produces no buffered event — its terminal span.model_request_end closes the preview. Only sent on stream connections that opt in via event_deltas; never appears in event history.

delta: BetaManagedAgentsDeltaContent { content, type, index }

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.

content: BetaManagedAgentsTextBlock { text, type }

Regular text content.

text: string

The text content.

minLength1
type: "text"
type: "content_delta"
index?: number

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.

formatuint32
event_id: string

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

type: "event_delta"
BetaManagedAgentsDeltaType = "agent.message" | "agent.thinking"

EventDeltaType enum

One of the following:
"agent.message"
"agent.thinking"
BetaManagedAgentsFileResourceParams { file_id, type, mount_path }

Mount a file uploaded via the Files API into the session.

file_id: string

ID of a previously uploaded file.

minLength1
maxLength128
type: "file"
mount_path?: string | null

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

minLength1
maxLength4096
BetaManagedAgentsGitHubRepositoryResourceParams { authorization_token, type, url, 2 more }

Mount a GitHub repository into the session's container.

BetaManagedAgentsMemoryStoreResourceParam { memory_store_id, type, access, instructions }

Parameters for attaching a memory store to an agent session.

memory_store_id: string

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

type: "memory_store"
access?: "read_write" | "read_only" | null

Access mode for an attached memory store.

One of the following:
"read_write"
"read_only"
instructions?: string | null

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

maxLength4096
BetaManagedAgentsMultiagent { agents, type }

Resolved coordinator topology with a concrete agent roster.

BetaManagedAgentsMultiagentParams { agents, type }

A coordinator topology: the session's primary thread orchestrates work by spawning session threads, each running an agent drawn from the agents roster.

BetaManagedAgentsMultiagentRosterEntryParams = string | BetaManagedAgentsAgentParams { id, type, version } | BetaManagedAgentsMultiagentSelfParams { type } | BetaManagedAgentsAdvisorParams { model, type }

An entry in a multiagent roster: an agent ID string, a versioned agent reference, or self.

One of the following:
BetaManagedAgentsOutcomeEvaluationResource { completed_at, description, explanation, 4 more }

Evaluation state for a single outcome defined via a define_outcome event.

completed_at: string | null

A timestamp in RFC 3339 format

formatdate-time
description: string

What the agent should produce.

explanation: string | null

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.

iteration: number

0-indexed revision cycle the outcome is currently on.

formatint32
outcome_id: string

Server-generated outc_ ID for this outcome.

result: string

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: "outcome_evaluation"
BetaManagedAgentsServerToolUsage { web_fetch_requests, web_search_requests }

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

web_fetch_requests?: number

Number of server-executed web fetch requests.

formatint32
web_search_requests?: number

Number of server-executed web search requests.

formatint32
BetaManagedAgentsSession { id, agent, archived_at, 14 more }

A Managed Agents session.

BetaManagedAgentsSessionAgent { id, description, mcp_servers, 8 more }

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

BetaManagedAgentsSessionAgentUpdate { mcp_servers, tools }

Mid-session agent configuration update. Only tools and mcp_servers are updatable. Full replacement: the provided array becomes the new value. To preserve existing entries, GET the session, modify the array, and POST it back.

BetaManagedAgentsSessionMultiagentCoordinator { agents, type }

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

BetaManagedAgentsSessionStats { active_seconds, duration_seconds }

Timing statistics for a session.

active_seconds?: number

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

formatdouble
duration_seconds?: number

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

formatdouble
BetaManagedAgentsSessionUpdatedEvent { id, processed_at, type, 4 more }

Emitted when an UpdateSession request changed at least one field. Carries only the fields that changed; absent fields were not part of the update. The new configuration applies from the next turn.

BetaManagedAgentsSessionUsage { active_seconds, cache_creation, cache_read_input_tokens, 4 more }

Cumulative token usage for a session across all turns.

BetaManagedAgentsSessionUsageEvent { id, processed_at, type, 2 more }

Periodic snapshot of the session's cumulative usage and tracked list cost.

BetaManagedAgentsStartEvent { event, type }

Opens a preview of a buffered event. Carries the previewed event's type and id only. Followed by zero or more event_delta events with the same event id, normally concluded by the buffered event carrying that id. If the producing model request ends without that event (an error or interrupt mid-stream), its terminal span.model_request_end closes the preview. Only sent on stream connections that opt in via event_deltas; never appears in event history.

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.

One of the following:
BetaManagedAgentsAgentMessagePreview { id, type }
id: string

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

type: "agent.message"
BetaManagedAgentsAgentThinkingPreview { id, type }
id: string

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

type: "agent.thinking"
type: "event_start"
BetaManagedAgentsStartEventPreview = BetaManagedAgentsAgentMessagePreview { id, type } | BetaManagedAgentsAgentThinkingPreview { id, type }
One of the following:
BetaManagedAgentsAgentMessagePreview { id, type }
id: string

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

type: "agent.message"
BetaManagedAgentsAgentThinkingPreview { id, type }
id: string

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

type: "agent.thinking"
BetaManagedAgentsSystemContentBlock { text, type }

Regular text content.

text: string

The text content.

minLength1
type: "text"
BetaManagedAgentsSystemMessageEvent { id, content, type, processed_at }

A mid-conversation system message event. Carries system-role content that is appended to the session as a role: "system" turn.

id: string

Unique identifier for this event.

content: Array<BetaManagedAgentsSystemContentBlock { text, type }>

System content blocks. Text-only.

text: string

The text content.

minLength1
type: "text"
type: "system.message"
processed_at?: string | null

A timestamp in RFC 3339 format

formatdate-time
BetaManagedAgentsUserToolResultEvent { id, tool_use_id, type, 4 more }

Event sent by the client providing the result of an agent-toolset tool execution. Only valid on self_hosted environments, where sandbox-routed tools are executed by the client rather than the server.

SessionsEvents

List Events
client.beta.sessions.events.list(stringsessionID, EventListParamsparams?, RequestOptionsoptions?): PageCursor<BetaManagedAgentsSessionEvent>
GET/v1/sessions/{session_id}/events
Send Events
client.beta.sessions.events.send(stringsessionID, EventSendParamsparams, RequestOptionsoptions?): BetaManagedAgentsSendSessionEvents
POST/v1/sessions/{session_id}/events
Stream Events
client.beta.sessions.events.stream(stringsessionID, EventStreamParamsparams?, RequestOptionsoptions?): BetaManagedAgentsStreamSessionEvents | Stream<BetaManagedAgentsStreamSessionEvents>
GET/v1/sessions/{session_id}/events/stream

SessionsResources

Add Session Resource
client.beta.sessions.resources.add(stringsessionID, ResourceAddParamsparams, RequestOptionsoptions?): BetaManagedAgentsFileResource
POST/v1/sessions/{session_id}/resources
List Session Resources
client.beta.sessions.resources.list(stringsessionID, ResourceListParamsparams?, RequestOptionsoptions?): PageCursor<BetaManagedAgentsSessionResource>
GET/v1/sessions/{session_id}/resources
Get Session Resource
client.beta.sessions.resources.retrieve(stringresourceID, ResourceRetrieveParamsparams, RequestOptionsoptions?): ResourceRetrieveResponse
GET/v1/sessions/{session_id}/resources/{resource_id}
Update Session Resource
client.beta.sessions.resources.update(stringresourceID, ResourceUpdateParamsparams, RequestOptionsoptions?): ResourceUpdateResponse
POST/v1/sessions/{session_id}/resources/{resource_id}
Delete Session Resource
client.beta.sessions.resources.delete(stringresourceID, ResourceDeleteParamsparams, RequestOptionsoptions?): BetaManagedAgentsDeleteSessionResource
DELETE/v1/sessions/{session_id}/resources/{resource_id}

SessionsThreads

List Session Threads
client.beta.sessions.threads.list(stringsessionID, ThreadListParamsparams?, RequestOptionsoptions?): PageCursor<BetaManagedAgentsSessionThread>
GET/v1/sessions/{session_id}/threads
Get Session Thread
client.beta.sessions.threads.retrieve(stringthreadID, ThreadRetrieveParamsparams, RequestOptionsoptions?): BetaManagedAgentsSessionThread
GET/v1/sessions/{session_id}/threads/{thread_id}
Archive Session Thread
client.beta.sessions.threads.archive(stringthreadID, ThreadArchiveParamsparams, RequestOptionsoptions?): BetaManagedAgentsSessionThread
POST/v1/sessions/{session_id}/threads/{thread_id}/archive

SessionsThreadsEvents

List Session Thread Events
client.beta.sessions.threads.events.list(stringthreadID, EventListParamsparams, RequestOptionsoptions?): PageCursor<BetaManagedAgentsSessionEvent>
GET/v1/sessions/{session_id}/threads/{thread_id}/events
Stream Session Thread Events
client.beta.sessions.threads.events.stream(stringthreadID, EventStreamParamsparams, RequestOptionsoptions?): BetaManagedAgentsStreamSessionThreadEvents | Stream<BetaManagedAgentsStreamSessionThreadEvents>
GET/v1/sessions/{session_id}/threads/{thread_id}/stream