Skip to main content

No project description provided

Project description

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, BinaryInputContent

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

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

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ag_ui_protocol-0.1.11.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ag_ui_protocol-0.1.11-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file ag_ui_protocol-0.1.11.tar.gz.

File metadata

  • Download URL: ag_ui_protocol-0.1.11.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.11.9 Darwin/24.1.0

File hashes

Hashes for ag_ui_protocol-0.1.11.tar.gz
Algorithm Hash digest
SHA256 b336dfebb5751e9cc2c676a3008a4bce4819004e6f6f8cba73169823564472ae
MD5 ab327a44946f62af1cb3c5fe4f186002
BLAKE2b-256 a2c133ab11dc829c6c28d0d346988b2f394aa632d3ad63d1d2eb5f16eccd769b

See more details on using hashes here.

File details

Details for the file ag_ui_protocol-0.1.11-py3-none-any.whl.

File metadata

  • Download URL: ag_ui_protocol-0.1.11-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.11.9 Darwin/24.1.0

File hashes

Hashes for ag_ui_protocol-0.1.11-py3-none-any.whl
Algorithm Hash digest
SHA256 b0cc25570462a8eba8e57a098e0a2d6892a1f571a7bea7da2d4b60efd5d66789
MD5 9df75607ddf0250323c04f1fbaca0fa7
BLAKE2b-256 14835c6f4cb24d27d9cbe0c31ba2f3b4d1ff42bc6f87ba9facfa9e9d44046c6b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page