Summary
The Anthropic Ruby SDK (v1.31.0+) supports Claude Managed Agents (CMA) — a first-party agentic execution surface where users send messages to agent sessions and stream back generative output including tool use, text, and status events. The key execution methods (client.beta.sessions.events.stream_events and client.beta.sessions.events.send_) are completely uninstrumented by this SDK.
CMA is an agentic run/tracing surface: a user sends a prompt, and the agent autonomously generates text, invokes tools (bash, file I/O, web search), and streams results back. This is functionally similar to multi-turn chat completions with tool calling, but runs inside Anthropic-managed containers.
What is missing
Generative execution surfaces (not CRUD)
-
client.beta.sessions.events.stream_events(session_id) — Opens an SSE stream that yields agent execution events: agent.message (text generation), agent.tool_use (tool invocations), agent.tool_result, and session.status_idle (completion). This is the primary consumption surface for agent output.
-
client.beta.sessions.events.send_(session_id, events:) — Sends user messages that trigger agent generation. Each send_ call initiates a new turn of agentic execution.
What a span should capture
- Input: the user message content sent via
send_
- Output: aggregated agent messages and tool use events from the stream
- Metadata: agent ID, session ID, environment ID, model, tools, provider (
anthropic), endpoint (/v1/sessions/{id}/events), api_version: "beta"
- Metrics: token usage (if available in stream metadata events), time_to_first_token, tool execution count
Pattern precedent
This SDK already instruments the Anthropic beta messages API (client.beta.messages) with defensive error handling for beta API changes (see lib/braintrust/contrib/anthropic/instrumentation/beta_messages.rb). A similar approach would work for CMA session events.
Braintrust docs status
not_found — Braintrust's Anthropic integration docs at https://www.braintrust.dev/docs/integrations/ai-providers/anthropic document messages API tracing only. No mention of Claude Managed Agents, sessions, or agentic execution instrumentation.
Upstream sources
Local repo files inspected
lib/braintrust/contrib/anthropic/patcher.rb — defines MessagesPatcher and BetaMessagesPatcher only; no session/agent patchers
lib/braintrust/contrib/anthropic/integration.rb — registers [MessagesPatcher, BetaMessagesPatcher]; no CMA patchers
lib/braintrust/contrib/anthropic/instrumentation/ — contains messages.rb, beta_messages.rb, common.rb; no session or agent files
- Grep for
session, agent, cma, managed across lib/braintrust/ returns zero matches related to CMA
Summary
The Anthropic Ruby SDK (v1.31.0+) supports Claude Managed Agents (CMA) — a first-party agentic execution surface where users send messages to agent sessions and stream back generative output including tool use, text, and status events. The key execution methods (
client.beta.sessions.events.stream_eventsandclient.beta.sessions.events.send_) are completely uninstrumented by this SDK.CMA is an agentic run/tracing surface: a user sends a prompt, and the agent autonomously generates text, invokes tools (bash, file I/O, web search), and streams results back. This is functionally similar to multi-turn chat completions with tool calling, but runs inside Anthropic-managed containers.
What is missing
Generative execution surfaces (not CRUD)
client.beta.sessions.events.stream_events(session_id)— Opens an SSE stream that yields agent execution events:agent.message(text generation),agent.tool_use(tool invocations),agent.tool_result, andsession.status_idle(completion). This is the primary consumption surface for agent output.client.beta.sessions.events.send_(session_id, events:)— Sends user messages that trigger agent generation. Eachsend_call initiates a new turn of agentic execution.What a span should capture
send_anthropic), endpoint (/v1/sessions/{id}/events),api_version: "beta"Pattern precedent
This SDK already instruments the Anthropic beta messages API (
client.beta.messages) with defensive error handling for beta API changes (seelib/braintrust/contrib/anthropic/instrumentation/beta_messages.rb). A similar approach would work for CMA session events.Braintrust docs status
not_found— Braintrust's Anthropic integration docs at https://www.braintrust.dev/docs/integrations/ai-providers/anthropic document messages API tracing only. No mention of Claude Managed Agents, sessions, or agentic execution instrumentation.Upstream sources
client.beta.sessions.events.stream_events(session_id)andclient.beta.sessions.events.send_(session_id, events:)Local repo files inspected
lib/braintrust/contrib/anthropic/patcher.rb— definesMessagesPatcherandBetaMessagesPatcheronly; no session/agent patcherslib/braintrust/contrib/anthropic/integration.rb— registers[MessagesPatcher, BetaMessagesPatcher]; no CMA patcherslib/braintrust/contrib/anthropic/instrumentation/— containsmessages.rb,beta_messages.rb,common.rb; no session or agent filessession,agent,cma,managedacrosslib/braintrust/returns zero matches related to CMA