Skip to main content

syncable_ag_ui_core/
lib.rs

1//! AG-UI Core Types
2//!
3//! This crate provides the core type definitions for the AG-UI (Agent-User Interaction)
4//! protocol. It includes event types, message structures, state management primitives,
5//! and error handling for building AG-UI compatible agents.
6//!
7//! # Overview
8//!
9//! AG-UI is an event-based protocol that standardizes how AI agents communicate with
10//! user-facing applications. This crate provides:
11//!
12//! - **Event types**: All ~25 AG-UI protocol event types (text messages, tool calls, state, etc.)
13//! - **Message types**: Structured message formats for agent-user communication
14//! - **State management**: State snapshots and JSON Patch delta operations
15//! - **Error handling**: Comprehensive error types for protocol operations
16//!
17//! # Usage
18//!
19//! ```rust,ignore
20//! use ag_ui_core::{Event, Result};
21//! ```
22
23pub mod error;
24pub mod event;
25pub mod patch;
26pub mod state;
27pub mod types;
28
29// Re-export key types for convenience
30pub use error::{AgUiError, Result};
31
32/// Re-export serde_json::Value for consistent JSON handling across the crate
33pub use serde_json::Value as JsonValue;
34
35// Re-export all types at crate root for convenient access
36pub use types::*;
37
38// Re-export state traits and helpers
39pub use state::{diff_states, AgentState, FwdProps, StateManager, TypedStateManager};
40
41// Re-export event types
42pub use event::{
43    // Foundation types
44    BaseEvent, Event, EventType, EventValidationError,
45    // Text message events
46    TextMessageChunkEvent, TextMessageContentEvent, TextMessageEndEvent, TextMessageStartEvent,
47    // Thinking text message events
48    ThinkingTextMessageContentEvent, ThinkingTextMessageEndEvent, ThinkingTextMessageStartEvent,
49    // Tool call events
50    ToolCallArgsEvent, ToolCallChunkEvent, ToolCallEndEvent, ToolCallResultEvent,
51    ToolCallStartEvent,
52    // Thinking step events
53    ThinkingEndEvent, ThinkingStartEvent,
54    // State events
55    MessagesSnapshotEvent, StateDeltaEvent, StateSnapshotEvent,
56    // Activity events
57    ActivityDeltaEvent, ActivitySnapshotEvent,
58    // Special events
59    CustomEvent, RawEvent,
60    // Run lifecycle events
61    InterruptInfo, RunErrorEvent, RunFinishedEvent, RunFinishedOutcome, RunStartedEvent,
62    // Step events
63    StepFinishedEvent, StepStartedEvent,
64};