Skip to content

Fix has_tool_use tracking in streaming to also check contentBlockDelta for tool use events#1811

Open
Donyme wants to merge 1 commit intostrands-agents:mainfrom
Donyme:main
Open

Fix has_tool_use tracking in streaming to also check contentBlockDelta for tool use events#1811
Donyme wants to merge 1 commit intostrands-agents:mainfrom
Donyme:main

Conversation

@Donyme
Copy link

@Donyme Donyme commented Mar 5, 2026

Description

Adding redundant tracking via contentBlockDelta as a fallback:

Track if we see tool use events - check both start and delta

if "contentBlockStart" in chunk and chunk["contentBlockStart"].get("start", {}).get("toolUse"):
has_tool_use = True
if "contentBlockDelta" in chunk and chunk["contentBlockDelta"].get("delta", {}).get("toolUse"):
has_tool_use = True]
Please check bug for more issue details.

Related Issues

#1810

Documentation PR

Type of Change

Bug fix

Testing

How have you tested the change? Verify that the changes do not break functionality or introduce warnings in consuming repositories: agents-docs, agents-tools, agents-cli

Yes, all tests passed.
========================= 2102 passed, 4 skipped, 33 warnings in 71.65s (0:01:11) =========

  • [y ] I ran hatch run prepare

Checklist

  • [y] I have read the CONTRIBUTING document
  • [y] I have added any necessary tests that prove my fix is effective or my feature works
  • [y] I have updated the documentation accordingly
  • [y ] I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • [y] My changes generate no new warnings
  • [y] Any dependent changes have been merged and published

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant