Skip to main content
Deploy agents as AG-UI servers for CopilotKit and other AG-UI compatible frontends.

CLI

Python

Expected Output:
Verify:
Response:

Verify Routes

After include_router, app.routes won’t list /agui and /status as flat paths — Starlette nests them under an internal _IncludedRouter. The endpoints work at runtime; verify them with TestClient.
If you need to inspect route paths programmatically, read them off the router instead of the app:

agents.yaml

AGUI server is Python-only. No agents.yaml support.

AGUI Endpoints

Nested-router paths may not flatten into the top-level OpenAPI schema at /openapi.json. The endpoints are fully reachable; this only affects introspection and auto-generated docs tooling that reads app.routes. See Verify Routes.

AGUI Parameters

Concurrency & Thread Isolation

One AGUI(agent=agent) instance safely serves many concurrent clients — each run’s streamed tokens stay in its own SSE stream. A shared Agent still means a shared chat_history. The request’s threadId does not create a separate conversation history. For per-thread memory, give each thread its own Agent.
Per-run isolation landed in PraisonAI#6153 and ships in releases after v4.7.22. On v4.7.22 and earlier, concurrent runs on one shared Agent can receive each other’s streamed tokens — upgrade, or use the Agent-per-thread pattern below.
Agent per thread — mount one AGUI router per thread (or tenant) with prefix:
The server receives the request’s threadId and messages, but does not replay them into the Agent’s history. Separate history needs the Agent-per-thread pattern above.

CopilotKit Integration

Send AGUI Request

Response (SSE Stream):

Event Types

A terminal error reaches the client as run_error, now including mid-stream provider failures that were previously silently dropped. Recoverable conditions (retry, model fallback, streaming fallback) arrive as custom praisonai.* events while the run continues.

PraisonAI custom events

AG-UI has no first-class frames for recoverable failures or user-visible progress. PraisonAI carries these as custom events with a praisonai.* name. AG-UI clients are expected to ignore custom event names they do not recognise, so these are backwards-compatible. See the AGUI API reference for the SSE payload and a JavaScript handler.

JavaScript Client

Troubleshooting