Skip to main content

Crate autumn_plugin_agent

Crate autumn_plugin_agent 

Source
Expand description

Provider-agnostic, always-on LLM agent harness for Autumn.

autumn-plugin-agent equips an Autumn app with tool-calling agents that speak to OpenAI-compatible endpoints (OpenAI, Ollama, vLLM) or the Anthropic Messages API — no heavyweight LLM SDK required.

Beyond one-shot runs, the crate has the primitives always-on agents share: persisted sessions with compaction, bounded memory, skills, approval gates with resumable state, lifecycle hooks, a loop guard, heartbeats on Autumn’s scheduler, agent-scheduled follow-ups, and a delivery channel.

§Quick start

ⓘ
use autumn_plugin_agent::plugin::{AgentHandle, AgentPlugin};
use autumn_plugin_agent::{FnTool, AgentError};
use autumn_web::prelude::*;
use std::sync::Arc;

async fn get_weather(input: serde_json::Value) -> Result<serde_json::Value, AgentError> {
    Ok(serde_json::json!({"temp_f": 72}))
}

#[autumn_web::main]
async fn main() {
    let weather = FnTool::new(
        "get_weather",
        "Current weather for a city.",
        serde_json::json!({"type": "object",
            "properties": {"city": {"type": "string"}},
            "required": ["city"]}),
        get_weather,
    )
    .shared();

    autumn_web::app()
        .plugin(AgentPlugin::new().tool(Arc::clone(&weather)))
        .run()
        .await;
}
# autumn.toml
[agent]
provider = "openai-compatible"
model = "gpt-4o-mini"
export AGENT_API_KEY="sk-..."

§Module map

ModuleContents
configLayered [agent] configuration; secrets stay in the env
errorAgentError + ErrorKind + HTTP status mapping
clientLlmClient trait and both provider implementations
toolsTool trait and the handler-function adapter
agentThe agent loop, budgets, approvals, and AgentRuntime
hooksLifecycle hooks around model and tool calls
policyPer-call allow / ask / deny decisions
loop_guardRepeated-call detection
sessionPersisted transcripts and compaction
memoryBounded memory blocks and the memory tool
skillsSKILL.md skills and the load_skill tool
delegateSubagents as tools
proactiveHeartbeats, follow-ups, and delivery
jobsThe agent_run / agent_resume background jobs
idsRunId and SessionId
pluginAgentPlugin registration and the AgentHandle extractor
healthProvider health indicator for /actuator/health

Re-exports§

pub use agent::Agent;
pub use agent::AgentOutcome;
pub use agent::AgentRuntime;
pub use agent::AgentTurn;
pub use agent::Approval;
pub use agent::ApprovalDecision;
pub use agent::BudgetKind;
pub use agent::PendingCall;
pub use agent::PendingStatus;
pub use agent::RunState;
pub use client::AnthropicClient;
pub use client::ChatMessage;
pub use client::ChatRequest;
pub use client::ChatResponse;
pub use client::ChatRole;
pub use client::ContentPart;
pub use client::LlmClient;
pub use client::OpenAiCompatibleClient;
pub use client::StopReason;
pub use client::TokenUsage;
pub use client::ToolDefinition;
pub use client::client_from_config;
pub use config::AgentConfig;
pub use config::ProviderKind;
pub use delegate::AgentTool;
pub use error::AgentError;
pub use error::ErrorKind;
pub use health::AgentHealthIndicator;
pub use hooks::AgentHooks;
pub use hooks::HookAction;
pub use hooks::RunInfo;
pub use hooks::ToolOutput;
pub use ids::RunId;
pub use ids::SessionId;
pub use jobs::AgentResumeArgs;
pub use jobs::AgentRunArgs;
pub use jobs::RunOrigin;
pub use jobs::enqueue_agent_resume;
pub use jobs::enqueue_agent_resume_tracked;
pub use jobs::enqueue_agent_run;
pub use jobs::enqueue_agent_run_in;
pub use jobs::enqueue_agent_run_tracked;
pub use loop_guard::LoopGuard;
pub use memory::InMemoryMemoryStore;
pub use memory::MemoryBlock;
pub use memory::MemoryOp;
pub use memory::MemoryScope;
pub use memory::MemoryStore;
pub use plugin::AgentHandle;
pub use plugin::AgentPlugin;
pub use policy::AllowAll;
pub use policy::Rule;
pub use policy::Strictest;
pub use policy::ToolDecision;
pub use policy::ToolPolicy;
pub use policy::ToolRules;
pub use proactive::Delivery;
pub use proactive::HEARTBEAT_OK;
pub use proactive::Heartbeat;
pub use proactive::LogDelivery;
pub use proactive::Report;
pub use proactive::ReportSource;
pub use session::Compaction;
pub use session::InMemorySessionStore;
pub use session::SessionStore;
pub use skills::Skill;
pub use tools::FnTool;
pub use tools::Tool;
pub use tools::ToolCall;
pub use tools::ToolContext;
pub use tools::ToolEffect;

Modules§

agent
The agent loop: prompt the model, run its tool calls, repeat.
client
Provider clients: one trait, two HTTP implementations.
config
Layered configuration for the agent plugin.
delegate
Subagents: run a whole Agent as one tool.
error
Error types for the agent plugin.
health
Health indicator for the agent plugin.
hooks
Lifecycle hooks: code that runs at fixed points of the agent loop.
ids
Strongly typed identifiers for runs and sessions.
jobs
Background runs on Autumn’s job queue.
loop_guard
Loop detection: stop an agent that repeats the same tool call.
memory
Bounded memory blocks the agent curates itself.
plugin
The Autumn plugin: registration, configuration, and the handler extractor.
policy
Tool policies: decide, per call, whether the agent may act.
proactive
Always-on behaviour: heartbeats, follow-ups, and delivery.
session
Sessions: persisted conversations that outlive one run.
skills
Skills: reusable instructions the agent loads on demand.
tools
Tools: the functions an agent may call.