8000 Python: [AG-UI]: MESSAGES_SNAPSHOT merges toolCalls and content in single assistant message · Issue #3619 · microsoft/agent-framework · GitHub
[go: up one dir, main page]

Skip to content

Python: [AG-UI]: MESSAGES_SNAPSHOT merges toolCalls and content in single assistant message #3619

@render93

Description

@render93

I'm building a web app using Microsoft Agent Framework AG-UI and CopilotKit.

When using agent-framework-ag-ui and call a tool, the MESSAGES_SNAPSHOT event emitted after tool execution contains a single assistant message with both toolCalls and content fields populated.

This differs from version 1.0.0b260116, where the framework emitted two separate assistant messages: one containing only toolCalls, followed by another containing only content.

Event Log Comparison

Working Version (1.0.0b260116)

{
  "id": "agent:1767",
  "agentId": "agent",
  "type": "MESSAGES_SNAPSHOT",
  "timestamp": 1770029417490,
  "payload": {
    "type": "MESSAGES_SNAPSHOT",
    "messages": [
      {
        "id": "a230ffeb-6e00-4eff-83ff-fbf7af80d978",
        "role": "user",
        "content": "hi, please can you..."
      },
      {
        "id": "6c310e7e-0cfa-47b3-b028-337d3581172e",
        "role": "assistant",
        "toolCalls": [
          { "id": "call_NxeUZKVxtof9b1T6tPjulVrT", "function": { "name": "get_alert_by_id", "arguments": "{...}" } },
          { "id": "call_fWQA2lyfVFk9nv26J2XNJrby", "function": { "name": "run_arg_query", "arguments": "{...}" } },
          { "id": "call_Z1BQGGf4qcV0yAwvzMI5MdYi", "function": { "name": "get_dcr_associations", "arguments": "{...}" } }
        ]
      },
      {
        "id": "2114b057-5ac8-4e2c-9106-ccf7121b116c",
        "role": "tool",
        "content": "{\"success\": true, \"status\": 200, \"details\": {...}}",
        "toolCallId": "call_NxeUZKVxtof9b1T6tPjulVrT"
      },
      {
        "id": "898380bd-b403-43ef-8052-a6aa81408a6b",
        "role": "assistant",
        "content": "(**alert-investigator-agent**)\n\nHere you found the..."
      }
    ]
  }
}

Note: Two separate assistant messages - first with toolCalls only, second with content only.

Not working Version (1.0.0b260130)

{
  "id": "agent:1722",
  "agentId": "agent",
  "type": "MESSAGES_SNAPSHOT",
  "timestamp": 1770027381461,
  "payload": {
    "type": "MESSAGES_SNAPSHOT",
    "messages": [
      {
        "id": "e850de5a-384e-4ac4-b983-93dcaa38eb0d",
        "role": "user",
        "content": "hi, please can you..."
      },
      {
        "id": "5d8a71bb-ccec-493f-afba-a588d3d2e517",
        "role": "assistant",
        "content": "(**alert-investigator-agent**)\n\nHere you found the...",
        "toolCalls": [
          { "id": "call_EaYXZJKsZbQ8uWk6pFuQbPN4", "function": { "name": "get_alert_by_id", "arguments": "{...}" } },
          { "id": "call_n6uPGmtMeRy1RSurnzPfbE9o", "function": { "name": "run_arg_query", "arguments": "{...}" } },
          { "id": "call_90ZLhseHNdWQoFtvrnmZ6jPW", "function": { "name": "get_dcr_associations", "arguments": "{...}" } }
        ]
      },
      {
        "id": "333d9b38-9cd3-4bc2-b8f9-a0fb40520fcb",
        "role": "tool",
        "content": "{\"success\": true, \"status\": 200, \"details\": {...}}",
        "toolCallId": "call_EaYXZJKsZbQ8uWk6pFuQbPN4"
      }
    ]
  }
}

Note: Single assistant message containing both toolCalls and content fields simultaneously.

Related Issues

Possibly related to #3568, which reports missing TEXT_MESSAGE_END events. Both issues involve event stream protocol changes in version 1.0.0b260130.

Version information

Python 3.13.3
agent-framework-ag-ui==1.0.0b260130
agent-framework-core==1.0.0b260130

Thank you in advance.

Metadata

Metadata

Assignees

Type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0