[bot] Anthropic tool_runner agentic loop not instrumented
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 58/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- ruby
- Lĩnh vực
- observability
Hướng nghiên cứu
Bắt đầu với lib/braintrust/contrib/anthropic/patcher.rb và instrumentation/beta_messages.rb, sau đó kiểm tra các phương thức tool_runner của Anthropic SDK được nêu trong issue. So sánh mẫu tool span lồng nhau trong lib/braintrust/contrib/ruby_llm/instrumentation/chat.rb. Được xem là hoàn tất khi runner có một trace tổng thể, mỗi BaseTool#call có một tool span con và tất cả các chế độ thực thi được liệt kê đều được bao phủ.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
The Anthropic Ruby SDK provides client.beta.messages.tool_runner(...), a beta agentic loop API that automatically executes tools and manages the multi-turn conversation cycle. This surface is not instrumented. The SDK currently instruments beta.messages.create() and beta.messages.stream() (via BetaMessagesPatcher), so individual LLM calls within the runner may produce spans, but the tool executions and overall agentic run are invisible in traces.
What is missing
The tool_runner API (Anthropic::Resources::Beta::Messages#tool_runner) returns a runner object with these execution methods:
each_message { |msg| ... }— iterates through the agentic loop, auto-executing tools viaBaseTool#callbetween iterationsrun_until_finished— runs the full loop and returns all messagesnext_message— step-by-step manual iterationeach_streaming { |event| ... }— streaming variant of the agentic loop
At each iteration, the runner:
- Sends a message to Claude (this call IS traced via existing
BetaMessagesPatcher) - Detects tool_use blocks in Claude's response
- Executes
BaseTool#callon the matching tool (NOT traced) - Sends tool results back and loops
What instrumentation should capture
Parent span for the agentic run (e.g., anthropic.tool_runner):
- Input: initial messages and tool definitions
- Output: final response after all tool loops complete
- Metrics: aggregate token usage across all iterations, total duration
Child spans for each tool execution (e.g., anthropic.tool.{tool_name}):
- Input: tool name + arguments (from Claude's tool_use block)
- Output: tool result (from
BaseTool#callreturn value) - Span attributes:
{type: "tool"}
This pattern is already established in this repo — the RubyLLM integration creates ruby_llm.tool.{tool_name} child spans with braintrust.span_attributes: {type: "tool"} for each tool execution in lib/braintrust/contrib/ruby_llm/instrumentation/chat.rb.
Braintrust docs status
- Braintrust documents "tool" as a first-class span type: "A tool call made by the model — an external API, code execution, database query, etc." (tracing guide)
- Ruby-specific tool_runner instrumentation: not_found
Upstream sources
- Anthropic tool_runner documentation: https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-runner
- Anthropic Ruby SDK helpers: https://github.com/anthropics/anthropic-sdk-ruby/blob/main/helpers.md#3-auto-looping-tool-runner-beta
- Anthropic Ruby SDK on RubyGems: https://rubygems.org/gems/anthropic
Local repo files inspected
lib/braintrust/contrib/anthropic/patcher.rb— definesMessagesPatcherandBetaMessagesPatcher; no tool_runner patcherlib/braintrust/contrib/anthropic/instrumentation/beta_messages.rb— wrapscreate()andstream()only; notool_runnerwrapper- Grep for
tool_runner,BaseTool,each_message,run_until_finishedacrosslib/— zero matches lib/braintrust/contrib/ruby_llm/instrumentation/chat.rb— demonstrates the existing pattern for tool execution tracing with nested spans
- Ngôn ngữ chính
- Ruby
- Star
- 9
- Fork
- 11
- Merge trung bình
- 3 ngày 43 phút
- Pull request đã merge (30 ngày)
- 9
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của braintrustdata/braintrust-sdk-ruby
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
braintrustdata/braintrust-sdk-ruby#155 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BOT ISSUE] OpenAI Chat Completions missing reasoning model and web search metadata parametersĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
braintrustdata/braintrust-sdk-ruby#143 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
braintrustdata/braintrust-sdk-ruby#137 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
ruby
Độ khó 3/5 Nửa ngày Mức phù hợp với người mới 62/100
braintrustdata/braintrust-sdk-ruby#229 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
ruby
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
braintrustdata/braintrust-sdk-ruby#228 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của braintrustdata/braintrust-sdk-ruby
Issue tương tự
-
Falha nos links do postĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
temporalio/sdk-ruby#625 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 94/100
zerocracy/judges-action#2803 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
empty tone.rbĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
-
rounding inaccuracies in ordered_quantities_different_from_group_orders?Có thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 92/100