Expand description
Reading a RunAgentInput out of the request.
AgUiInput is a plain axum extractor, so an agent mounted by
route_agui and a hand-written handler that
needs to look at the request first (auth, tenant routing, a
Path segment naming which agent to run) parse the
body exactly the same way.
use ag_ui::axum::AgUiInput;
use axum::Router;
use axum::extract::Path;
use axum::routing::post;
async fn handler(Path(agent): Path<String>, AgUiInput(input): AgUiInput) -> String {
format!("{agent} runs thread {}", input.thread_id)
}
let app: Router = Router::new().route("/agents/{agent}", post(handler));Every failure is a 4xx carrying a message that names the problem — see
Error. Nothing here can panic on a hostile body: the size cap is axum’s
DefaultBodyLimit, and past that it is
serde_json on a &[u8].
Structs§
- AgUi
Input - The AG-UI run request, extracted from a JSON body.
Functions§
- decode
- Parses a
RunAgentInputfrom raw JSON bytes.