feat(weave): trace Claude Agent SDK subagents - #7666
Merged
rgao-coreweave merged 4 commits intoAug 5, 2026
Conversation
Contributor
Author
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
This was referenced Jul 29, 2026
rgao-coreweave
force-pushed
the
rgao/claude-agent-sdk-python-subagent-tracing
branch
from
July 30, 2026 03:33
421cd52 to
c80f42c
Compare
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
HiveMind Sessions9 sessions · 34s · $0.13
View all sessions in HiveMind → Run |
ro31337
reviewed
Jul 30, 2026
rgao-coreweave
force-pushed
the
rgao/claude-agent-sdk-python-subagent-tracing
branch
from
July 31, 2026 18:51
23b51b9 to
79d2ff0
Compare
rgao-coreweave
force-pushed
the
rgao/claude-agent-sdk-python-subagent-tracing
branch
from
July 31, 2026 23:01
79d2ff0 to
4f17c21
Compare
rgao-coreweave
force-pushed
the
rgao/claude-agent-sdk-python-subagent-tracing
branch
from
July 31, 2026 23:48
4f17c21 to
d03a57b
Compare
rgao-coreweave
changed the base branch from
rgao/claude-agent-sdk-python-multi-turn
to
master
August 3, 2026 16:50
Parallel Agent/Task delegations close in completion order, not launch order. SubAgent.__enter__ attached the span to the ambient OTel context and end() detaches through ContextVar.reset, which assumes LIFO: closing A before B left the context pointing at ended span A, so user code running between streamed messages nested under a dead span. Add SubAgent.start(set_current=False), which starts the span without pushing it onto the ambient stack, and use it from the Claude Agent SDK integration. Children nest either way, because start_llm / start_tool / start_subagent thread an explicit parent context. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
rgao-coreweave
force-pushed
the
rgao/claude-agent-sdk-python-subagent-tracing
branch
from
August 3, 2026 19:50
d03a57b to
7c2d3b9
Compare
ro31337
reviewed
Aug 4, 2026
ro31337
self-requested a review
August 4, 2026 23:19
ro31337
approved these changes
Aug 4, 2026
rgao-coreweave
deleted the
rgao/claude-agent-sdk-python-subagent-tracing
branch
August 5, 2026 20:32
Contributor
Author
Merging in, thanks for the review! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Agentand legacyTaskcalls as nested Python GenAISubAgentspans.parent_tool_use_idancestry.Stack
This PR is directly based on
master. #7665 is intentionally stacked on this branch.Before and after
The same 24-span cassette replay was run on
masterand this PR.mission_controllaunchesresearcher,analyst, andreviewerconcurrently;reviewerlaunches a nestedfact_checker. Together they runWebSearch,WebFetch,Bash,Python,Read, andChecklisttools before the root agent synthesizes the result.In each link, select the Trace tree button (the branch icon) above the trace panel. The default flamegraph groups overlapping siblings, which can obscure the parent hierarchy.
invoke_agentspansmaster(fc63e44005)mission_control; delegate calls appear as ordinaryAgent/Tasktools.7c2d3b987d)mission_control → reviewer → fact_checker → Read.The resulting topology is:
The parallel-subagent regression covers delegates closing in completion order rather than launch-stack order. The integration starts them with
SubAgent.start(set_current=False): explicitly threaded child spans retain the hierarchy above, while unrelated application work remains under the root turn.Testing
masterand the subagent-only head; queried span counts, parent IDs, and maximum depths match the table above.SubAgentsuite: 46 passed on Python 3.11.Breaking changes
None.