Skip to main content

Module plugin

Module plugin 

Source
Expand description

The Autumn plugin: registration, configuration, and the handler extractor.

Install with one line:

ⓘ
use autumn_plugin_agent::plugin::AgentPlugin;
use autumn_web::prelude::*;

#[autumn_web::main]
async fn main() {
    autumn_web::app()
        .plugin(AgentPlugin::new().configure(|config| {
            config.max_steps = 12;
        }))
        .run()
        .await;
}

The plugin declares the [agent] config section, registers the agent_run and agent_resume background jobs, installs a list_models health indicator, registers the heartbeat task when one is set, and builds the shared AgentRuntime in a startup hook. Handlers reach the agent through the AgentHandle extractor.

An always-on setup adds memory, sessions, a heartbeat, and a delivery:

ⓘ
use std::time::Duration;
use autumn_plugin_agent::plugin::AgentPlugin;
use autumn_plugin_agent::memory::InMemoryMemoryStore;
use autumn_plugin_agent::proactive::Heartbeat;

autumn_web::app()
    .plugin(
        AgentPlugin::new()
            .memory_store(InMemoryMemoryStore::default().shared())
            .heartbeat(Heartbeat::every(Duration::from_secs(1_800)).session("ops"))
            .followups(Duration::from_secs(24 * 3_600))
            .delivery(my_slack_delivery),
    )
    .run()
    .await;

Structs§

AgentHandle
Request extractor handing handlers a ready-to-run agent.
AgentPlugin
The plugin. Register it with AppBuilder::plugin.