Skip to content

feat(server-utils): Emit execute_tool spans for Anthropic's beta.sessions.events.toolRunner() #25446

Open

Description

@RulaKhaled

#25320 instruments beta.messages.toolRunner(), but the Managed Agents session runner, client.beta.sessions.events.toolRunner(sessionID, { tools }), runs tools too, and its tool calls get no spans. It runs each tool through runRunnableTool, which calls tool.run(input, { toolUse, toolUseBlock, signal }) and turns any throw into an error result, so a failing tool is also invisible to the app. A tool only gets a span today if the same object was also passed to beta.messages.toolRunner().

The contract is the same run(input, ctx) the messages runner uses, so the wrapping from #25320 should carry over. The new part is hooking sessions.events.toolRunner() on both the orchestrion and instrumentAnthropicAiClient paths, and checking whether tools added to a running session reach run without going through its options.

Follow-up to #25288 and #25320.

Activity

  1. self-assigned this
    on Oct 16, 2026
  2. linear-code commented on Oct 16, 2026

    @linear-code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions