Expand description
The human-in-the-loop round trip.
A run does not only succeed or fail. It can pause: the agent finishes with
an interrupt outcome, listing what it
needs a human to decide, and the conversation continues when the client
sends the answers back in RunAgentInput::resume.
That round trip is the whole reason RUN_FINISHED carries an outcome, and
this module is the client half of it. With a Thread it
is two calls:
let mut thread = Thread::<_>::new(transport, "thread-1");
let mut pending = Vec::new();
let mut run = thread.send("delete the staging database").unwrap();
while let Some(update) = run.next().await {
if let Update::Interrupt(interrupt) = update {
pending.push(interrupt);
}
}
drop(run);
// Ask the human, then answer the agent.
let mut resumed = thread.resume(&pending[0], serde_json::json!({ "approved": true })).unwrap();
while resumed.next().await.is_some() {}Without one — a proxy, or anything driving crate::client::RemoteAgent directly —
interrupts_of finds the interrupts on the event and resume_run
builds the next request.
Structs§
- Resume
Builder - Answering interrupts, one call per decision.
Traits§
- Interrupt
Ext - Answering one interrupt, on the interrupt itself.
Functions§
- interrupts_
of - The interrupts a
RUN_FINISHEDpaused on, or an empty slice for any other event. - resume_
run - Builds the request that resumes a paused run.