fix(weave): trace Claude Agent SDK async-iterable queries per turn - #7665
Draft
rgao-coreweave wants to merge 1 commit into
Draft
fix(weave): trace Claude Agent SDK async-iterable queries per turn#7665rgao-coreweave wants to merge 1 commit into
rgao-coreweave wants to merge 1 commit into
Conversation
Contributor
Author
This was referenced Jul 29, 2026
Base automatically changed from
rgao/claude-agent-sdk-python-weave-genai
to
master
July 29, 2026 22:18
rgao-coreweave
force-pushed
the
rgao/claude-agent-sdk-python-multi-turn
branch
from
July 30, 2026 03:27
ce65f6a to
041645e
Compare
HiveMind Sessions1 session · 11m · $6.15
View all sessions in HiveMind → Run |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
rgao-coreweave
marked this pull request as ready for review
July 30, 2026 05:33
rgao-coreweave
force-pushed
the
rgao/claude-agent-sdk-python-multi-turn
branch
from
July 31, 2026 18:50
041645e to
9fef0da
Compare
rgao-coreweave
marked this pull request as draft
July 31, 2026 22:43
rgao-coreweave
force-pushed
the
rgao/claude-agent-sdk-python-multi-turn
branch
from
July 31, 2026 23:00
9fef0da to
5e11bc2
Compare
rgao-coreweave
force-pushed
the
rgao/claude-agent-sdk-python-multi-turn
branch
from
July 31, 2026 23:45
5e11bc2 to
3548601
Compare
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

Problem
The Claude Agent SDK accepts either a string or an
AsyncIterableas the prompt toquery(). An async-iterable prompt can submit multiple inputs and produce a separateResultMessagefor each one.The OTel integration previously treated the entire output iterator as one turn. On current
master, a replay containing two submitted prompts and two results produces only oneinvoke_agentspan, collapsing both interactions together.Approach
Keep the ordinary one-result APIs simple and isolate multi-result coordination to the only path that needs it:
query(prompt=str)ResultMessagequery(prompt=AsyncIterable)ResultMessageClaudeSDKClient.receive_response()ResultMessageBoth paths share message processing and turn finalization. The async-iterable path additionally:
shouldQuery: falseinto the next query-triggering input.String prompts and the public
ClaudeSDKClient.receive_response()contract remain on the straightforward single-turn implementation.Example
Two-turn async-iterable query in Weave records
remembered.andCERULEAN-42as two turns in one conversation.Testing
shouldQuery: falseClaudeSDKClientwith string or async-iterable inputreceive_response()Breaking changes
None.