pub struct Todos { /* private fields */ }Expand description
Gives the agent a todo_write tool and keeps the current list in view (Todos).
The tool persists the list to the agent’s app state under the state key; every
reminder_interval model calls, counted from the call that last showed the list, the plugin
re-renders it as a <system-reminder>. Sharing one instance across agents is safe: the list
lives in per-agent state, not on the plugin.
One agent takes one Todos. The tool is always named todo_write, so registering a second
instance fails no matter how name and state_key are set.
A reminder changes the tail of the request it is sent with. On a provider without explicit
cache points that moves the cached prefix boundary, so a lower reminder_interval trades cache
hits and tokens for a fresher list.
Implementations§
Source§impl Todos
impl Todos
Sourcepub fn new(config: TodosConfig) -> Self
pub fn new(config: TodosConfig) -> Self
The plugin with config.
Sourcepub fn todo_write_tool(&self) -> FunctionTool
pub fn todo_write_tool(&self) -> FunctionTool
The todo_write tool, writing to state_key.
Trait Implementations§
Source§impl Plugin for Todos
impl Plugin for Todos
Source§fn init_agent<'life0, 'life1, 'async_trait>(
&'life0 self,
agent: &'life1 mut LocalAgent,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn init_agent<'life0, 'life1, 'async_trait>(
&'life0 self,
agent: &'life1 mut LocalAgent,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn get_tools(&self) -> Vec<ToolSource>
fn get_tools(&self) -> Vec<ToolSource>
init_agent:
anything that converts into a ToolSource, such as vec![MyTool.into()]. An MCP client
is rejected; pass it to the agent’s tools instead.Auto Trait Implementations§
impl Freeze for Todos
impl RefUnwindSafe for Todos
impl Send for Todos
impl Sync for Todos
impl Unpin for Todos
impl UnsafeUnpin for Todos
impl UnwindSafe for Todos
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<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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