pub struct DurableSubagents { /* private fields */ }Expand description
Background sub-agents as durable runs (see the module docs).
Cheap to clone: clones share one host.
Implementations§
Source§impl DurableSubagents
impl DurableSubagents
Sourcepub fn new(
runs: Arc<dyn DurableRunStore>,
sessions: Arc<dyn SessionService>,
backend: Arc<dyn SubagentBackend>,
config: SubagentConfig,
) -> Self
pub fn new( runs: Arc<dyn DurableRunStore>, sessions: Arc<dyn SessionService>, backend: Arc<dyn SubagentBackend>, config: SubagentConfig, ) -> Self
A host whose sub-agents run on runs, in sessions of sessions, through backend.
Sourcepub fn config(&self) -> &SubagentConfig
pub fn config(&self) -> &SubagentConfig
The host’s configuration.
Sourcepub fn downgrade(&self) -> WeakSubagents
pub fn downgrade(&self) -> WeakSubagents
A handle on this host that does not keep it alive, for a tool built before the host’s owner — a kernel — exists.
Sourcepub async fn run_finished(&self, run: &RunRecord)
pub async fn run_finished(&self, run: &RunRecord)
Tells sub-agent run’s parent that the run finished, when it should be told; call
it after the store recorded the run’s outcome. SubagentHooks::on_finish does.
Sourcepub async fn run_parked(&self, run: &RunRecord)
pub async fn run_parked(&self, run: &RunRecord)
Reports a sub-agent run parked, and tells a parent turn in flight that it waits
for a person. SubagentHooks::on_park calls it.
Sourcepub async fn run_claimed(&self, run: &RunRecord)
pub async fn run_claimed(&self, run: &RunRecord)
Reports sub-agent run started running. SubagentHooks::on_claim calls it.
Sourcepub async fn reconcile(&self) -> Result<usize>
pub async fn reconcile(&self) -> Result<usize>
Tells every parent about finished runs of its sub-agents it was not told about: a
host that stopped between a run’s end and the notice — a crash, kill -9 — catches
up here. It looks at runs that finished within
SubagentConfig::reconcile_window, leaves cancelled runs out, and tells a parent by
a keyed run of its session only, never by steering a turn, so a notice already
queued is not delivered twice. Returns how many finished runs it looked at.
§Errors
The store’s error.
Trait Implementations§
Source§impl Clone for DurableSubagents
impl Clone for DurableSubagents
Source§impl Debug for DurableSubagents
impl Debug for DurableSubagents
Source§impl SubagentHost for DurableSubagents
impl SubagentHost for DurableSubagents
Source§fn start<'life0, 'async_trait>(
&'life0 self,
start: SubagentStart,
) -> Pin<Box<dyn Future<Output = Result<SubagentRecord>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn start<'life0, 'async_trait>(
&'life0 self,
start: SubagentStart,
) -> Pin<Box<dyn Future<Output = Result<SubagentRecord>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn get<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
scope: &'life1 SubagentScope,
id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<SubagentRecord>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
scope: &'life1 SubagentScope,
id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<SubagentRecord>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§fn list<'life0, 'life1, 'async_trait>(
&'life0 self,
scope: &'life1 SubagentScope,
) -> Pin<Box<dyn Future<Output = Result<Vec<SubagentRecord>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list<'life0, 'life1, 'async_trait>(
&'life0 self,
scope: &'life1 SubagentScope,
) -> Pin<Box<dyn Future<Output = Result<Vec<SubagentRecord>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
scope started, oldest first. Read moreSource§fn send<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
scope: &'life1 SubagentScope,
id: &'life2 str,
message: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<FollowUp>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn send<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
scope: &'life1 SubagentScope,
id: &'life2 str,
message: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<FollowUp>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
message to sub-agent id: to its running turn’s steering inbox when one
runs, as its next run otherwise — also after it finished, which continues its
session. Read moreSource§fn cancel<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
scope: &'life1 SubagentScope,
id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<SubagentRecord>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn cancel<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
scope: &'life1 SubagentScope,
id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<SubagentRecord>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
id: a queued or parked run ends at once, a running one at its
next checkpoint. Its parent is not told about a cancellation it asked for. Read moreSource§fn targets(&self) -> Vec<SubagentTarget>
fn targets(&self) -> Vec<SubagentTarget>
Auto Trait Implementations§
impl !RefUnwindSafe for DurableSubagents
impl !UnwindSafe for DurableSubagents
impl Forget for DurableSubagents
impl Freeze for DurableSubagents
impl Move for DurableSubagents
impl Send for DurableSubagents
impl Sync for DurableSubagents
impl Unpin for DurableSubagents
impl UnsafeUnpin for DurableSubagents
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more