Skip to content

[Bug] Invalid parameter: messages with role 'tool' must be a response to a preceding message with 'tool_calls'. #113

@Kinbaum

Description

@Kinbaum

When using an agent network (routing agent hands off to a specialized weather agent), the first weather request works correctly, but subsequent requests that call the tool fail with the following error:

Invalid parameter: messages with role 'tool' must be a response to a preceding message with 'tool_calls'

Reproduction steps:

  1. Setup - Create an agent network with:
    • A routing agent that receives user prompts and forwards to a specialized agent.
    • A weather agent that calls an external tool (the weather tool) and returns a response.

  2. Interaction
    • Ask the routing agent for weather in location A (e.g., "Is it snowing in Dallas TX?").
    • Routing agent forwards to the weather agent.
    • Weather agent calls the tool and returns a message with role "tool" (this succeeds).
    • Ask the routing agent for weather in a different location B (e.g., "How about Tampa FL?")
    • Routing agent forwards to the weather agent again and the weather agent attempts to call the same tool.

Note

Sometimes this succeeds and you'll need to ask it a few more times. See the recording.
Model is azure/gpt-5 and azure/gpt-5-mini

Sequence.01.mp4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions