pub struct RunStoreBackend { /* private fields */ }Expand description
The SubagentBackend of a host without a kernel: runs go straight to the run store,
and steering to the runners it was given.
It holds its runners weakly and clones share them, so a runner whose agent carries the
sub-agent tools can be added after the host it reaches is built
(add_runner).
§Example
use std::sync::Arc;
use adk_core::InMemoryRunStore;
use adk_server::background::RunStoreBackend;
let backend = RunStoreBackend::new(Arc::new(InMemoryRunStore::new()));
// Build the host over `Arc::new(backend.clone())`, the agents over the host, then:
// backend.add_runner(&runner);Implementations§
Source§impl RunStoreBackend
impl RunStoreBackend
Sourcepub fn new(runs: Arc<dyn DurableRunStore>) -> Self
pub fn new(runs: Arc<dyn DurableRunStore>) -> Self
A backend over runs that steers no turn.
Sourcepub fn with_runner(self, runner: &Arc<Runner>) -> Self
pub fn with_runner(self, runner: &Arc<Runner>) -> Self
Steers the turns runner runs: the parents’ and the sub-agents’.
Sourcepub fn add_runner(&self, runner: &Arc<Runner>)
pub fn add_runner(&self, runner: &Arc<Runner>)
Steers the turns runner runs, from now on; every clone of this backend sees it.
Trait Implementations§
Source§impl Clone for RunStoreBackend
impl Clone for RunStoreBackend
Source§impl Debug for RunStoreBackend
impl Debug for RunStoreBackend
Source§impl SubagentBackend for RunStoreBackend
impl SubagentBackend for RunStoreBackend
Source§fn enqueue_subagent<'life0, 'life1, 'async_trait>(
&'life0 self,
run: NewRun,
_launch: &'life1 SubagentLaunch,
) -> Pin<Box<dyn Future<Output = Result<RunRecord>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn enqueue_subagent<'life0, 'life1, 'async_trait>(
&'life0 self,
run: NewRun,
_launch: &'life1 SubagentLaunch,
) -> Pin<Box<dyn Future<Output = Result<RunRecord>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Enqueues a run of sub-agent
launch: its first, or a follow-up. Read moreSource§fn enqueue_notice<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
run: NewRun,
_child: &'life1 RunRecord,
_launch: &'life2 SubagentLaunch,
) -> Pin<Box<dyn Future<Output = Result<RunRecord>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn enqueue_notice<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
run: NewRun,
_child: &'life1 RunRecord,
_launch: &'life2 SubagentLaunch,
) -> Pin<Box<dyn Future<Output = Result<RunRecord>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Enqueues the run of the parent’s session that tells it about
child, a run of
sub-agent launch. Read moreSource§fn steer<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
app_name: &'life1 str,
user_id: &'life2 str,
session_id: &'life3 str,
text: &'life4 str,
) -> Pin<Box<dyn Future<Output = Result<Option<SteerReceipt>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn steer<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
app_name: &'life1 str,
user_id: &'life2 str,
session_id: &'life3 str,
text: &'life4 str,
) -> Pin<Box<dyn Future<Output = Result<Option<SteerReceipt>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Queues
text on the steering inbox of the turn of session session_id that runs
here, or None when none does. Read moreSource§fn cancel<'life0, 'life1, 'async_trait>(
&'life0 self,
run_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn cancel<'life0, 'life1, 'async_trait>(
&'life0 self,
run_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Cancels run
run_id: at once when it is queued or parked, at its next checkpoint
when it runs. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for RunStoreBackend
impl !UnwindSafe for RunStoreBackend
impl Forget for RunStoreBackend
impl Freeze for RunStoreBackendwhere
*const ArcInner<dyn DurableRunStore> is !null: Freeze,
PhantomData<ArcInner<dyn DurableRunStore>>: Freeze,
*const ArcInner<RwLock<Vec<Weak<Runner>>>> is !null: Freeze,
PhantomData<ArcInner<RwLock<Vec<Weak<Runner>>>>>: Freeze,
impl Move for RunStoreBackend
impl Send for RunStoreBackend
impl Sync for RunStoreBackend
impl Unpin for RunStoreBackend
impl UnsafeUnpin for RunStoreBackendwhere
*const ArcInner<dyn DurableRunStore> is !null: UnsafeUnpin,
PhantomData<ArcInner<dyn DurableRunStore>>: UnsafeUnpin,
*const ArcInner<RwLock<Vec<Weak<Runner>>>> is !null: UnsafeUnpin,
PhantomData<ArcInner<RwLock<Vec<Weak<Runner>>>>>: UnsafeUnpin,
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
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> ⓘ
Converts
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> ⓘ
Converts
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