Skip to content

Tool call after an initial response is being streamed causes duplicate responses #4126

@Cameronjmayfield

Description

@Cameronjmayfield

Bug description
Once a response has started streaming, if the LLM decides to make another tool call, the initial response is repeated.

Environment
Spring AI 1.0.1
Spring Boot 3.5.3

Steps to reproduce
Ask LLM to list available tools and stream the response. If one of the tools might describe a tool, the LLM will execute it, then run the prompt again with the tool response. This causes duplicate answers to stream back because it creates a second LLM call.

Expected behavior
If a tool is executed after the LLM has started generating a response, the tool response should continue from where the previous assistant message completed. Alternatively, allow a tool call to be executed without sending the response to the user OR the LLM.

Minimal Complete Reproducible example
I will work on this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BedrockbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions