Skip to main content

AgentPlugin

Struct AgentPlugin 

Source
pub struct AgentPlugin { /* private fields */ }
Expand description

The plugin. Register it with AppBuilder::plugin.

ⓘ
autumn_web::app().plugin(AgentPlugin::new()).run().await;

Implementations§

Source§

impl AgentPlugin

Source

pub fn new() -> Self

Create the plugin with default configuration.

Defaults resolve from autumn.toml’s [agent] section and AGENT_* environment variables at startup; see AgentConfig.

Source

pub fn configure(self, configure: impl FnOnce(&mut AgentConfig)) -> Self

Tune the configuration in code. Runs after file and env loading, so values set here win over both.

Source

pub fn tool(self, tool: Arc<dyn Tool>) -> Self

Register one tool the agent may call.

Source

pub fn tools(self, tools: Vec<Arc<dyn Tool>>) -> Self

Register several tools at once.

Source

pub fn hook(self, hook: Arc<dyn AgentHooks>) -> Self

Add a lifecycle hook to every agent.

Source

pub fn policy(self, policy: Arc<dyn ToolPolicy>) -> Self

Decide per tool call whether agents may act. Defaults to allowing every call.

Source

pub fn session_store(self, store: Arc<dyn SessionStore>) -> Self

Persist session transcripts here. Defaults to an in-memory store, which loses sessions on restart.

Source

pub fn memory_store(self, store: Arc<dyn MemoryStore>) -> Self

Give agents persistent memory in this store.

Source

pub fn skill(self, skill: Skill) -> Self

Offer one skill to every agent.

Source

pub fn skills(self, skills: Vec<Skill>) -> Self

Offer several skills to every agent.

Source

pub const fn compaction(self, compaction: Compaction) -> Self

Summarize long session transcripts before a run.

Source

pub fn delivery(self, delivery: Arc<dyn Delivery>) -> Self

Where heartbeat, follow-up, and deliver job results go. Defaults to logging them.

Source

pub fn heartbeat(self, heartbeat: Heartbeat) -> Self

Wake the agent on a schedule. Registers the agent_heartbeat task.

Source

pub const fn followups(self, max_delay: Duration) -> Self

Give agents the schedule_followup tool, so they can book their own next run up to max_delay ahead.

Trait Implementations§

Source§

impl Debug for AgentPlugin

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for AgentPlugin

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Plugin for AgentPlugin

Source§

fn build(self, app: AppBuilder) -> AppBuilder

Wire the plugin into the app builder.

Declares the [agent] config section, registers the agent_run and agent_resume background jobs and the heartbeat task, adds the provider health indicator, and installs a startup hook that fails the boot fast when the config, the heartbeat, or the API key is unusable.

Source§

fn name(&self) -> Cow<'static, str>

Stable identifier used for duplicate-registration detection. Read more
Source§

fn route_group(&self) -> Cow<'static, str>

The route group of the routes this plugin adds (#3544). Read more
Source§

fn contract(&self) -> Option<PluginContract>

Declare which autumn-web versions this plugin supports, and any experimental surface it knowingly depends on. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P> Plugins for P
where P: Plugin,

Source§

fn apply(self, app: AppBuilder) -> AppBuilder

Apply every plugin in this bundle to the builder, in declaration order.
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Scoped for T
where T: Send + Sync + 'static,

Source§

fn scope(ctx: &PolicyContext) -> ScopeQuery<'_, Self>

Open a deferred ScopeQuery for this type. Resolves the registered scope at .load() time, not here.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more