Skip to the content.

AG-UI

Information

AG-UI (Agent–User Interaction Protocol) is an open, lightweight, and event-based protocol that standardizes how AI agents connect to user-facing applications. It is designed to be the general-purpose, bi-directional connection between a user-facing application and any agentic backend.

The project documentation is hosted at https://docs.ag-ui.com/.

Main Functionalities and Features

Installation

Using npm

Install the core library and client package:

npm install @ag-ui/core @ag-ui/client

Using Python

pip install ag-ui-core ag-ui-client

Using .NET

dotnet add package AGUI.Abstractions
dotnet add package AGUI.Client

Usage, tips and tricks

Basic Client Usage (TypeScript)

  1. Initialize the Agent: Use HttpAgent to connect to a remote agent endpoint.
import {HttpAgent} from "@ag-ui/client";

const agent = new HttpAgent({
    url: "https://api.example.com/v1/agent",
    headers: {
        Authorization: "Bearer your-api-key",
    },
});
  1. Run the Agent: Execute the agent and handle the streaming results.
const result = await agent.runAgent({
    messages: [{role: "user", content: "Hello, how can you help me today?"}]
});

console.log("Agent response:", result.result);
  1. Subscribe to Events: Handle lifecycle and state events during execution.
agent.subscribe({
    onMessage: (message) => {
        console.log("New message:", message);
    },
    onStateUpdate: (state) => {
        console.log("State updated:", state);
    }
});

AG-UI and A2UI

While they have similar names, they serve different purposes:

They are often used together to build sophisticated agentic applications.

See also