|
1 |
| -# Agent User Interaction Protocol Documentation |
| 1 | +# ag-ui-protocol |
2 | 2 |
|
3 |
| -The Python SDK for the [Agent User Interaction Protocol](https://ag-ui.com). |
| 3 | +Python SDK for the **Agent-User Interaction (AG-UI) Protocol**. |
4 | 4 |
|
5 |
| -For more information visit the [official documentation](https://docs.ag-ui.com/). |
| 5 | +`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. |
| 6 | + |
| 7 | +## Installation |
| 8 | + |
| 9 | +```bash |
| 10 | +pip install ag-ui-protocol |
| 11 | +poetry add ag-ui-protocol |
| 12 | +pipenv install ag-ui-protocol |
| 13 | +``` |
| 14 | + |
| 15 | +## Features |
| 16 | + |
| 17 | +- 🐍 **Python-native** – Idiomatic Python APIs with full type hints and validation |
| 18 | +- 📋 **Pydantic models** – Runtime validation and automatic JSON serialization |
| 19 | +- 🔄 **Streaming events** – 16 core event types for real-time agent communication |
| 20 | +- ⚡ **High performance** – Efficient event encoding for Server-Sent Events |
| 21 | + |
| 22 | +## Quick example |
| 23 | + |
| 24 | +```python |
| 25 | +from ag_ui.core import TextMessageContentEvent, EventType |
| 26 | +from ag_ui.encoder import EventEncoder |
| 27 | + |
| 28 | +# Create a streaming text event |
| 29 | +event = TextMessageContentEvent( |
| 30 | + type=EventType.TEXT_MESSAGE_CONTENT, |
| 31 | + message_id="msg_123", |
| 32 | + delta="Hello from Python!" |
| 33 | +) |
| 34 | + |
| 35 | +# Encode for HTTP streaming |
| 36 | +encoder = EventEncoder() |
| 37 | +sse_data = encoder.encode(event) |
| 38 | +# Output: data: {"type":"TEXT_MESSAGE_CONTENT","messageId":"msg_123","delta":"Hello from Python!"}\n\n |
| 39 | +``` |
| 40 | + |
| 41 | +## Packages |
| 42 | + |
| 43 | +- **`ag_ui.core`** – Types, events, and data models for AG-UI protocol |
| 44 | +- **`ag_ui.encoder`** – Event encoding utilities for HTTP streaming |
| 45 | + |
| 46 | +## Documentation |
| 47 | + |
| 48 | +- Concepts & architecture: [`docs/concepts`](https://docs.ag-ui.com/concepts/architecture) |
| 49 | +- Full API reference: [`docs/sdk/python`](https://docs.ag-ui.com/sdk/python/core/overview) |
| 50 | + |
| 51 | +## Contributing |
| 52 | + |
| 53 | +Bug reports and pull requests are welcome! Please read our [contributing guide](https://docs.ag-ui.com/development/contributing) first. |
| 54 | + |
| 55 | +## License |
| 56 | + |
| 57 | +MIT © 2025 AG-UI Protocol Contributors |
0 commit comments