会话
列出会话
beta.sessions.list(**kwargs) -> SyncBidirectionalPageCursor[BetaManagedAgentsSession]获取会话
beta.sessions.retrieve(session_id, **kwargs) -> BetaManagedAgentsSession更新会话
beta.sessions.update(session_id, **kwargs) -> BetaManagedAgentsSession删除会话
beta.sessions.delete(session_id, **kwargs) -> BetaManagedAgentsDeletedSession归档会话
beta.sessions.archive(session_id, **kwargs) -> BetaManagedAgentsSessionModels
class BetaManagedAgentsAdvisorParams: type: "advisor"; modelPlatform 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.
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: strA Claude model id. The model must be permitted as an advisor for this agent's model.
A Claude model id. The model must be permitted as an advisor for this agent's model.
class BetaManagedAgentsAgentMessagePreview: type: "agent.message"; id
The id the buffered agent.message will carry if it is emitted. Matches the event_id on this preview's event_delta events.
class BetaManagedAgentsAgentParams: type: "agent"; id; versionSpecification for an Agent. Provide a specific version or use the short-form agent="agent_id" for the most recent version
Specification for an Agent. Provide a specific version or use the short-form agent="agent_id" for the most recent version
id: strThe agent ID.
The agent ID.
version: Optional[int]The specific agent version to use. Omit to use the latest version. Must be at least 1 if specified.
The specific agent version to use. Omit to use the latest version. Must be at least 1 if specified.
class BetaManagedAgentsAgentThinkingPreview: type: "agent.thinking"; id
The id the buffered agent.thinking will carry if it is emitted. Start-only — no event_delta events follow.
class BetaManagedAgentsAgentWithOverridesParams: type: "agent_with_overrides"; id; mcp_servers; ... # 5 moreReference 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.
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.
class BetaManagedAgentsBranchCheckout: type: "branch"; name
name: strBranch name to check out.
Branch name to check out.
class BetaManagedAgentsBudgetLimit: type: "limit"; max_list_costA hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches max_list_cost.
A hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches max_list_cost.
max_list_cost: BetaMonetaryAmountMaximum list cost the session may accrue. List price is used regardless of any negotiated discount, so the cap fires at or before the actual charge.
Maximum list cost the session may accrue. List price is used regardless of any negotiated discount, so the cap fires at or before the actual charge.
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.
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.
class BetaManagedAgentsCacheCreationUsage: ephemeral_1h_input_tokens; ephemeral_5m_input_tokensPrompt-cache creation token usage broken down by cache lifetime.
Prompt-cache creation token usage broken down by cache lifetime.
ephemeral_1h_input_tokens: Optional[int]Tokens used to create 1-hour ephemeral cache entries.
Tokens used to create 1-hour ephemeral cache entries.
ephemeral_5m_input_tokens: Optional[int]Tokens used to create 5-minute ephemeral cache entries.
Tokens used to create 5-minute ephemeral cache entries.
class BetaManagedAgentsCommitCheckout: type: "commit"; sha
sha: strFull commit SHA to check out.
Full commit SHA to check out.
class BetaManagedAgentsDeletedSession: type: "session_deleted"; idConfirmation that a session has been permanently deleted.
Confirmation that a session has been permanently deleted.
class BetaManagedAgentsDeltaContent: type: "content_delta"; content; index
content: BetaManagedAgentsTextBlockA partial element of the content array at index, typed like the element itself — the same shape the buffered agent.message carries in content.
A partial element of the content array at index, typed like the element itself — the same shape the buffered agent.message carries in content.
text: strThe text content.
The text content.
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.
class BetaManagedAgentsDeltaEvent: type: "event_delta"; delta; event_idAn 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.
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.
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: BetaManagedAgentsTextBlockA partial element of the content array at index, typed like the element itself — the same shape the buffered agent.message carries in content.
A partial element of the content array at index, typed like the element itself — the same shape the buffered agent.message carries in content.
text: strThe text content.
The text content.
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.
The id of the event being previewed. Matches event.id on the corresponding event_start and the buffered event that reconciles the preview.
type BetaManagedAgentsDeltaType = Literal["agent.message", "agent.thinking"]
class BetaManagedAgentsFileResourceParams: type: "file"; file_id; mount_pathMount a file uploaded via the Files API into the session.
Mount a file uploaded via the Files API into the session.
file_id: strID of a previously uploaded file.
ID of a previously uploaded file.
mount_path: Optional[str]Mount path in the container. Defaults to /mnt/session/uploads/<file_id>.
Mount path in the container. Defaults to /mnt/session/uploads/<file_id>.
class BetaManagedAgentsGitHubRepositoryResourceParams: type: "github_repository"; url; authorization_token; ... # 2 moreMount a GitHub repository into the session's container.
Mount a GitHub repository into the session's container.
class BetaManagedAgentsMemoryStoreResourceParam: type: "memory_store"; memory_store_id; access; instructionsParameters for attaching a memory store to an agent session.
Parameters for attaching a memory store to an agent session.
The memory store ID (memstore_...). Must belong to the caller's organization and workspace.
access: Optional[Literal["read_write", "read_only"]]Access mode for the mounted store. Defaults to read_write. read_only mounts the store as a read-only filesystem.
Access mode for the mounted store. Defaults to read_write. read_only mounts the store as a read-only filesystem.
instructions: Optional[str]Per-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars.
Per-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars.
type BetaManagedAgentsMultiagent = ...Resolved multiagent orchestration configuration as returned in API responses.
Resolved multiagent orchestration configuration as returned in API responses.
class BetaManagedAgentsMultiagentCoordinator: type: "coordinator"; agentsResolved coordinator topology with a concrete agent roster.
Resolved coordinator topology with a concrete agent roster.
class BetaManagedAgentsMultiagent20261001: type: "multiagent_20261001"; advisor; subagents; workflowsResolved multiagent configuration with three members, each enabled or disabled on its own.
Resolved multiagent configuration with three members, each enabled or disabled on its own.
type BetaManagedAgentsMultiagentParams = ...Multiagent orchestration configuration.
Multiagent orchestration configuration.
class BetaManagedAgentsMultiagentCoordinatorParams: type: "coordinator"; agentsA coordinator topology: the session's primary thread orchestrates work by spawning session threads, each running an agent drawn from the agents roster.
A coordinator topology: the session's primary thread orchestrates work by spawning session threads, each running an agent drawn from the agents roster.
class BetaManagedAgentsMultiagent20261001Params: type: "multiagent_20261001"; advisor; subagents; workflowsMultiagent configuration with three members, each enabled or disabled on its own. On an update, if the agent's stored multiagent also has type multiagent_20261001, this configuration is merged into the stored one, level by level, instead of replacing it. A key that the update omits keeps its stored value. A key sent as null takes its default, on create as well, so "workflows": null enables workflows. An object sent with a type other than the stored one replaces the stored object, and the keys that it omits take their defaults. A predefined_agents list that is sent replaces the stored list. Every object that is sent needs its type, and an enabled advisor needs its model. Other validation applies to the merged result.
Multiagent configuration with three members, each enabled or disabled on its own. On an update, if the agent's stored multiagent also has type multiagent_20261001, this configuration is merged into the stored one, level by level, instead of replacing it. A key that the update omits keeps its stored value. A key sent as null takes its default, on create as well, so "workflows": null enables workflows. An object sent with a type other than the stored one replaces the stored object, and the keys that it omits take their defaults. A predefined_agents list that is sent replaces the stored list. Every object that is sent needs its type, and an enabled advisor needs its model. Other validation applies to the merged result.
type BetaManagedAgentsMultiagentRosterEntryParams = ...An entry in a multiagent roster: an agent ID string, a versioned agent reference, or self.
An entry in a multiagent roster: an agent ID string, a versioned agent reference, or self.
class BetaManagedAgentsOutcomeEvaluationResource: type: "outcome_evaluation"; completed_at; description; ... # 4 moreEvaluation state for a single outcome defined via a define_outcome event.
Evaluation state for a single outcome defined via a define_outcome event.
completed_at: Optional[datetime]When the outcome reached a terminal result. Null while pending/running/evaluating.
When the outcome reached a terminal result. Null while pending/running/evaluating.
What the agent should produce.
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: int0-indexed revision cycle the outcome is currently on.
0-indexed revision cycle the outcome is currently on.
Server-generated outc_ ID for this outcome.
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.
class BetaManagedAgentsServerToolUsage: web_fetch_requests; web_search_requestsCumulative count of server-executed tool invocations, broken down by tool.
Cumulative count of server-executed tool invocations, broken down by tool.
web_fetch_requests: Optional[int]Number of server-executed web fetch requests.
Number of server-executed web fetch requests.
web_search_requests: Optional[int]Number of server-executed web search requests.
Number of server-executed web search requests.
class BetaManagedAgentsSession: type: "session"; id; agent; ... # 14 moreA Managed Agents session.
A Managed Agents session.
class BetaManagedAgentsSessionAgent: type: "agent"; id; description; ... # 8 moreResolved agent definition for a session. Snapshot of the agent at session creation time.
Resolved agent definition for a session. Snapshot of the agent at session creation time.
class BetaManagedAgentsSessionAgentUpdate: mcp_servers; toolsMid-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.
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 BetaManagedAgentsSessionMultiagent = ...Resolved multiagent orchestration configuration as returned on a session.
Resolved multiagent orchestration configuration as returned on a session.
class BetaManagedAgentsSessionMultiagentCoordinator: type: "coordinator"; agentsResolved coordinator topology with full agent definitions for each roster member.
Resolved coordinator topology with full agent definitions for each roster member.
agents: List[Agent]Full agent definitions the coordinator may spawn as session threads.
Full agent definitions the coordinator may spawn as session threads.
class BetaManagedAgentsSessionThreadAgent: type: "agent"; id; description; ... # 7 moreResolved 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.
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.
class BetaManagedAgentsAdvisor: type: "advisor"; modelPlatform advisor roster entry: a model the session's primary thread may consult mid-turn.
Platform advisor roster entry: a model the session's primary thread may consult mid-turn.
The advisor model id.
type BetaManagedAgentsSessionMultiagentSubagents = ...Whether the agent can spawn session threads.
Whether the agent can spawn session threads.
class BetaManagedAgentsSessionMultiagentSubagentsEnabled: type: "enabled"; inline_agents; predefined_agentsThe agent can spawn session threads.
The agent can spawn session threads.
class BetaManagedAgentsMultiagentSubagentsDisabled: type: "disabled"The agent cannot spawn session threads.
The agent cannot spawn session threads.
class BetaManagedAgentsSessionMultiagentSubagentsEnabled: type: "enabled"; inline_agents; predefined_agentsThe agent can spawn session threads.
The agent can spawn session threads.
type BetaManagedAgentsSessionMultiagentWorkflows = ...Whether the agent can start workflow runs.
Whether the agent can start workflow runs.
class BetaManagedAgentsSessionMultiagentWorkflowsEnabled: type: "enabled"; inline_agents; predefined_agentsThe agent can start workflow runs.
The agent can start workflow runs.
class BetaManagedAgentsMultiagentWorkflowsDisabled: type: "disabled"The agent cannot start workflow runs.
The agent cannot start workflow runs.
class BetaManagedAgentsSessionMultiagentWorkflowsEnabled: type: "enabled"; inline_agents; predefined_agentsThe agent can start workflow runs.
The agent can start workflow runs.
class BetaManagedAgentsSessionMultiagent20261001: type: "multiagent_20261001"; advisor; subagents; workflowsResolved multiagent configuration with three members, as copied to the session at creation.
Resolved multiagent configuration with three members, as copied to the session at creation.
class BetaManagedAgentsSessionStats: active_seconds; duration_secondsTiming statistics for a session.
Timing statistics for a session.
active_seconds: Optional[float]Cumulative time in seconds the session spent in running status. Excludes idle time.
Cumulative time in seconds the session spent in running status. Excludes idle time.
duration_seconds: Optional[float]Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update.
Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update.
class BetaManagedAgentsSessionUpdatedEvent: type: "session.updated"; id; processed_at; ... # 4 moreEmitted 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.
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.
class BetaManagedAgentsSessionUsage: active_seconds; cache_creation; cache_read_input_tokens; ... # 4 moreCumulative token usage for a session across all turns.
Cumulative token usage for a session across all turns.
class BetaManagedAgentsSessionUsageEvent: type: "session.usage"; id; processed_at; ... # 2 morePeriodic snapshot of the session's cumulative usage and tracked list cost.
Periodic snapshot of the session's cumulative usage and tracked list cost.
class BetaManagedAgentsStartEvent: type: "event_start"; eventOpens 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.
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.
type BetaManagedAgentsStartEventPreview = ...
class BetaManagedAgentsAgentMessagePreview: type: "agent.message"; id
The id the buffered agent.message will carry if it is emitted. Matches the event_id on this preview's event_delta events.
class BetaManagedAgentsAgentThinkingPreview: type: "agent.thinking"; id
The id the buffered agent.thinking will carry if it is emitted. Start-only — no event_delta events follow.
class BetaManagedAgentsSystemContentBlock: type: "text"; textContent block in a mid-conversation system message. Text-only.
Content block in a mid-conversation system message. Text-only.
text: strThe text content.
The text content.
class BetaManagedAgentsSystemMessageEvent: type: "system.message"; id; content; processed_atA mid-conversation system message event. Carries system-role content that is appended to the session as a role: "system" turn.
A mid-conversation system message event. Carries system-role content that is appended to the session as a role: "system" turn.
Unique identifier for this event.
content: List[BetaManagedAgentsSystemContentBlock]System content blocks. Text-only.
System content blocks. Text-only.
text: strThe text content.
The text content.
processed_at: Optional[datetime]Timestamp when this system message was processed.
Timestamp when this system message was processed.
class BetaManagedAgentsUserToolResultEvent: type: "user.tool_result"; id; tool_use_id; ... # 4 moreEvent 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.
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.