[bot] Anthropic Claude Managed Agents (CMA) session execution not instrumented
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 48/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- ruby
调研方向
首先阅读 lib/braintrust/contrib/anthropic/patcher.rb、integration.rb 和 instrumentation/beta_messages.rb,以遵循现有的防御式 instrumentation 模式。跟踪 client.beta.sessions.events.stream_events 和 send_,将其作为实现入口点。完成的标准是:两个 CMA 会话事件方法都使用所请求的输入、输出、metadata 和可用 metrics 完成 instrumentation,同时不破坏 beta API 兼容性。
由索引模型根据 Issue 内容生成。
描述
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, 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
- 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
- Anthropic CMA quickstart with Ruby examples: https://platform.claude.com/docs/en/managed-agents/quickstart
- Anthropic CMA overview: https://platform.claude.com/docs/en/managed-agents/overview
- Anthropic Ruby SDK releases: https://github.com/anthropics/anthropic-sdk-ruby/releases — CMA support added in v1.31.0 (April 8, 2026), CMA Memory added in v1.36.0 (April 23, 2026)
- Ruby API surface:
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 files- Grep for
session,agent,cma,managedacrosslib/braintrust/returns zero matches related to CMA
- 主要语言
- Ruby
- 星标
- 9
- 派生
- 11
- 平均合并
- 2 天 3 小时
- 30 天内合并 PR
- 5
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
braintrustdata/braintrust-sdk-ruby 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
-
难度 2/5 1-3 小时 新手友好度 76/100
-
难度 2/5 1-3 小时 新手友好度 72/100
-
ruby
难度 3/5 半天 新手友好度 62/100
-
ruby
难度 3/5 1-2 天 新手友好度 45/100
查看 braintrustdata/braintrust-sdk-ruby 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 80/100
维护者通常 2 天内回复
-
难度 1/5 1 小时以内 新手友好度 82/100
matteocrippa/awesome-swift#2028 ·
维护者通常 3 天内回复
-
Release workflow: a build provenance attestation for the gem with `actions/attest-build-provenance`未关闭area: devops area: security lane: strong-agent roadmap size: S type: task
难度 2/5 1-3 小时 新手友好度 75/100
arminazimi/slipway#712 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
fractaledmind/litestream-ruby#89 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 1/5 1-3 小时 新手友好度 78/100
resque/resque-scheduler#848 ·
维护者通常 1 天内回复