Skip to content

fix(litellm): generate toolUseId when missing from provider#2949

Merged
chaynabors merged 1 commit into
strands-agents:mainfrom
chaynabors:agent-tasks/1259-litellm-tool-id
Jun 25, 2026
Merged

fix(litellm): generate toolUseId when missing from provider#2949
chaynabors merged 1 commit into
strands-agents:mainfrom
chaynabors:agent-tasks/1259-litellm-tool-id

Conversation

@chaynabors

Copy link
Copy Markdown
Member

Supersedes #1262 with a clean rebase on current main.

LiteLLM returns null for the tool call id field on some providers, leaving toolUseId as None in the resulting event stream. The fix assigns a fresh call_ when the first tool delta arrives without an id, before the content_start chunk, so downstream consumers see a stable identifier. Behavior is unchanged whenever a provider supplies an id.

Refs #1262, fixes #1259.

@github-actions github-actions Bot added size/s python Pull requests that update python code area-model Related to models or model providers area-tool Tool behavior/api bug Something isn't working labels Jun 24, 2026
@codecov

codecov Bot commented Jun 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Comment thread strands-py/src/strands/models/litellm.py
@chaynabors chaynabors dismissed zastrowm’s stale review June 25, 2026 17:20

Mackenzie is out of office and I believe the concern is not a problem after checking.

@chaynabors chaynabors enabled auto-merge (squash) June 25, 2026 17:20
@chaynabors chaynabors merged commit 3de8f0a into strands-agents:main Jun 25, 2026
35 of 36 checks passed
@chaynabors chaynabors deleted the agent-tasks/1259-litellm-tool-id branch June 25, 2026 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-model Related to models or model providers area-tool Tool behavior/api bug Something isn't working python Pull requests that update python code size/s

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Strands providing null value in id field of tool_calls

3 participants