Skip to main content

Crate syncable_ag_ui_server

Crate syncable_ag_ui_server 

Source
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§

ActivityDeltaEvent
Event containing an incremental activity update.
ActivityMessage
An activity message for tracking agent activities.
ActivitySnapshotEvent
Event containing a complete activity snapshot.
AgentId
AgentId: A newtype used to prevent mixing it with other ID values.
AssistantMessage
An assistant message (from the AI model).
BaseEvent
Base event structure for all AG-UI protocol events.
BaseMessage
A basic message with optional string content.
BinaryInputContent
Binary input content for multimodal messages.
ContentValidationError
Error type for content validation failures.
Context
Context information provided to an agent.
CustomEvent
Event for custom application-specific data.
DeveloperMessage
A developer message, typically for debugging purposes. Not to be confused with system messages.
FunctionCall
A generated function call from a model.
InterruptInfo
Information about a run interrupt.
MessageId
MessageId: A newtype used to prevent mixing it with other ID values.
MessagesSnapshotEvent
Event containing a complete snapshot of all messages.
RawEvent
Event containing raw data from the underlying provider.
RunAgentInput
Input for running an agent.
RunErrorEvent
Event indicating that a run has encountered an error.
RunFinishedEvent
Event indicating that a run has finished.
RunId
RunId: A newtype used to prevent mixing it with other ID values.
RunStartedEvent
Event indicating that a run has started.
StateDeltaEvent
Event containing incremental state updates as JSON Patch operations.
StateManager
A helper for managing state and generating deltas.
StateSnapshotEvent
Event containing a complete state snapshot.
StepFinishedEvent
Event indicating that a step has finished.
StepStartedEvent
Event indicating that a step has started.
SystemMessage
A system message, usually containing the system prompt.
TextInputContent
Text input content for messages.
TextMessageChunkEvent
Event containing a chunk of text message content.
TextMessageContentEvent
Event containing a piece of text message content.
TextMessageEndEvent
Event indicating the end of a text message.
TextMessageStartEvent
Event indicating the start of a text message.
ThinkingEndEvent
Event indicating that a thinking step has ended.
ThinkingStartEvent
Event indicating that a thinking step has started.
ThinkingTextMessageContentEvent
Event containing a piece of thinking text message content.
ThinkingTextMessageEndEvent
Event indicating the end of a thinking text message.
ThinkingTextMessageStartEvent
Event indicating the start of a thinking text message.
ThreadId
ThreadId: A newtype used to prevent mixing it with other ID values.
Tool
A tool definition describing a function the model can call.
ToolCall
A tool call made by an assistant.
ToolCallArgsEvent
Event containing tool call arguments.
ToolCallChunkEvent
Event containing a chunk of tool call content.
ToolCallEndEvent
Event indicating the end of a tool call.
ToolCallId
A tool call ID.
ToolCallResultEvent
Event containing the result of a tool call.
ToolCallStartEvent
Event indicating the start of a tool call.
ToolMessage
A tool message containing the result of a tool/function call.
TypedStateManager
A typed state manager for custom state types.
UserMessage
A user message from the human user.

Enums§

AgUiError
Errors that can occur in AG-UI core operations.
Event
Union of all possible events in the Agent User Interaction Protocol.
EventType
Event types for the AG-UI protocol.
EventValidationError
Validation errors for AG-UI protocol events.
InputContent
Input content union type for multimodal messages.
JsonValue
Represents any valid JSON value.
Message
Represents the different types of messages in a conversation.
Role
Message role indicating the sender type.
RunFinishedOutcome
Outcome of a run finishing.

Traits§

AgentState
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.