Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[bot] Anthropic Claude Managed Agents (CMA) session execution not instrumented

未关闭
#156 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 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, 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
主要语言
Ruby
星标
9
派生
11
平均合并
2 天 3 小时
30 天内合并 PR
5

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

braintrustdata/braintrust-sdk-ruby 的其他 Issue

查看 braintrustdata/braintrust-sdk-ruby 的全部 Issue

相似的 Issue

更多 Ruby Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。