pub struct SubagentHandle {
pub id: String,
pub agent_name: String,
pub task_preview: String,
pub model: String,
pub system_prompt: String,
pub started_at: Instant,
pub timeout_secs: u64,
/* private fields */
}Fields§
§id: String§agent_name: String§task_preview: String§model: String§system_prompt: String§started_at: Instant§timeout_secs: u64Implementations§
Source§impl SubagentHandle
impl SubagentHandle
Sourcepub fn new(
id: String,
agent_name: String,
task_preview: String,
model: String,
system_prompt: String,
timeout_secs: u64,
state: Arc<RwLock<SubagentState>>,
steer_tx: Option<UnboundedSender<String>>,
shutdown_tx: Option<Sender<()>>,
result_rx: Option<Receiver<SubagentResult>>,
) -> Self
pub fn new( id: String, agent_name: String, task_preview: String, model: String, system_prompt: String, timeout_secs: u64, state: Arc<RwLock<SubagentState>>, steer_tx: Option<UnboundedSender<String>>, shutdown_tx: Option<Sender<()>>, result_rx: Option<Receiver<SubagentResult>>, ) -> Self
Construct a new handle. The state Arc is shared with the spawned subagent thread.
Sourcepub fn status(&self) -> SubagentStatus
pub fn status(&self) -> SubagentStatus
Current status snapshot.
Sourcepub fn partial_output(&self) -> String
pub fn partial_output(&self) -> String
Partial output accumulated so far.
Sourcepub fn conversation_state(&self) -> Vec<Value>
pub fn conversation_state(&self) -> Vec<Value>
Snapshot of conversation state (for resume).
Sourcepub fn elapsed_secs(&self) -> f64
pub fn elapsed_secs(&self) -> f64
Seconds since this handle was created.
Sourcepub fn steer(&self, message: &str) -> Result<(), String>
pub fn steer(&self, message: &str) -> Result<(), String>
Send a steering message into the running subagent.
Sourcepub fn set_thread_handle(&mut self, handle: JoinHandle<()>)
pub fn set_thread_handle(&mut self, handle: JoinHandle<()>)
Signal the subagent to shut down. Store the OS thread handle for graceful shutdown.
pub fn cancel(&mut self)
Sourcepub fn is_finished(&self) -> bool
pub fn is_finished(&self) -> bool
True if the subagent is no longer running.
Sourcepub async fn collect(self) -> Result<SubagentResult, String>
pub async fn collect(self) -> Result<SubagentResult, String>
Consume the handle and wait for the final result.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SubagentHandle
impl !RefUnwindSafe for SubagentHandle
impl Send for SubagentHandle
impl Sync for SubagentHandle
impl Unpin for SubagentHandle
impl UnsafeUnpin for SubagentHandle
impl !UnwindSafe for SubagentHandle
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.