Skip to content

Python: [Bug]: DevUI repeats streamed tool calls #7651

Description

Description

When an agent streams a function call through DevUI, the chat displays the same tool call multiple times. Each streamed arguments chunk that repeats the function call ID and name is rendered as another tool call, even though the framework executes the tool only once.

Expected behaviour: DevUI should add one tool-call item per unique call_id and append subsequent argument chunks to that item.

Steps to reproduce:

  1. Run a DevUI agent with a function tool and a streaming chat client.
  2. Ask the agent to invoke the tool.
  3. Use a provider that repeats call_id and name on streamed function-call argument chunks.
  4. Observe multiple copies of the tool call in the chat and multiple response.output_item.added events for the same call.

Image

Code Sample

first_update = AgentResponseUpdate(contents=[
    Content.from_function_call(
        call_id="call_123",
        name="get_weather",
        arguments="{\"location\":",
    )
])
second_update = AgentResponseUpdate(contents=[
    Content.from_function_call(
        call_id="call_123",
        name="get_weather",
        arguments="\"Seattle\"}",
    )
])

Passing both updates through MessageMapper.convert_event emits two response.output_item.added events for call_123; it should emit one added event and two argument delta events.

Error Messages / Stack Traces

No exception is raised. The failure is visible as duplicate tool-call entries and duplicate response.output_item.added events.

Package Versions

agent-framework-devui: 1.0.0b260730, agent-framework-core: 1.13.0

Python Version

Python 3.14.6

Additional Context

MessageMapper._map_function_call_content currently treats every chunk containing both call_id and name as a new function call. Real streaming clients can repeat that metadata for every arguments chunk. The mapper already tracks calls in active_function_calls, so new output items can be limited to previously unseen call IDs while preserving argument deltas.

Metadata

Metadata

Labels

devuiUsage: [Issues, PRs], Target: DevUIpythonUsage: [Issues, PRs], Target: PythonreproducedUsage: [Issues], Target: all issues that can be reproduced by the triage workflow

Type

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions