Claude Platform Docs

Sessions

Create Session
client.Beta.Sessions.New(ctx, params) (*BetaManagedAgentsSession, error)
POST/v1/sessions
List Sessions
client.Beta.Sessions.List(ctx, params) (*BidirectionalPageCursor[BetaManagedAgentsSession], error)
GET/v1/sessions
Get Session
client.Beta.Sessions.Get(ctx, sessionID, query) (*BetaManagedAgentsSession, error)
GET/v1/sessions/{session_id}
Update Session
client.Beta.Sessions.Update(ctx, sessionID, params) (*BetaManagedAgentsSession, error)
POST/v1/sessions/{session_id}
Delete Session
client.Beta.Sessions.Delete(ctx, sessionID, body) (*BetaManagedAgentsDeletedSession, error)
DELETE/v1/sessions/{session_id}
Archive Session
client.Beta.Sessions.Archive(ctx, sessionID, body) (*BetaManagedAgentsSession, error)
POST/v1/sessions/{session_id}/archive
Models
type BetaManagedAgentsAdvisorParamsResp struct{…}

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 BetaManagedAgentsAdvisorParamsType
type BetaManagedAgentsAgentMessagePreview struct{…}
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 BetaManagedAgentsAgentMessagePreviewType
type BetaManagedAgentsAgentParamsResp struct{…}

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 BetaManagedAgentsAgentParamsType
Version int64 Optional

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

formatint32
type BetaManagedAgentsAgentThinkingPreview struct{…}
ID string

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

Type BetaManagedAgentsAgentThinkingPreviewType
type BetaManagedAgentsAgentWithOverridesParamsResp struct{…}

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.

type BetaManagedAgentsBranchCheckout struct{…}
Name string

Branch name to check out.

minLength1
maxLength255
Type BetaManagedAgentsBranchCheckoutType
type BetaManagedAgentsBudgetLimit struct{…}

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

MaxListCost BetaMonetaryAmount

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 BetaManagedAgentsBudgetLimitType
type BetaManagedAgentsCacheCreationUsage struct{…}

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

Ephemeral1hInputTokens int64 Optional

Tokens used to create 1-hour ephemeral cache entries.

formatint32
Ephemeral5mInputTokens int64 Optional

Tokens used to create 5-minute ephemeral cache entries.

formatint32
type BetaManagedAgentsCommitCheckout struct{…}
Sha string

Full commit SHA to check out.

minLength7
maxLength64
Type BetaManagedAgentsCommitCheckoutType
type BetaManagedAgentsDeletedSession struct{…}

Confirmation that a session has been permanently deleted.

ID string
Type BetaManagedAgentsDeletedSessionType
type BetaManagedAgentsDeltaContent struct{…}

Regular text content.

Text string

The text content.

minLength1
Type BetaManagedAgentsTextBlockType
Type BetaManagedAgentsDeltaContentType
Index int64 Optional

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
type BetaManagedAgentsDeltaEvent struct{…}

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.

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.

Regular text content.

Text string

The text content.

minLength1
Type BetaManagedAgentsTextBlockType
Type BetaManagedAgentsDeltaContentType
Index int64 Optional

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
EventID 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 BetaManagedAgentsDeltaEventType
type BetaManagedAgentsDeltaType string

EventDeltaType enum

One of the following:
const BetaManagedAgentsDeltaTypeAgentMessage BetaManagedAgentsDeltaType = "agent.message"
const BetaManagedAgentsDeltaTypeAgentThinking BetaManagedAgentsDeltaType = "agent.thinking"
type BetaManagedAgentsFileResourceParamsResp struct{…}

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

FileID string

ID of a previously uploaded file.

minLength1
maxLength128
Type BetaManagedAgentsFileResourceParamsType
MountPath string Optional

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

minLength1
maxLength4096
type BetaManagedAgentsGitHubRepositoryResourceParamsResp struct{…}

Mount a GitHub repository into the session's container.

AuthorizationToken string

GitHub authorization token used to clone the repository.

minLength1
maxLength4096
Type BetaManagedAgentsGitHubRepositoryResourceParamsType
URL string

Github URL of the repository

minLength1
maxLength2048
Checkout BetaManagedAgentsGitHubRepositoryResourceParamsCheckoutUnionResp Optional

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

One of the following:
type BetaManagedAgentsBranchCheckout struct{…}
Name string

Branch name to check out.

minLength1
maxLength255
Type BetaManagedAgentsBranchCheckoutType
type BetaManagedAgentsCommitCheckout struct{…}
Sha string

Full commit SHA to check out.

minLength7
maxLength64
Type BetaManagedAgentsCommitCheckoutType
MountPath string Optional

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

minLength1
maxLength4096
type BetaManagedAgentsMemoryStoreResourceParamResp struct{…}

Parameters for attaching a memory store to an agent session.

MemoryStoreID string

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

Type BetaManagedAgentsMemoryStoreResourceParamType
Access BetaManagedAgentsMemoryStoreResourceParamAccess Optional

Access mode for an attached memory store.

One of the following:
const BetaManagedAgentsMemoryStoreResourceParamAccessReadWrite BetaManagedAgentsMemoryStoreResourceParamAccess = "read_write"
const BetaManagedAgentsMemoryStoreResourceParamAccessReadOnly BetaManagedAgentsMemoryStoreResourceParamAccess = "read_only"
Instructions string Optional

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
type BetaManagedAgentsMultiagent struct{…}

Resolved coordinator topology with a concrete agent roster.

Agents []BetaManagedAgentsMultiagentAgentUnion

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

One of the following:
type BetaManagedAgentsAgentReference struct{…}

A resolved agent reference with a concrete version.

ID string
Type BetaManagedAgentsAgentReferenceType
Version int64
formatint32
type BetaManagedAgentsAdvisor struct{…}

Platform advisor roster entry: a model the session's primary thread may consult mid-turn.

Model string

The advisor model id.

Type BetaManagedAgentsAdvisorType
Type BetaManagedAgentsMultiagentType
type BetaManagedAgentsMultiagentParamsResp struct{…}

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

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).

One of the following:
string
type BetaManagedAgentsAgentParamsResp struct{…}

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 BetaManagedAgentsAgentParamsType
Version int64 Optional

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

formatint32
type BetaManagedAgentsMultiagentSelfParamsResp struct{…}

Sentinel roster entry meaning "the agent that owns this configuration". Resolved server-side to a concrete agent reference.

Type BetaManagedAgentsMultiagentSelfParamsType
type BetaManagedAgentsAdvisorParamsResp struct{…}

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 BetaManagedAgentsAdvisorParamsType
Type BetaManagedAgentsMultiagentParamsType
type BetaManagedAgentsMultiagentRosterEntryParamsUnionResp interface{…}

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

One of the following:
string
type BetaManagedAgentsAgentParamsResp struct{…}

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 BetaManagedAgentsAgentParamsType
Version int64 Optional

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

formatint32
type BetaManagedAgentsMultiagentSelfParamsResp struct{…}

Sentinel roster entry meaning "the agent that owns this configuration". Resolved server-side to a concrete agent reference.

Type BetaManagedAgentsMultiagentSelfParamsType
type BetaManagedAgentsAdvisorParamsResp struct{…}

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 BetaManagedAgentsAdvisorParamsType
type BetaManagedAgentsOutcomeEvaluationResource struct{…}

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

CompletedAt Time

A timestamp in RFC 3339 format

formatdate-time
Description string

What the agent should produce.

Explanation string

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 int64

0-indexed revision cycle the outcome is currently on.

formatint32
OutcomeID 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 BetaManagedAgentsOutcomeEvaluationResourceType
type BetaManagedAgentsServerToolUsage struct{…}

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

WebFetchRequests int64 Optional

Number of server-executed web fetch requests.

formatint32
WebSearchRequests int64 Optional

Number of server-executed web search requests.

formatint32
type BetaManagedAgentsSession struct{…}

A Managed Agents session.

type BetaManagedAgentsSessionAgent struct{…}

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

type BetaManagedAgentsSessionAgentUpdate struct{…}

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.

type BetaManagedAgentsSessionMultiagentCoordinator struct{…}

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

Agents []BetaManagedAgentsSessionMultiagentCoordinatorAgentUnion

Full agent definitions the coordinator may spawn as session threads.

One of the following:
type BetaManagedAgentsSessionThreadAgent struct{…}

Resolved agent definition for a single session_thread. Snapshot of the agent at thread creation time. The multiagent roster is not repeated here; read it from Session.agent.

type BetaManagedAgentsAdvisor struct{…}

Platform advisor roster entry: a model the session's primary thread may consult mid-turn.

Model string

The advisor model id.

Type BetaManagedAgentsAdvisorType
Type BetaManagedAgentsSessionMultiagentCoordinatorType
type BetaManagedAgentsSessionStats struct{…}

Timing statistics for a session.

ActiveSeconds float64 Optional

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

formatdouble
DurationSeconds float64 Optional

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

formatdouble
type BetaManagedAgentsSessionUpdatedEvent struct{…}

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.

ID string

Unique identifier for this event.

ProcessedAt Time

A timestamp in RFC 3339 format

formatdate-time
Type BetaManagedAgentsSessionUpdatedEventType

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.

MaxListCost BetaMonetaryAmount

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 BetaManagedAgentsBudgetLimitType
Metadata map[string, string] Optional

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.

Title string Optional

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

type BetaManagedAgentsSessionUsage struct{…}

Cumulative token usage for a session across all turns.

type BetaManagedAgentsSessionUsageEvent struct{…}

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

ID string

Unique identifier for this event.

ProcessedAt Time

A timestamp in RFC 3339 format

formatdate-time
Type BetaManagedAgentsSessionUsageEventType

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.

MaxListCost BetaMonetaryAmount

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 BetaManagedAgentsBudgetLimitType
type BetaManagedAgentsStartEvent struct{…}

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:
type BetaManagedAgentsAgentMessagePreview struct{…}
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 BetaManagedAgentsAgentMessagePreviewType
type BetaManagedAgentsAgentThinkingPreview struct{…}
ID string

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

Type BetaManagedAgentsAgentThinkingPreviewType
Type BetaManagedAgentsStartEventType
type BetaManagedAgentsStartEventPreviewUnion interface{…}
One of the following:
type BetaManagedAgentsAgentMessagePreview struct{…}
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 BetaManagedAgentsAgentMessagePreviewType
type BetaManagedAgentsAgentThinkingPreview struct{…}
ID string

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

Type BetaManagedAgentsAgentThinkingPreviewType
type BetaManagedAgentsSystemContentBlock struct{…}

Regular text content.

Text string

The text content.

minLength1
Type BetaManagedAgentsSystemContentBlockType
type BetaManagedAgentsSystemMessageEvent struct{…}

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.

System content blocks. Text-only.

Text string

The text content.

minLength1
Type BetaManagedAgentsSystemContentBlockType
Type BetaManagedAgentsSystemMessageEventType
ProcessedAt Time Optional

A timestamp in RFC 3339 format

formatdate-time
type BetaManagedAgentsUserToolResultEvent struct{…}

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(ctx, sessionID, params) (*PageCursor[BetaManagedAgentsSessionEventUnion], error)
GET/v1/sessions/{session_id}/events
Send Events
client.Beta.Sessions.Events.Send(ctx, sessionID, params) (*BetaManagedAgentsSendSessionEvents, error)
POST/v1/sessions/{session_id}/events
Stream Events
client.Beta.Sessions.Events.Stream(ctx, sessionID, params) (*BetaManagedAgentsStreamSessionEventsUnion, error)
GET/v1/sessions/{session_id}/events/stream

SessionsResources

Add Session Resource
client.Beta.Sessions.Resources.Add(ctx, sessionID, params) (*BetaManagedAgentsFileResource, error)
POST/v1/sessions/{session_id}/resources
List Session Resources
client.Beta.Sessions.Resources.List(ctx, sessionID, params) (*PageCursor[BetaManagedAgentsSessionResourceUnion], error)
GET/v1/sessions/{session_id}/resources
Get Session Resource
client.Beta.Sessions.Resources.Get(ctx, resourceID, params) (*BetaSessionResourceGetResponseUnion, error)
GET/v1/sessions/{session_id}/resources/{resource_id}
Update Session Resource
client.Beta.Sessions.Resources.Update(ctx, resourceID, params) (*BetaSessionResourceUpdateResponseUnion, error)
POST/v1/sessions/{session_id}/resources/{resource_id}
Delete Session Resource
client.Beta.Sessions.Resources.Delete(ctx, resourceID, params) (*BetaManagedAgentsDeleteSessionResource, error)
DELETE/v1/sessions/{session_id}/resources/{resource_id}

SessionsThreads

List Session Threads
client.Beta.Sessions.Threads.List(ctx, sessionID, params) (*PageCursor[BetaManagedAgentsSessionThread], error)
GET/v1/sessions/{session_id}/threads
Get Session Thread
client.Beta.Sessions.Threads.Get(ctx, threadID, params) (*BetaManagedAgentsSessionThread, error)
GET/v1/sessions/{session_id}/threads/{thread_id}
Archive Session Thread
client.Beta.Sessions.Threads.Archive(ctx, threadID, params) (*BetaManagedAgentsSessionThread, error)
POST/v1/sessions/{session_id}/threads/{thread_id}/archive

SessionsThreadsEvents

List Session Thread Events
client.Beta.Sessions.Threads.Events.List(ctx, threadID, params) (*PageCursor[BetaManagedAgentsSessionEventUnion], error)
GET/v1/sessions/{session_id}/threads/{thread_id}/events
Stream Session Thread Events
client.Beta.Sessions.Threads.Events.Stream(ctx, threadID, params) (*BetaManagedAgentsStreamSessionThreadEventsUnion, error)
GET/v1/sessions/{session_id}/threads/{thread_id}/stream