How It Works
Quick Start
Tier 1 — Structured output (recommended for APIs)
Dashboard fields to whatever React, Vue, or mobile components you already have.How It Works
Tier decision flow
Tier 0 — Markdown streaming
Tier 1 — Structured output
Useoutput_pydantic=YourModel or output_json=True on the agent. The model formats its response to fit the schema, and you receive a validated Python object.
Tier 2 — AG-UI stream
AGUI wraps any agent and exposes a POST /agui endpoint that emits text delta and tool call events per the AG-UI protocol.
Tier 3 — A2UI declarative
Requirespip install praisonaiagents[a2ui]. The agent emits A2UI JSON; platform-specific renderers (React, Flutter, Lit) turn it into native UI components.
Configuration Options
Tier 1 — Structured output parameters onAgent:
| Parameter | Type | Description |
|---|---|---|
output_pydantic | type[BaseModel] | Pydantic model class — response is validated and returned as an instance |
output_json | bool | Return raw JSON dict instead of a model instance |
AGUI constructor:
| Parameter | Type | Default | Description |
|---|---|---|---|
agent | Agent | — | Single agent to expose |
agents | Agents | — | Multi-agent workflow to expose |
name | str | agent name | Name for the endpoint |
description | str | agent role | Description for OpenAPI docs |
prefix | str | "" | URL prefix for the router |
tags | list[str] | ["AGUI"] | OpenAPI tags |
AGUI TypeScript Reference
TypeScript AG-UI configuration
A2UI Protocol
A2UI declarative UI protocol details
Common Patterns
Return a typed dashboard from a research agent:Best Practices
Choose the simplest tier that meets your needs
Choose the simplest tier that meets your needs
Tier 1 covers 90% of use cases — a typed Pydantic response is easy to test, validate, and map to UI components. Only reach for Tier 2 or 3 when you genuinely need live streaming or cross-platform native rendering.
Define narrow Pydantic models for Tier 1
Define narrow Pydantic models for Tier 1
Broad schemas like
dict defeat the purpose of structured output. Model exactly the fields your frontend needs — this makes validation strict and LLM prompting more reliable.Do not reimplement A2UI types
Do not reimplement A2UI types
Use
praisonaiagents[a2ui] for Tier 3 — do not create your own A2UI JSON structures. The official SDK ensures schema compliance across renderer versions.Renderers live outside PraisonAI core
Renderers live outside PraisonAI core
For Tier 3, the React, Flutter, and Lit renderers are maintained in the Google A2UI repository. PraisonAI provides the agent side; you choose and update renderers independently.
Related
A2UI Protocol
Declarative cross-platform UI via A2UI JSON
Streaming
Token-level streaming for real-time output

