As AI agents evolve from simple chatbots into workflow engines, decision-makers, and copilots, one challenge has remained stubbornly unsolved: How do we connect intelligent agents to rich, dynamic, user-facing interfaces without custom plumbing every single time?
Introducing AG-UI (Agent–User Interface) — a unified protocol that finally standardizes how agents talk to frontends. It enables streaming, declarative UI generation, state synchronization, and human-in-the-loop workflows out of the box.
AG-UI is the missing piece that bridges backend intelligence with real-time, interactive user experiences.
Before AG-UI, developers juggled:
- REST APIs for request–response
- Web Sockets/SSE for streaming
- Custom JSON structures for tool calls
- Ad-hoc approaches for dynamic UI
The result? Fragmented systems, brittle integrations, and zero interoperability.
AG-UI replaces all of this with one standard protocol covering:
- Chat messages
- UI component proposals
- Tool calls
- Shared state updates
- Interrupts for human approvals
Token-level streaming is a first-class citizen. No need to hand-roll Web Sockets or patch SSE responses — AG-UI handles it through a consistent event protocol.
AG-UI supports:
- Interrupt events
- Approval dialogs
- State diffs
- Resume logic
All natively, with no custom workflow engines required.
- One standard protocol for chat, UI, interrupts, and shared state
- Token-level streaming support
- Declarative UI proposals from agents
- Built-in HITL workflows
- Clear separation of concerns
- Cross-framework interoperability
Agents propose UI components, update shared state, and respond in real time.
Approvals, forms, provisioning flows, and automated processes.
Nested workflows and delegated subtasks.
Agents call backend tools and instantly reflect results in the UI.
- Create an AG-UI server using Microsoft Agent Framework.
- Connect a frontend using libraries like CopilotKit.
- Implement streaming chat + declarative UI events.
- Deploy over HTTPS, SSE, or Web Sockets.
AG-UI’s interrupt model lets agents pause execution, request human approval, accept modifications, and resume safely.
Common HITL workflows:
- Financial operations
- Security actions
- External communication drafts
- Compliance reviews
{ "event": "interrupt", "reason": "manager_approval_required", "ui": { "type": "approval_dialog", "fields": [ { "label": "Total", "value": 1234.56 }, { "label": "Notes", "type": "text" } ] }, "shared_state": { "reportId": "R-2025-1101", "status": "pending" } }
{ "event": "user_decision", "action": "approve", "actor": "manager@contoso.com", "shared_state_diff": { "status": "approved" } }
def process_expense(report): validation = tools.expense_validate(report) if validation.requires_manager_approval: emit_interrupt( ui=approval_dialog(report), shared_state={"status": "pending"} ) decision = await wait_for_user_decision() if decision == "approve": tools.expense_post_to_erp(report) elif decision == "edit": apply_shared_state_diff(decision.diff) return process_expense(report) else: tools.expense_reject(report)
- Protect endpoints with Azure AD
- Enforce HTTPS, HSTS, rate limits
- Use managed identity + Key Vault
- Apply content safety filters
- Isolate tool permissions
- Enforce approvals for sensitive actions
- Maintain session-level audit trails
- Minimize PII and enforce encryption
from fastapi import FastAPI from fastapi.responses import StreamingResponse import asyncio app = FastAPI() async def agent_stream(): messages = ["Hello!", "I am your AI agent.", "How can I assist you today?"] for msg in messages: yield msg + "\n" await asyncio.sleep(1) app.get("/chat") async def chat(): return StreamingResponse(agent_stream(), media_type="text/plain") app.get("/ui") async def ui_component(): return { "type": "form", "fields": [ {"label": "Name", "type": "text"}, {"label": "Email", "type": "email"} ] }
AG-UI is more than a protocol — it is the foundation for building next-generation, agent-driven applications. By standardizing how agents interact with user interfaces, it enables richer experiences, safer workflows, and faster development.