Skip to content

An assistant message with 'tool_calls' must be followed by tool messages #562

Closed
@uriafranko

Description

@uriafranko

A weird error is showing on an agent that runs multiple times in parallel

research_agent = Agent(
    model="openai:gpt-4o-mini",
    name="research_agent",
    deps_type=ResearchDependencies,
    result_type=ResearchResult,
    retries=3,
)

Error message

Error code: 400 - {'error': {'message': "An assistant message with 'tool_calls' must be followed by tool messages responding to each 'tool_call_id'. The following tool_call_ids did not have response messages: call_peVwb5yZhjdZ3xtJZAX8dDRV", 'type': 'invalid_request_error', 'param': 'messages', 'code': None}}

any idea why it could happen?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions