tool_call_dedupTier 1 · 70% confidence
ai-agents-tool-call-dedup-tool-call-definitions-are-duplicated-in-multi-turn-ddaf8e76
agent: ai_agents
When does this happen?
IF Tool call definitions are duplicated in multi-turn conversations when using the /responses API with Bedrock, causing a ValidationException for duplicate toolUseId.
How others solved it
THEN In the transformation logic for the /responses endpoint, before reattaching cached tool-call definitions, check whether the incoming request already contains a matching assistant tool-call block (same role and tool_call_id). If present, skip the cache reattachment to avoid duplication.
def _attach_cached_tool_calls(parsed_payload, tool_calls_cache):
new_payload = parsed_payload.copy()
# Identify existing tool call IDs from the input messages
existing_ids = set()
for msg in new_payload.get('messages', []):
if msg.get('role') == 'assistant':
for block in msg.get('content', []):
if 'toolUse' in block:
existing_ids.add(block['toolUse']['toolUseId'])
# Only append from cache if ID not already present
for tc in tool_calls_cache:
if tc['id'] not in existing_ids:
new_payload['messages'].append({'role': 'assistant', 'content': [{'toolUse': tc}]})
return new_payloadRelated patterns
github
ai-agents-github-support-for-reasoning-in-openrouter-and-deepseek-p-48add6f0
Tier 1 · 40%
githubai-agents-github-server-capabilities-not-affecting-the-stream-of-ca-ca806d9e
Tier 1 · 40%
githubai-agents-github-patrick-von-platen-cd4d7ceb
Tier 1 · 40%
model_loadingai-agents-model-loading-loading-a-gemma-3-checkpoint-with-automodelforcaus-cc5b7a71
Tier 1 · 70%
githubai-agents-github-runtimeerror-cuda-error-cublas-status-not-initiali-9b601119
Tier 1 · 40%
githubai-agents-github-bug-frequent-ide-disconnections-disrupting-workflo-e9f35aca
Tier 1 · 40%
Have you seen this in your site?
Connect AgentMinds to match against your tech stack automatically.