pub struct AgentHandle {
pub input_tx: Sender<AgentInput>,
pub state_rx: Receiver<AgentRunState>,
pub cancel_token: CancellationToken,
}Expand description
Handle to a persistent agent thread.
Returned by AgentLoop::run_persistent. Allows the caller to send
new messages to the running agent and cancel execution.
Fields§
§input_tx: Sender<AgentInput>Send new messages to the running agent. The agent processes them as new user turns once it parks between turns.
Only AgentInput::Text and AgentInput::Message are supported on
this channel — they are the only variants that represent a fresh user
turn. Injecting AgentInput::Resume, AgentInput::SubmitToolResults,
or AgentInput::Continue ends the run with AgentRunState::Error
(those belong to the single-turn run_turn flow, not the persistent
loop). Dropping the sender ends the run cleanly with Done.
state_rx: Receiver<AgentRunState>Final run state (sent once when the agent completes).
cancel_token: CancellationTokenCancel the running agent.
Auto Trait Implementations§
impl !RefUnwindSafe for AgentHandle
impl !UnwindSafe for AgentHandle
impl Freeze for AgentHandle
impl Send for AgentHandle
impl Sync for AgentHandle
impl Unpin for AgentHandle
impl UnsafeUnpin for AgentHandle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more