Skip to content

Prototype Claude Agent SDK instrumentation port from OpenInference (WIP)#1

Closed
eternalcuriouslearner wants to merge 4 commits into
mainfrom
claude/port-claude-agent-ask-7g9dru
Closed

Prototype Claude Agent SDK instrumentation port from OpenInference (WIP)#1
eternalcuriouslearner wants to merge 4 commits into
mainfrom
claude/port-claude-agent-ask-7g9dru

Conversation

@eternalcuriouslearner

Copy link
Copy Markdown
Owner

Feasibility prototype for porting openinference-instrumentation-claude-agent-sdk
(open-telemetry#141) onto opentelemetry-util-genai:
query()/ClaudeSDKClient wrappers emitting invoke_agent, execute_tool, and
subagent spans. Tests, conformance scenarios, and workspace wiring not yet
migrated.

Assisted-by: Claude Fable 5

Co-Authored-By: Claude Fable 5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01WLfGqEqWqFafZ9e8a7AWdQ

claude added 4 commits July 14, 2026 03:18
Feasibility prototype for porting openinference-instrumentation-claude-agent-sdk
(open-telemetry#141) onto opentelemetry-util-genai:
query()/ClaudeSDKClient wrappers emitting invoke_agent, execute_tool, and
subagent spans. Tests, conformance scenarios, and workspace wiring not yet
migrated.

Assisted-by: Claude Fable 5

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WLfGqEqWqFafZ9e8a7AWdQ
Drop tool and subagent span tracking (and with it all hook injection and
options mutation): query() and each ClaudeSDKClient.receive_response() turn
now emit a single invoke_agent span with input/output messages, token
usage, model, and session id. execute_tool and subagent invoke_agent spans
are deferred to a follow-up.

Assisted-by: Claude Fable 5

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WLfGqEqWqFafZ9e8a7AWdQ
Three scenarios (plain run, tool-calling content, reasoning content via
ClaudeSDKClient) validated with weaver live-check, replaying real CLI
sessions recorded in the donation-openinference repository through the
SDK's public Transport interface (the SDK talks to a CLI subprocess, not
HTTP, so no VCR). Wires the py314 conformance tox env and fixes the
dependency-floor assertion for the claude-agent-sdk >= 0.1.45 bump.

Assisted-by: Claude Fable 5

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WLfGqEqWqFafZ9e8a7AWdQ
Derive the full agent hierarchy from the SDK's streamed messages, in the
consumer task: tool_use/tool_result blocks become execute_tool spans
(arguments/results gated on content capture, tool failures and abandoned
tools recorded as errors) and subagent traffic keyed by parent_tool_use_id
becomes nested invoke_agent spans named from the spawning tool's
subagent_type. Parenting relies on util-genai's context stack mirroring
the stream's nesting; parallel tool calls in one turn can mis-parent
siblings (documented; explicit parenting in util-genai would lift this).

Coexists with the Claude Code CLI's native beta claude_code.* traces: the
SDK propagates trace context into the CLI subprocess, so native spans join
the same trace under the invoke_agent span; documented in the README.

Adds cassette-based integration tests, fake-stream error-path unit tests,
model-extraction regression tests, and a multi_agent conformance scenario
replaying the recorded subagent session.

Assisted-by: Claude Fable 5

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WLfGqEqWqFafZ9e8a7AWdQ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants