No summary available
Project Links
Meta
Author: Markus Ecker
Requires Python: >=3.9
Classifiers
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": [...]}
BinaryInputContentis deprecated. Use modality-specific input parts (ImageInputPart,AudioInputPart,VideoInputPart,DocumentInputPart) withInputContentDataSourceorInputContentUrlSource.
Packages
ag_ui.coreโ Types, events, and data models for AG-UI protocolag_ui.encoderโ Event encoding utilities for HTTP streaming
Documentation
- Concepts & architecture:
docs/concepts - Full API reference:
docs/sdk/python
Contributing
Bug reports and pull requests are welcome! Please read our contributing guide first.
License
MIT ยฉ 2025 AG-UI Protocol Contributors
0.1.15
Apr 01, 2026
0.1.14
Mar 18, 2026
0.1.13
Feb 19, 2026
0.1.12
Feb 19, 2026
0.1.11
Feb 11, 2026
0.1.10
Nov 06, 2025
0.1.9
Sep 19, 2025
0.1.9a0
Sep 05, 2025
0.1.8
Jul 15, 2025
0.1.7
Jun 26, 2025
0.1.6
Jun 26, 2025
0.1.5
May 20, 2025
0.1.4
Apr 30, 2025
Wheel compatibility matrix
Files in release
Extras:
None
Dependencies:
pydantic
(>=2.11.2)