Contract
Streaming
AG-UI events, parts, and the closed renderer registry.
A turn is a stream, not a chat blob. Event names match the platform contract so there is no translation layer.
Events you emit
| Event | When |
|---|---|
RUN_STARTED / RUN_FINISHED / RUN_ERROR | Turn lifecycle |
STEP_STARTED | Named progress the user can follow |
TEXT_MESSAGE_CHUNK | Prose, markdown-safe |
PART | Structured UI: table, fields, files |
ARTIFACT_STAGED | Something ready for review |
APPROVAL_REQUIRED | A write, send, or delete is waiting |
CLARIFICATION_REQUIRED | A question with decide_for_me |
COST_UPDATE / BUDGET_HOLD / BUDGET_SETTLE | Declared cost against the hold |
Non-streaming agents can wrap a single result with Stream.from_batch. Prefer a real stream so the session feels alive.