Skip to main content

Module state

Module state 

Source
Expand description

State Reconstruction

This module provides utilities for reconstructing agent state from AG-UI event streams. It handles state snapshots and delta updates.

§Example

use ag_ui_client::{StateReconstructor, SseClient};
use futures::StreamExt;

let client = SseClient::connect("http://localhost:3000/events").await?;
let mut stream = client.into_stream();
let mut state = StateReconstructor::new();

while let Some(event) = stream.next().await {
    let event = event?;
    state.apply_event(&event)?;
    println!("Current state: {:?}", state.current());
}

Structs§

StateReconstructor
Reconstructs agent state from AG-UI events.

Type Aliases§

StateResult
Result type alias for state operations.