1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
//! Anthropic Managed Agents API client.
//!
//! This module provides a typed Rust client for the [Anthropic Managed Agents API][api],
//! a server-side agent runtime where Anthropic manages the agent loop, sandbox, and
//! tool execution. Sessions are long-running and stateful, communicating via
//! SSE-based event streaming.
//!
//! # Direct-Client Surface
//!
//! This is a **direct-client surface** — it is deliberately **not** wired into the
//! `adk-runner` `Agent` trait. Managed Agents sessions are long-running (minutes
//! to hours), stateful, and SSE-driven, which does not fit the synchronous per-turn
//! `generate_content` tool-loop contract that the runner expects. Use
//! [`ManagedAgentsClient`] directly instead of going through the runner.
//!
//! # API Version and Beta Header
//!
//! All requests include the following headers:
//! - `anthropic-version: 2023-06-01` — the Anthropic API version
//! - `anthropic-beta: managed-agents-2026-04-01` — the beta feature flag for managed agents
//!
//! The base URL targets `https://api.anthropic.com/v1/beta/` endpoints.
//!
//! # Capabilities
//!
//! - **Agent CRUD**: Create, list, get, and delete managed agent configurations
//! - **Environment CRUD**: Create, get, and delete sandbox environments (cloud or self-hosted)
//! - **Session CRUD**: Create, get, list, archive, and delete sessions
//! - **Event dispatch**: Send user events (messages, interrupts, tool results, confirmations, outcomes)
//! - **SSE streaming**: Receive real-time agent events (messages, tool use, status changes)
//! - **Custom tool flow**: Handle agent tool requests and return results
//! - **Tool confirmation**: Approve or deny built-in tool executions
//! - **Multiagent orchestration**: Configure agents that reference other agents as tools
//!
//! # Example
//!
//! ```rust,ignore
//! use adk_anthropic::managed_agents::{
//! ManagedAgentsClient, CreateAgentParams, CreateEnvironmentParams,
//! CreateAgentParams, CreateEnvironmentParams, CreateSessionParams,
//! ManagedAgentsClient, SessionEvent, ToolConfig, UserEvent,
//! };
//! use futures::StreamExt;
//!
//! // Create a client from an API key
//! let client = ManagedAgentsClient::new("sk-ant-api03-...")?;
//!
//! // Create an agent
//! let agent = client.create_agent(CreateAgentParams {
//! name: "My Agent".to_string(),
//! model: serde_json::json!("claude-sonnet-4-6"),
//! system: Some("You are a helpful assistant.".to_string()),
//! description: None,
//! tools: vec![ToolConfig::agent_toolset()],
//! mcp_servers: vec![],
//! skills: vec![],
//! metadata: None,
//! }).await?;
//!
//! // Create an environment
//! let env = client.create_environment(
//! CreateEnvironmentParams::cloud("my-env")
//! ).await?;
//!
//! // Create a session
//! let session = client.create_session(
//! CreateSessionParams::new(&agent.id, &env.id)
//! ).await?;
//!
//! // Open stream first, then send message
//! let mut stream = client.stream_events(&session.id).await?;
//! client.send_event(&session.id, UserEvent::message("Hello!")).await?;
//!
//! while let Some(event) = stream.next().await {
//! match event? {
//! SessionEvent::AgentMessage { .. } => println!("Got agent message"),
//! SessionEvent::StatusIdle { .. } => break,
//! _ => {}
//! }
//! }
//! ```
//!
//! [api]: https://docs.anthropic.com/en/docs/agents-and-tools/managed-agents
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;