[BUG] LiteLLMModel - SageMaker Endpoints with TGI implementation do not emit tool_call as stop reason, breaking the agentic loop
Checks
- [x] I have updated to the lastest minor and patch version of Strands
- [x] I have checked the documentation and this is not expected behavior
- [x] I have searched ./issues and there are no duplicates of my issue
Strands Version
0.2.0
Python Version
3.12.10
Operating System
Amazon Linux 2
Installation Method
pip
Steps to Reproduce
- Install Strands
- Deploy a SageMaker endpoint using TGI (I'm using Gemma 3)
- create a
LiteLLMModelobject pointing to the endpoint - Attach any tool, e.g.
calculatorfromstrands_tools - See it fail to call the tool (Timeout)
Expected Behavior
Expected behaviour is to actually call the tool successfully.
Actual Behavior
The agentic loop either stops with stop_reason == "end_turn" or times out as it keeps on waiting for the stop_reason tool call, which TGI containers with streaming output do not emit.
Additional Context
Possible Solution
Check for stop_reason == "tool_call" OR len(tool_calls) > 0. This makes it much more generic and error resistant.
Related Issues
#271
More details:
hi @dgallitelli thank your reaching out, is the the lack of stop_reason == 'tool_call SageMaker TGI endpoint-specific? Or is there planned support for this in the future? Given that this seems to be a divergence from the standard model specifications, we'd be hesitant to put a stop gap solution into Strands for one-off use cases, so it'd help to have more context on this.
Hey @jer96 , I ended up doing more testing and figured out it was a model-specific issue.
Il giorno mar 8 lug 2025 alle 21:08 Jeremiah @.***> ha scritto:
jer96 left a comment (strands-agents/sdk-python#354) https://github.com/strands-agents/sdk-python/issues/354#issuecomment-3050024811
hi @dgallitelli https://github.com/dgallitelli thank your reaching out, is the the lack of stop_reason == 'tool_call SageMaker TGI endpoint-specific? Or is there planned support for this in the future? Given that this seems to be a divergence from the standard model specifications, we'd be hesitant to put a stop gap solution into Strands for one-off use cases, so it'd help to have more context on this.
— Reply to this email directly, view it on GitHub https://github.com/strands-agents/sdk-python/issues/354#issuecomment-3050024811, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACLMPMVFCE46JY3TGMYY7R33HQJMHAVCNFSM6AAAAACAZI735CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTANJQGAZDIOBRGE . You are receiving this because you were mentioned.Message ID: @.***>