pub struct AsyncTaskRunner { /* private fields */ }Expand description
Handle used by tools to submit background work.
Cheap to clone (just an mpsc::Sender); one is placed in every
ToolContext. The matching Receiver lives on the Agent, which select!s
on it alongside user input.
Implementations§
Source§impl AsyncTaskRunner
impl AsyncTaskRunner
Sourcepub fn new(done_tx: Sender<AsyncTaskDone>) -> Self
pub fn new(done_tx: Sender<AsyncTaskDone>) -> Self
Create a runner wired to the Agent’s done channel.
Sourcepub fn submit(
&self,
tool_call_id: String,
session_id: SessionId,
tool_name: String,
work: AsyncTaskWork,
cancel: CancellationToken,
) -> String
pub fn submit( &self, tool_call_id: String, session_id: SessionId, tool_name: String, work: AsyncTaskWork, cancel: CancellationToken, ) -> String
Spawn work as a background task and return its task_id immediately.
The caller (the tool’s execute) should return a ToolResult::pending
placeholder using this task_id. When work resolves - or cancel is
triggered - the result is sent to the Agent for reinjection.
If the Agent has exited, done_tx.send fails silently and the result is
dropped (side effects like saved files already happened).
Trait Implementations§
Source§impl Clone for AsyncTaskRunner
impl Clone for AsyncTaskRunner
Source§fn clone(&self) -> AsyncTaskRunner
fn clone(&self) -> AsyncTaskRunner
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for AsyncTaskRunner
impl RefUnwindSafe for AsyncTaskRunner
impl Send for AsyncTaskRunner
impl Sync for AsyncTaskRunner
impl Unpin for AsyncTaskRunner
impl UnsafeUnpin for AsyncTaskRunner
impl UnwindSafe for AsyncTaskRunner
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