attuned-http 1.0.0

HTTP reference server for Attuned
Documentation

attuned-http

HTTP reference server for Attuned.

This crate provides a ready-to-use HTTP server exposing the Attuned API. It includes health checks, metrics, and OpenAPI documentation.

Endpoints

  • POST /v1/state - Upsert state (patch semantics, optionally with inference)
  • GET /v1/state/{user_id} - Get latest state
  • GET /v1/context/{user_id} - Get PromptContext
  • DELETE /v1/state/{user_id} - Delete state
  • POST /v1/infer - Infer axes from message text (requires "inference" feature)
  • GET /health - Health check
  • GET /metrics - Prometheus metrics

Features

  • inference - Enable automatic inference from message text. Adds the /v1/infer endpoint and allows the /v1/state endpoint to accept a message field for automatic axis inference.

Example

use attuned_http::{Server, ServerConfig};
use attuned_store::MemoryStore;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let store = MemoryStore::default();
    let config = ServerConfig::default();

    let server = Server::new(store, config);
    server.run().await?;
    Ok(())
}

With Inference

use attuned_http::{Server, ServerConfig};
use attuned_store::MemoryStore;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let store = MemoryStore::default();
    let config = ServerConfig::default().with_inference();

    let server = Server::new(store, config);
    server.run().await?;
    Ok(())
}