🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis
Socket
Book a DemoInstallSign in
Socket

ag-ui-protocol

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ag-ui-protocol

pipPyPI
Version
0.1.10
Maintainers
1

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

  • 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

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts