Skip to main content

Module server

Module server 

Source
Expand description

AG-UI Server Integration

This module provides the AG-UI protocol server for syncable-cli, enabling frontend applications to connect and receive real-time updates as the agent works.

§Architecture

Frontend (tanstack)
    ↓ SSE/WebSocket
AgUiServer (this module)
    ↓ Event Bridge
Agent (ToolDisplayHook)
    ↓
LLM Provider (OpenAI/Anthropic/Bedrock)

§Usage

use syncable_cli::server::{AgUiServer, AgUiConfig};

// Start the AG-UI server
let config = AgUiConfig::default().port(9090);
let server = AgUiServer::new(config);
let event_sender = server.event_sender();

// Run server in background
tokio::spawn(server.run());

// In agent code, emit events
let bridge = server.event_bridge();
bridge.start_run().await;
let tool_id = bridge.start_tool_call("analyze", &args).await;
bridge.emit_text_chunk("Processing...").await;
bridge.end_tool_call(&tool_id).await;
bridge.finish_run().await;

Re-exports§

pub use bridge::EventBridge;
pub use processor::AgentProcessor;
pub use processor::ProcessorConfig;
pub use processor::ThreadSession;

Modules§

bridge
Event Bridge - Converts agent events to AG-UI protocol events.
processor
Agent Processor - Routes frontend messages to agent for processing.
routes
HTTP Routes for AG-UI Server

Structs§

AgUiConfig
Configuration for the AG-UI server.
AgUiServer
The AG-UI server that enables frontend connectivity.
AgentMessage
Message from frontend to agent processor. Wraps RunAgentInput with optional response channel for acknowledgments.
Context
Context information provided to an agent.
RunAgentInput
Input for running an agent.
ServerState
Shared state for the AG-UI server.
Tool
A tool definition describing a function the model can call.

Enums§

AgUiMessage
Represents the different types of messages in a conversation.