Skip to content
yisusvii
Go back

AG-UI: The Open Protocol Connecting AI Agents to Frontend Applications

Suggest Changes

By

Table of Contents

Open Table of Contents

Why This Repo, Why Now

Checking github.com/trending today, the top repository is ag-ui-protocol/ag-ui — described in its README as “an open, lightweight, event-based protocol that standardizes how AI agents connect to user-facing applications.”

The problem it targets is one every team building agent-powered products runs into: agents don’t fit the request/response model. They stream tokens, call tools mid-response, update shared state, pause for a human to approve or reject a step, and spawn subagents — and per the README, “every framework does it differently.” AG-UI replaces custom, framework-specific wiring with a single bi-directional event stream: the agent emits typed events, and any client renders them, regardless of which framework built the agent. That means the same agent backend can power a web app, a mobile app, a terminal, or Slack without rewriting the integration layer each time.

Part of why it’s resonating now is the README’s note that AG-UI 1.0 recently shipped — a stable, frozen specification backed by a JSON Schema, with TypeScript, Python, and .NET SDKs generated directly from it, and documented backwards compatibility in both directions between 0.x and 1.0. The README also states the protocol is “adopted by Google, Microsoft, Amazon, and Oracle, and built into most agent frameworks,” including LangChain, CrewAI, Mastra, Google ADK, Pydantic AI, and AWS Strands Agents. As always, a trending position reflects visibility and momentum at a point in time, not an independent verdict on quality, security, or production-readiness — those are reviewed separately below.


What the Technology Actually Is

Per the project’s README and spec, AG-UI is a protocol with official SDKs in three languages:

Community SDKs also exist for Kotlin, Go, Java, Dart, Rust, Ruby, C++, and Swift.

Documented architectural pieces:

At a high level, any HTTP endpoint that accepts a RunAgentInput and streams back typed events over SSE (or Protobuf) is a valid AG-UI agent — the README’s own 30-line Python/FastAPI example demonstrates this directly, with a matching TypeScript HttpAgent client consuming the stream.


Purpose and Use Cases

Per the README, AG-UI’s primary purpose is standardizing agent-to-frontend communication so that teams building agent UIs don’t have to hand-roll a custom streaming protocol per framework.

Documented use cases and target users:

Target users are frontend, platform, and AI/agent engineering teams building production chat or copilot-style interfaces on top of agent frameworks like LangChain, CrewAI, Mastra, Google ADK, or Pydantic AI, who want the frontend (React, mobile, Slack/Teams, or terminal) decoupled from whichever agent framework or model the backend happens to use.


Installation

Per the README’s Quick start section, the maintainers document a CLI scaffold as the primary path, with a manual protocol walkthrough as an alternative.

Prerequisites

npx create-ag-ui-app@latest

This scaffolds a frontend (CopilotKit on Next.js, or a terminal client) wired to the agent framework you pick. Follow the printed next steps, then set the required key before starting the dev server:

export OPENAI_API_KEY="sk-..."

Minimal getting-started example: a 30-line agent server and client

Per the README, an AG-UI agent is any HTTP endpoint that accepts a RunAgentInput and streams events back — no API keys required for this example.

1. The agent (Python).

pip install ag-ui-protocol fastapi uvicorn
# server.py
import uuid

from fastapi import FastAPI, Request
from fastapi.responses import StreamingResponse
from ag_ui.core import (
    PROTOCOL_VERSION,
    RunAgentInput,
    RunStartedEvent,
    RunFinishedEvent,
    TextMessageStartEvent,
    TextMessageContentEvent,
    TextMessageEndEvent,
)
from ag_ui.encoder import EventEncoder

app = FastAPI()

@app.post("/")
async def run_agent(input_data: RunAgentInput, request: Request):
    encoder = EventEncoder(accept=request.headers.get("accept"))

    async def events():
        yield encoder.encode(RunStartedEvent(
            thread_id=input_data.thread_id,
            run_id=input_data.run_id,
            protocol_version=PROTOCOL_VERSION,
        ))
        message_id = str(uuid.uuid4())
        yield encoder.encode(TextMessageStartEvent(message_id=message_id, role="assistant"))
        for chunk in ["Hello ", "from ", "AG-UI!"]:
            yield encoder.encode(TextMessageContentEvent(message_id=message_id, delta=chunk))
        yield encoder.encode(TextMessageEndEvent(message_id=message_id))
        yield encoder.encode(RunFinishedEvent(thread_id=input_data.thread_id, run_id=input_data.run_id))

    return StreamingResponse(events(), media_type=encoder.get_content_type())
