-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
I'm building a web app using Microsoft Agent Framework AG-UI and CopilotKit.
When I use the MCP tool, the AG-UI protocol event TEXT_MESSAGE_END is not emitted.
Expected:
Both TEXT_MESSAGE_START and TEXT_MESSAGE_END are emitted.
Actual:
Only TEXT_MESSAGE_START is emitted; TEXT_MESSAGE_END is never emitted.
Could you please look into this? Thank you.
Log
Two TEXT_MESSAGE_START events are emitted, but only one TEXT_MESSAGE_END event is emitted.
curl -N http://127.0.0.1:8000/api/v1/agents/my-agent \
-H "Content-Type: application/json" \
-H "Accept: text/event-stream" \
-d '{
"threadId": "thread_001",
"runId": "run_001",
"messages": [{"role": "user", "content": "Please tell me the current time."}]
}'
data: {"type":"RUN_STARTED","threadId":"fc984c41-071d-45a5-a454-c8382d3b1bf8","runId":"chatcmpl-D4NdyYh2qbRIt8a1a5QgscDOI15f2"}
data: {"type":"TEXT_MESSAGE_START","messageId":"b0fa26a6-142f-4abe-bce0-16dd45f1a14f","role":"assistant"}
data: {"type":"TOOL_CALL_START","toolCallId":"call_ByVpdkal33OO72zsMUEJm2dC","toolCallName":"get_datetime","parentMessageId":"b0fa26a6-142f-4abe-bce0-16dd45f1a14f"}
data: {"type":"TOOL_CALL_ARGS","toolCallId":"call_ByVpdkal33OO72zsMUEJm2dC","delta":"{}"}
data: {"type":"TOOL_CALL_END","toolCallId":"call_ByVpdkal33OO72zsMUEJm2dC"}
data: {"type":"TOOL_CALL_RESULT","messageId":"e1f8871f-3173-43de-9464-1c2aedd35c00","toolCallId":"call_ByVpdkal33OO72zsMUEJm2dC","content":"[{\"type\": \"text\", \"text\": \"2025/12/01 12:00:00\"}]","role":"tool"}
data: {"type":"TEXT_MESSAGE_START","messageId":"3c32c12c-051c-4885-bf75-03bfb1da9cc7","role":"assistant"}
data: {"type":"TEXT_MESSAGE_CONTENT","messageId":"3c32c12c-051c-4885-bf75-03bfb1da9cc7","delta":"The"}
data: {"type":"TEXT_MESSAGE_CONTENT","messageId":"3c32c12c-051c-4885-bf75-03bfb1da9cc7","delta":" current"}
data: {"type":"TEXT_MESSAGE_CONTENT","messageId":"3c32c12c-051c-4885-bf75-03bfb1da9cc7","delta":" date"}
data: {"type":"TEXT_MESSAGE_CONTENT","messageId":"3c32c12c-051c-4885-bf75-03bfb1da9cc7","delta":" and"}
data: {"type":"TEXT_MESSAGE_CONTENT","messageId":"3c32c12c-051c-4885-bf75-03bfb1da9cc7","delta":" time"}
data: {"type":"TEXT_MESSAGE_CONTENT","messageId":"3c32c12c-051c-4885-bf75-03bfb1da9cc7","delta":" ("}
data: {"type":"TEXT_MESSAGE_CONTENT","messageId":"3c32c12c-051c-4885-bf75-03bfb1da9cc7","delta":"according"}
data: {"type":"TEXT_MESSAGE_CONTENT","messageId":"3c32c12c-051c-4885-bf75-03bfb1da9cc7","delta":" to"}
data: {"type":"TEXT_MESSAGE_CONTENT","messageId":"3c32c12c-051c-4885-bf75-03bfb1da9cc7","delta":" my"}
data: {"type":"TEXT_MESSAGE_CONTENT","messageId":"3c32c12c-051c-4885-bf75-03bfb1da9cc7","delta":" system"}
data: {"type":"TEXT_MESSAGE_CONTENT","messageId":"3c32c12c-051c-4885-bf75-03bfb1da9cc7","delta":" clock"}
data: {"type":"TEXT_MESSAGE_CONTENT","messageId":"3c32c12c-051c-4885-bf75-03bfb1da9cc7","delta":")"}
data: {"type":"TEXT_MESSAGE_CONTENT","messageId":"3c32c12c-051c-4885-bf75-03bfb1da9cc7","delta":" is"}
data: {"type":"TEXT_MESSAGE_CONTENT","messageId":"3c32c12c-051c-4885-bf75-03bfb1da9cc7","delta":" "}
data: {"type":"TEXT_MESSAGE_CONTENT","messageId":"3c32c12c-051c-4885-bf75-03bfb1da9cc7","delta":"202"}
data: {"type":"TEXT_MESSAGE_CONTENT","messageId":"3c32c12c-051c-4885-bf75-03bfb1da9cc7","delta":"5"}
data: {"type":"TEXT_MESSAGE_CONTENT","messageId":"3c32c12c-051c-4885-bf75-03bfb1da9cc7","delta":"-"}
data: {"type":"TEXT_MESSAGE_CONTENT","messageId":"3c32c12c-051c-4885-bf75-03bfb1da9cc7","delta":"12"}
data: {"type":"TEXT_MESSAGE_CONTENT","messageId":"3c32c12c-051c-4885-bf75-03bfb1da9cc7","delta":"-"}
data: {"type":"TEXT_MESSAGE_CONTENT","messageId":"3c32c12c-051c-4885-bf75-03bfb1da9cc7","delta":"01"}
data: {"type":"TEXT_MESSAGE_CONTENT","messageId":"3c32c12c-051c-4885-bf75-03bfb1da9cc7","delta":" "}
data: {"type":"TEXT_MESSAGE_CONTENT","messageId":"3c32c12c-051c-4885-bf75-03bfb1da9cc7","delta":"12"}
data: {"type":"TEXT_MESSAGE_CONTENT","messageId":"3c32c12c-051c-4885-bf75-03bfb1da9cc7","delta":":"}
data: {"type":"TEXT_MESSAGE_CONTENT","messageId":"3c32c12c-051c-4885-bf75-03bfb1da9cc7","delta":"00"}
data: {"type":"TEXT_MESSAGE_CONTENT","messageId":"3c32c12c-051c-4885-bf75-03bfb1da9cc7","delta":":"}
data: {"type":"TEXT_MESSAGE_CONTENT","messageId":"3c32c12c-051c-4885-bf75-03bfb1da9cc7","delta":"00"}
data: {"type":"TEXT_MESSAGE_CONTENT","messageId":"3c32c12c-051c-4885-bf75-03bfb1da9cc7","delta":"."}
data: {"type":"TEXT_MESSAGE_CONTENT","messageId":"3c32c12c-051c-4885-bf75-03bfb1da9cc7","delta":" Would"}
data: {"type":"TEXT_MESSAGE_CONTENT","messageId":"3c32c12c-051c-4885-bf75-03bfb1da9cc7","delta":" you"}
data: {"type":"TEXT_MESSAGE_CONTENT","messageId":"3c32c12c-051c-4885-bf75-03bfb1da9cc7","delta":" like"}
data: {"type":"TEXT_MESSAGE_CONTENT","messageId":"3c32c12c-051c-4885-bf75-03bfb1da9cc7","delta":" this"}
data: {"type":"TEXT_MESSAGE_CONTENT","messageId":"3c32c12c-051c-4885-bf75-03bfb1da9cc7","delta":" in"}
data: {"type":"TEXT_MESSAGE_CONTENT","messageId":"3c32c12c-051c-4885-bf75-03bfb1da9cc7","delta":" a"}
data: {"type":"TEXT_MESSAGE_CONTENT","messageId":"3c32c12c-051c-4885-bf75-03bfb1da9cc7","delta":" specific"}
data: {"type":"TEXT_MESSAGE_CONTENT","messageId":"3c32c12c-051c-4885-bf75-03bfb1da9cc7","delta":" timezone"}
data: {"type":"TEXT_MESSAGE_CONTENT","messageId":"3c32c12c-051c-4885-bf75-03bfb1da9cc7","delta":" or"}
data: {"type":"TEXT_MESSAGE_CONTENT","messageId":"3c32c12c-051c-4885-bf75-03bfb1da9cc7","delta":" format"}
data: {"type":"TEXT_MESSAGE_CONTENT","messageId":"3c32c12c-051c-4885-bf75-03bfb1da9cc7","delta":"?"}
data: {"type":"TEXT_MESSAGE_END","messageId":"3c32c12c-051c-4885-bf75-03bfb1da9cc7"}
data: {"type":"MESSAGES_SNAPSHOT","messages":[{"id":"94eb1979-a7db-41d5-8a84-5505a1405dfb","role":"user","content":"Please tell me the current time."},{"id":"3c32c12c-051c-4885-bf75-03bfb1da9cc7","role":"assistant","content":"The current date and time (according to my system clock) is 2025-12-01 12:00:00. Would you like this in a specific timezone or format?","toolCalls":[{"id":"call_ByVpdkal33OO72zsMUEJm2dC","type":"function","function":{"name":"get_datetime","arguments":"{}"}}]},{"id":"e1f8871f-3173-43de-9464-1c2aedd35c00","role":"tool","content":"[{\"type\": \"text\", \"text\": \"2025/12/01 12:00:00\"}]","toolCallId":"call_ByVpdkal33OO72zsMUEJm2dC"}]}
data: {"type":"RUN_FINISHED","threadId":"fc984c41-071d-45a5-a454-c8382d3b1bf8","runId":"chatcmpl-D4NdyYh2qbRIt8a1a5QgscDOI15f2"}
Source code
get_datetime_mcp = MCPStreamableHTTPTool(
name="get-datetime-mcp",
url="http://localhost:8001/mcp",
)
base_agent = ChatAgent(
name="MyAgent",
instructions="You are a helpful AI Agent.",
chat_client=chat_client,
tools=[get_datetime_mcp],
)
add_agent_framework_fastapi_endpoint(
app=app,
agent=AgentFrameworkAgent(
agent=base_agent,
name="MyAgent",
description="Helpful AI Agent",
),
path="/api/v1/agents/my-agent",
)Version information
Python 3.13.10
agent-framework-ag-ui==1.0.0b260130
agent-framework-core==1.0.0b260130
Thank you in advance.
Metadata
Metadata
Assignees
Type
Projects
Status
No status