Skip to content

ClaudeAgentSDKPlugin should not drop Agent tool spans in auto-instrumented mode #1657

@AbhiPrasad

Description

Summary

The auto-instrumentation plugin skips Agent tool spans entirely, even though the upstream SDK documents Agent as the canonical subagent tool name and Task as the previous alias. Manual wrapClaudeAgentSDK mode only skips Task, while the plugin skips both Agent and Task, so auto-instrumented traces lose the parent tool span that should sit above delegated task spans.

What instrumentation is missing

  • js/src/instrumentation/plugins/claude-agent-sdk-plugin.ts treats both Agent and Task as ignorable subagent tool names in PreToolUse.
  • That means auto-instrumentation omits the Agent tool execution span even when the SDK emits the current canonical tool name.
  • Python's Claude Agent SDK integration starts tool spans from streamed tool-use blocks and keeps delegated task spans parented under the corresponding agent tool span when available.

Why this is a concrete gap

The upstream TypeScript docs call out Agent as the current name for this tool surface. Braintrust docs say the integration traces tool executions. In auto mode, the JS plugin drops this official tool execution entirely.

Braintrust docs status

supported

Exact upstream sources

Exact Braintrust docs sources

Exact local repo files inspected

  • js/src/instrumentation/plugins/claude-agent-sdk-plugin.ts
  • js/src/wrappers/claude-agent-sdk/claude-agent-sdk.ts
  • js/src/wrappers/claude-agent-sdk/claude-agent-sdk.test.ts
  • /Users/abhijeetprasad/workspace/braintrust-sdk-python/py/src/braintrust/wrappers/claude_agent_sdk/_wrapper.py
  • /Users/abhijeetprasad/workspace/braintrust-sdk-python/py/src/braintrust/wrappers/claude_agent_sdk/test_wrapper.py

Metadata

Metadata

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions