Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

ag-ui-protocol

Python SDK for the Agent-User Interaction (AG-UI) Protocol.

ag-ui-protocol provides Python developers with strongly-typed data structures and event encoding for building AG-UI compatible agent servers. Built on Pydantic for robust validation and automatic camelCase serialization for seamless frontend integration.

Installation

pip install ag-ui-protocol
poetry add ag-ui-protocol
pipenv install ag-ui-protocol

Features

  • 🐍 Python-native – Idiomatic Python APIs with full type hints and validation
  • 📋 Pydantic models – Runtime validation and automatic JSON serialization
  • 🔄 Streaming events – 16 core event types for real-time agent communication
  • ⚡ High performance – Efficient event encoding for Server-Sent Events

Quick example

from ag_ui.core import TextMessageContentEvent, EventType
from ag_ui.encoder import EventEncoder

# Create a streaming text event
event = TextMessageContentEvent(
    type=EventType.TEXT_MESSAGE_CONTENT,
    message_id="msg_123",
    delta="Hello from Python!"
)

# Encode for HTTP streaming
encoder = EventEncoder()
sse_data = encoder.encode(event)
# Output: data: {"type":"TEXT_MESSAGE_CONTENT","messageId":"msg_123","delta":"Hello from Python!"}\n\n

Multimodal user message

from ag_ui.core import UserMessage, TextInputContent, ImageInputPart, InputContentUrlSource

message = UserMessage(
    id="user-123",
    content=[
        TextInputContent(text="Please describe this image"),
        ImageInputPart(
            source=InputContentUrlSource(
                value="https://example.com/cat.png",
                mime_type="image/png",
            )
        ),
    ],
)

payload = message.model_dump(by_alias=True)
# {"id": "user-123", "role": "user", "content": [...]}

BinaryInputContent is deprecated. Use modality-specific input parts (ImageInputPart, AudioInputPart, VideoInputPart, DocumentInputPart) with InputContentDataSource or InputContentUrlSource.

Packages

  • ag_ui.core – Types, events, and data models for AG-UI protocol
  • ag_ui.encoder – Event encoding utilities for HTTP streaming

Documentation

Contributing

Bug reports and pull requests are welcome! Please read our contributing guide first.

License

MIT © 2025 AG-UI Protocol Contributors

Release files for ag-ui-protocol 0.1.20.dev1786549251

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ag-ui-protocol 0.1.20.dev1786549251
File Size Uploaded
ag_ui_protocol-0.1.20.dev1786549251.tar.gz 11.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ag-ui-protocol 0.1.20.dev1786549251
File Interpreter ABI Platform
ag_ui_protocol-0.1.20.dev1786549251-py3-none-any.whl Python 3 none any Details

Total release size: 26.8 kB

Release files / ag_ui_protocol-0.1.20.dev1786549251.tar.gz

Download URL ag_ui_protocol-0.1.20.dev1786549251.tar.gz
Size 11.8 kB
Tags Source
SHA-256 checksum
How to use checksums
95517a8a6e59b764046deccc25f5db3f21c89dc03b30c48cb8d42539c9a5b07c
BLAKE2b-256 checksum
How to use checksums
69b6771b6e846d4798f9996f9891b4dcb3fc7d563845aaa7950c92d06821bee9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / ag_ui_protocol-0.1.20.dev1786549251-py3-none-any.whl

Download URL ag_ui_protocol-0.1.20.dev1786549251-py3-none-any.whl
Size 15.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0d1610b94cff89254219622f0331cb6d24119e472c08d308ed48b59acb4abbe9
BLAKE2b-256 checksum
How to use checksums
1d1c6149722e3e0b1251663bdd3dff3183ae65ba0a98925441b178c48f12c5fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page