Description
File: agent_framework_ag_ui/_agent_run.py · Lines: 710–742
Description
When a tool is approved via the interrupt/resume flow, _resolve_approval_responses (line 710) executes the tool and injects the result into the messages array passed to agent.run(). However, no TOOL_CALL_RESULT SSE event is yielded to the client.
Current behavior
- Turn 1: Agent calls tool →
TOOL_CALL_START, TOOL_CALL_ARGS, TOOL_CALL_END emitted → run interrupts
- Turn 2 (resume with approval): Wrapper executes the tool internally → result injected into messages → LLM continues → only the LLM's text response is streamed
- The client sees the tool call (START/ARGS/END) but never the tool result
Impact
- UI cannot display tool output. The UI renders tool calls and their outputs, but for approved tools there is no
TOOL_CALL_RESULT event to render.
- Middleware cannot reconstruct full conversation history. In multi-turn HITL scenarios (Turn 1 interrupts → Turn 2 approves/interrupts → Turn 3 approves), middleware has no record of prior turn tool results, preventing construction of a full
messages[] array. Current workaround: only include the most recent turn's messages in each resume request.
Expected behavior
After _resolve_approval_responses executes approved tools (line 710), run_agent_stream should yield a TOOL_CALL_RESULT event for each successfully executed tool before calling agent.run(). The fix goes between line 710 and line 742 — iterate over resolved messages, find function_result contents, and yield corresponding events.
Reproduction
- Configure an agent with
MCPSpecificApproval on a tool
- Send a query that triggers the tool
- Resume with
{"accepted": true}
- Observe SSE stream — no
TOOL_CALL_RESULT event appears
Code Sample
Language/SDK
Python
Description
File:
agent_framework_ag_ui/_agent_run.py· Lines: 710–742Description
When a tool is approved via the interrupt/resume flow,
_resolve_approval_responses(line 710) executes the tool and injects the result into the messages array passed toagent.run(). However, noTOOL_CALL_RESULTSSE event is yielded to the client.Current behavior
TOOL_CALL_START,TOOL_CALL_ARGS,TOOL_CALL_ENDemitted → run interruptsImpact
TOOL_CALL_RESULTevent to render.messages[]array. Current workaround: only include the most recent turn's messages in each resume request.Expected behavior
After
_resolve_approval_responsesexecutes approved tools (line 710),run_agent_streamshould yield aTOOL_CALL_RESULTevent for each successfully executed tool before callingagent.run(). The fix goes between line 710 and line 742 — iterate over resolved messages, findfunction_resultcontents, and yield corresponding events.Reproduction
MCPSpecificApprovalon a tool{"accepted": true}TOOL_CALL_RESULTevent appearsCode Sample
Language/SDK
Python