uvicorn server:app --port 8000

2. The client (TypeScript), in a second terminal and a new folder.

npm init -y && npm pkg set type=module
npm install @ag-ui/client tsx
// client.ts
import { HttpAgent } from "@ag-ui/client";

const agent = new HttpAgent({ url: "http://localhost:8000/" });

agent.addMessage({
  id: crypto.randomUUID(),
  role: "user",
  content: "Hi there!",
});

await agent.runAgent(
  {},
  {
    onRunStartedEvent: ({ event }) =>
      console.log(`run started (AG-UI ${event.protocolVersion})`),
    onTextMessageContentEvent: ({ event }) => {
      process.stdout.write(event.delta);
    },
    onRunFinishedEvent: () => console.log("\nrun finished"),
  }
);
npx tsx client.ts

Quick Verification

Based on documented steps in the README:

  1. CLI scaffold runs — npx create-ag-ui-app@latest should print setup prompts and complete without error, confirming the CLI resolves.
  2. Manual server/client pair — running the Python server above with uvicorn server:app --port 8000, then npx tsx client.ts in a second terminal, should print run started (AG-UI 1.0...) followed by the streamed text Hello from AG-UI! and finally run finished. This exact output is what the README documents as the expected result.
  3. Live reference demos — the AG-UI Dojo hosts live demos of every feature (streaming chat, generative UI, shared state, human-in-the-loop, reasoning, subagents, multimodal) per framework, usable as a working reference to compare against a local setup.

Security Review

Verified from the repository itself (README, SECURITY.md, LICENSE, and the tags/releases list):

Security considerations to weigh yourself (documented factors, not verified vulnerabilities):

Practical recommendations:


Should You Use It?

Strengths: a genuinely open, documented, versioned specification (1.0 is frozen and schema-backed) rather than a single vendor’s proprietary SDK; broad adoption across major agent frameworks (LangChain, CrewAI, Mastra, Google ADK, Pydantic AI, AWS Strands, and more) and cited use by Google, Microsoft, Amazon, and Oracle; explicit backwards compatibility between 0.x and 1.0; a transport-agnostic design (SSE and Protobuf) that doesn’t lock a team into one network stack; a documented, responsive vulnerability-reporting process; an MIT license; and a near-daily release cadence showing active maintenance.

Limitations: AG-UI defines the event protocol only — authentication, authorization, rate limiting, and input validation for any given deployment are entirely left to the implementer, so adopting the protocol does not itself make an agent server secure; the README’s own quick-start example is a bare, unauthenticated demo; and because the protocol surface spans many third-party framework integrations, the actual security posture of a real deployment depends as much on the chosen framework integration as on AG-UI’s core SDKs.

Good fit for: teams building agent-powered chat, copilot, or generative-UI products who want the frontend decoupled from the agent framework and model provider; organizations already using one of the supported frameworks (LangChain, CrewAI, Mastra, Google ADK, Pydantic AI, AWS Strands, and others) that want a standard streaming contract instead of custom per-framework glue; and teams that need the same agent backend to power multiple surfaces (web, mobile, Slack/Teams, terminal) without re-implementing the integration layer for each.

Evaluate alternatives if: your team needs a single vendor-managed, fully hosted agent-UI solution with authentication and infrastructure included out of the box rather than a protocol you implement yourself; you’re not using (and don’t plan to use) any of the supported agent frameworks, making the integration benefit moot; or your use case doesn’t need streaming, shared state, or human-in-the-loop interrupts and a simple request/response API would be sufficient.

Primary sources used: GitHub repository · README · AG-UI 1.0 spec · Migration guide · SECURITY.md · LICENSE · Tags/Releases · AG-UI Dojo


Suggest Changes
Share this post on:


Previous Post
Your Terraform Review Is Not a Control: Policy as Code for Infra Engineers
Next Post
Security Thursdays by yisusvii — 2026-11-12