Skip to content

Python: [Bug]: AG-UI workflow runner ignores "intermediate" events #8000

Description

Description

What happened?

The agent-framework-ag-ui package only processes output and data event types in workflows, meaning intermediate events produced by agent-framework WorkflowAgent are NOT handled and fall through to custom events instead of being converted to the appropriate AGUI Reasoning* event types.

Location:

This causes intermediate workflow events to be emitted as generic AGUI CustomEvent instead of proper reasoning events.

What did you expect to happen?

  1. agent-framework-ag-ui should handle "intermediate" events

Since AGENT_FORWARDED_EVENT_TYPES defines "intermediate" as the modern standard (with "data" as deprecated):

# python/packages/core/agent_framework/_workflows/_events.py:L138
AGENT_FORWARDED_EVENT_TYPES: frozenset[str] = frozenset({
    "output",
    "intermediate",  # ← The new standard
    "data",  # deprecated alias for intermediate; retained for backward compat
    "request_info",
})

The AG-UI workflow runner should handle all forwarded event types:

# _workflow_run.py:L1277 (proposed fix)
if event_type in {"output", "intermediate", "data"}:
    # ... process as AG-UI events
  1. Intermediate event content should be displayed as reasoning
    When workflows emit intermediate events with text content, the AG-UI layer should automatically convert that content to text_reasoning type so it displays as reasoning in the UI (collapsible "thinking" sections), not as final assistant messages.
    This could be handled in either:
  • Option A: WorkflowAgent._convert_workflow_event_to_agent_response_updates() - auto-convert text content in intermediate events to text_reasoning before forwarding
  • Option B: agent-framework-ag-ui/_workflow_run.py - detect intermediate events and convert their text content to text_reasoning before calling _emit_content()

Steps to reproduce the issue

@executor(id="thinking_executor")
async def thinking_executor(
    msgs: list[Message], 
    ctx: WorkflowContext[None, str]
) -> None:
    """Emit intermediate output that should display as reasoning."""
    # This should appear as reasoning/thinking in the UI
    await ctx.yield_output("Analyzing the problem...", type="intermediate")
    # This should appear as final response
    await ctx.yield_output("Here's my answer!", type="output")

# Create workflow with intermediate output enabled
builder = WorkflowBuilder(
    name="test_workflow",
    start_executor=thinking_executor,
    intermediate_output_from=[thinking_executor],
)
workflow = builder.build()

# Wrap in AG-UI
agui_workflow = AgentFrameworkWorkflow(
    workflow=workflow,
    name="test-reasoning",
    description="Test intermediate events",
)

# Run it - intermediate events will NOT display as reasoning
# They fall through to CustomEvent instead of ReasoningMessageContentEvent

Code Sample

Error Messages / Stack Traces

Package Versions

agent-framework-core 1.13.0; agent-framework-ag-ui 1.0.1

Python Version

python 3.12

Additional Context

No response

Metadata

Metadata

Labels

ag-uiUsage: [Issues, PRs], Target: AG-UI protocol integrationpythonUsage: [Issues, PRs], Target: PythonreproducedUsage: [Issues], Target: all issues that can be reproduced by the triage workflow

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions