⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Conversation

@pgrayy
Copy link
Member

@pgrayy pgrayy commented Jan 28, 2026

Description

In the PrintCallbackHandler, we only report a tool if a ToolUseStreamEvent is emitted. This however is only emitted if the model streams tool input deltas. Consequently, if a tool does not have inputs, the model won't produce deltas and thus won't be printed to console. Consider the following example:

from strands import Agent, tool
from strands.models import BedrockModel

@tool
def get_user_info() -> dict:
    """Get user information."""
    return {"name": "Alice", "card": "LIB-456789"}

@tool
def get_book_status(book_id: str) -> dict:
    """Get book status."""
    return {"book_id": book_id, "status": "ACTIVE"}

agent = Agent(
    model=BedrockModel(model_id="qwen.qwen3-next-80b-a3b"),
    tools=[get_user_info, get_book_status],
    system_prompt="You are a helpful assistant."
)

result = agent("Please provide user info and check the status of book BOOK-123")

The result right now is:

Tool #1: get_book_status
User Information:
- Name: Alice
- Card: LIB-456789

Book Status:
- Book ID: BOOK-123
- Status: ACTIVE

With changes in this PR, the output is:

Tool #1: get_user_info


Tool #2: get_book_status
User Information:
- Name: Alice
- Card: LIB-456789

Book Status:
- Book ID: BOOK-123
- Status: ACTIVE

Related Issues

#1551

Documentation PR

N/A

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

  • I ran hatch run prepare: Updated unit tests

Checklist

  • I have read the CONTRIBUTING document
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • My changes generate no new warnings
  • 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.

@codecov
Copy link

codecov bot commented Jan 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@pgrayy pgrayy force-pushed the fix-tooluse-callback branch from 178bbda to 9c7496b Compare January 28, 2026 00:33
@github-actions github-actions bot removed the size/m label Jan 28, 2026
@pgrayy pgrayy marked this pull request as ready for review January 28, 2026 00:33
@pgrayy pgrayy merged commit e8fc991 into strands-agents:main Jan 28, 2026
20 of 39 checks passed
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.

3 participants