Skip to content

Python: [Feature]: TOOL_CALL_RESULT Events Not Emitted on Approval Resume #4589

@nandireddy19

Description

@nandireddy19

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

  1. 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.
  2. 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

  1. Configure an agent with MCPSpecificApproval on a tool
  2. Send a query that triggers the tool
  3. Resume with {"accepted": true}
  4. Observe SSE stream — no TOOL_CALL_RESULT event appears

Code Sample

Language/SDK

Python

Metadata

Metadata

Assignees

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions