Expand description
The low-level API: start a run, get its events.
RemoteAgent adds almost nothing to Transport — a request builder, and
a stream that flattens connecting into streaming. That is the point. Anything
that wants the events as they were sent — a proxy, a recorder, a bridge to
another protocol, a test — should stay at this level.
For a UI, Session sits on top of this and does the
assembling.
use ag_ui::client::{HttpAgent, RunParams};
use futures_util::StreamExt;
let agent = HttpAgent::builder("https://example.com/agent")
.header("authorization", "Bearer …")
.build()?;
let mut events = agent.run(
RunParams::new("thread-1", "run-1").user("msg-1", "What is the weather?"),
);
while let Some(event) = events.next().await {
println!("{:?}", event?.event_type());
}Structs§
- Http
Agent Builder - Builds an
HttpAgent: base URL, headers, timeouts. - Remote
Agent - A remote agent, over any
Transport. - RunParams
- What to send when starting a run.
Type Aliases§
- Http
Agent - An agent reached over HTTP.