ag-ui 0.3.0

A Rust SDK for the AG-UI protocol: protocol types and wire encoding, a server runtime for hosting an agent, and a client runtime for consuming one. Working toward becoming the official AG-UI Rust SDK; not affiliated with the AG-UI protocol organisation today.
Documentation
//! Additional context handed to an agent alongside the messages.

use serde::{Deserialize, Serialize};

/// One piece of ambient context for a run.
///
/// Contexts are free-form label/value pairs — the current page a user is on,
/// a selected record, a feature flag — that the agent may fold into its prompt
/// without them appearing as conversation messages.
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
pub struct Context {
    /// What this value is, in words the model can use.
    pub description: String,
    /// The value itself, already rendered to a string.
    pub value: String,
}

impl Context {
    /// Builds a context entry.
    pub fn new(description: impl Into<String>, value: impl Into<String>) -> Self {
        Self {
            description: description.into(),
            value: value.into(),
        }
    }
}