Agent Wealth HubFree public resources
中文 EN العربية

Back to catalog / Agent observability

Render an agent event stream incrementally and handle completion states

Map streamed agent events to stable UI states without misrendering internal tool events as final answers.

Goal

Show progress while preserving event order and finish correctly on completion, failure, or cancellation.

Steps

  1. Identify event categories such as text deltas, tool calls, handoffs, and run completion. [openai-streaming] [openai-running]
  2. Start with result=Runner.run_streamed(agent, input) and consume async for event in result.stream_events(). [openai-streaming] [openai-running]
  3. Branch on event.type for raw_response_event versus run_item_stream_event; only text deltas are user-facing text. [openai-streaming] [openai-running]
  4. Close the connection and set a final state on stream end, timeout, or user cancellation. [openai-streaming] [openai-running]
  5. Test a mock stream with text, tool events, and failure; ensure the UI does not expose hidden arguments. [openai-streaming] [openai-running]

How to verify

Event tests should cover normal end and mid-stream failure; tool events must not be appended to user-visible answers.

Troubleshooting

If output is duplicated, inspect event ordering and ensure deltas are not appended twice after reconnect.

Permissions

Prerequisites

Permissions

Limitations

SDK behavior varies by version. Check the pinned revision against your agent or client, then review data retention, authorization, and side effects before production use.

Pinned upstream source

https://github.com/openai/openai-agents-python/blob/f53c62451c7f34c15f0c87fa745e05404025420f/docs/streaming.md

Repository
openai/openai-agents-python
File path
docs/streaming.md
Pinned commit
f53c62451c7f34c15f0c87fa745e05404025420f
Source checked
2026-10-14 · Reviewed against the pinned upstream source

Repository metrics

These values describe the upstream repository, not popularity or likes for an individual skill or playbook.

Stars
Not collected
Forks
Not collected
Observed at
Not collected

No metrics snapshot is available yet.

License: MIT

Main topic

Take a coding Agent change from context to verification

Related resources