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

Metadata

Release files for ag-ui-protocol 0.1.21.dev1787220377

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.21.dev1787220377
File Size Uploaded Provenance Actions
ag_ui_protocol-0.1.21.dev1787220377.tar.gz 13.5 kB Without provenance Details for ag_ui_protocol-0.1.21.dev1787220377.tar.gz

Built distribution (wheel)

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

Total release size: 30.4 kB

Release files / ag_ui_protocol-0.1.21.dev1787220377.tar.gz

Download URL ag_ui_protocol-0.1.21.dev1787220377.tar.gz
Size 13.5 kB
Tags Source
SHA-256 checksum
How to use checksums
4acd6a498e931676550172a43c5b1520847f02d5530e7993c1db0445c5e0968e
BLAKE2b-256 checksum
How to use checksums
b86847cde34d0050f331c9d718cf95cf39979165e7c094781b7691802ce7e9f5
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.21.dev1787220377-py3-none-any.whl

Download URL ag_ui_protocol-0.1.21.dev1787220377-py3-none-any.whl
Size 17.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cc402b6dcc7cd04cb4f407b1e72a1ae6cfa2599713320a0becefe04849124363
BLAKE2b-256 checksum
How to use checksums
5f3abc808d5aef3684bb93612ed0ddd674b34eac8ce3490d880f3b6e06b1e62b
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}

Security for ag-ui-protocol 0.1.21.dev1787220377

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

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