Expand description
AG-UI Server SDK
This crate provides server-side functionality for producing AG-UI protocol events. It enables Rust agents to stream events to frontend applications via various transports (SSE, WebSocket, etc.).
§Overview
The AG-UI Server SDK includes:
- Event Producer: High-level API for emitting AG-UI events from agent code
- Transport Layer: SSE and WebSocket implementations for streaming events
- Error Handling: Server-specific error types
§Usage
ⓘ
use ag_ui_server::{EventProducer, Result};§Integration
This crate is designed to integrate with the Syncable CLI agent, enabling any frontend to connect and receive real-time agent events.
Re-exports§
pub use error::Result;pub use error::ServerError;pub use transport::SseHandler;pub use transport::SseSender;pub use producer::AgentSession;pub use producer::EventProducer;pub use producer::MessageStream;pub use producer::ThinkingMessageStream;pub use producer::ThinkingStep;pub use producer::ToolCallStream;
Modules§
- error
- Error types for AG-UI server operations.
- event
- AG-UI Event Types
- patch
- JSON Patch utilities for AG-UI state delta generation.
- producer
- Event producer API for emitting AG-UI events.
- state
- AG-UI State Management
- transport
- Transport Layer for AG-UI Events
- types
- AG-UI Protocol Types
Structs§
- Activity
Delta Event - Event containing an incremental activity update.
- Activity
Message - An activity message for tracking agent activities.
- Activity
Snapshot Event - Event containing a complete activity snapshot.
- AgentId
- AgentId: A newtype used to prevent mixing it with other ID values.
- Assistant
Message - An assistant message (from the AI model).
- Base
Event - Base event structure for all AG-UI protocol events.
- Base
Message - A basic message with optional string content.
- Binary
Input Content - Binary input content for multimodal messages.
- Content
Validation Error - Error type for content validation failures.
- Context
- Context information provided to an agent.
- Custom
Event - Event for custom application-specific data.
- Developer
Message - A developer message, typically for debugging purposes. Not to be confused with system messages.
- Function
Call - A generated function call from a model.
- Interrupt
Info - Information about a run interrupt.
- Message
Id - MessageId: A newtype used to prevent mixing it with other ID values.
- Messages
Snapshot Event - Event containing a complete snapshot of all messages.
- RawEvent
- Event containing raw data from the underlying provider.
- RunAgent
Input - Input for running an agent.
- RunError
Event - Event indicating that a run has encountered an error.
- RunFinished
Event - Event indicating that a run has finished.
- RunId
- RunId: A newtype used to prevent mixing it with other ID values.
- RunStarted
Event - Event indicating that a run has started.
- State
Delta Event - Event containing incremental state updates as JSON Patch operations.
- State
Manager - A helper for managing state and generating deltas.
- State
Snapshot Event - Event containing a complete state snapshot.
- Step
Finished Event - Event indicating that a step has finished.
- Step
Started Event - Event indicating that a step has started.
- System
Message - A system message, usually containing the system prompt.
- Text
Input Content - Text input content for messages.
- Text
Message Chunk Event - Event containing a chunk of text message content.
- Text
Message Content Event - Event containing a piece of text message content.
- Text
Message EndEvent - Event indicating the end of a text message.
- Text
Message Start Event - Event indicating the start of a text message.
- Thinking
EndEvent - Event indicating that a thinking step has ended.
- Thinking
Start Event - Event indicating that a thinking step has started.
- Thinking
Text Message Content Event - Event containing a piece of thinking text message content.
- Thinking
Text Message EndEvent - Event indicating the end of a thinking text message.
- Thinking
Text Message Start Event - Event indicating the start of a thinking text message.
- Thread
Id - ThreadId: A newtype used to prevent mixing it with other ID values.
- Tool
- A tool definition describing a function the model can call.
- Tool
Call - A tool call made by an assistant.
- Tool
Call Args Event - Event containing tool call arguments.
- Tool
Call Chunk Event - Event containing a chunk of tool call content.
- Tool
Call EndEvent - Event indicating the end of a tool call.
- Tool
Call Id - A tool call ID.
- Tool
Call Result Event - Event containing the result of a tool call.
- Tool
Call Start Event - Event indicating the start of a tool call.
- Tool
Message - A tool message containing the result of a tool/function call.
- Typed
State Manager - A typed state manager for custom state types.
- User
Message - A user message from the human user.
Enums§
- AgUi
Error - Errors that can occur in AG-UI core operations.
- Event
- Union of all possible events in the Agent User Interaction Protocol.
- Event
Type - Event types for the AG-UI protocol.
- Event
Validation Error - Validation errors for AG-UI protocol events.
- Input
Content - Input content union type for multimodal messages.
- Json
Value - Represents any valid JSON value.
- Message
- Represents the different types of messages in a conversation.
- Role
- Message role indicating the sender type.
- RunFinished
Outcome - Outcome of a run finishing.
Traits§
- Agent
State - Marker trait for types that can represent agent state.
- FwdProps
- Marker trait for types that can be forwarded as props to UI components.
Functions§
- diff_
states - Computes the difference between two JSON states as a JSON Patch.