1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
//! 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
//!
//! ```rust,ignore
//! 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;
//! }
//! ```
//!
//! ```toml
//! # autumn.toml
//! [agent]
//! provider = "openai-compatible"
//! model = "gpt-4o-mini"
//! ```
//!
//! ```sh
//! export AGENT_API_KEY="sk-..."
//! ```
//!
//! # Module map
//!
//! | Module | Contents |
//! |--------|----------|
//! | [`config`] | Layered `[agent]` configuration; secrets stay in the env |
//! | [`error`] | `AgentError` + `ErrorKind` + HTTP status mapping |
//! | [`client`] | `LlmClient` trait and both provider implementations |
//! | [`tools`] | `Tool` trait and the handler-function adapter |
//! | [`agent`] | The agent loop, budgets, approvals, and `AgentRuntime` |
//! | [`hooks`] | Lifecycle hooks around model and tool calls |
//! | [`policy`] | Per-call allow / ask / deny decisions |
//! | [`loop_guard`] | Repeated-call detection |
//! | [`session`] | Persisted transcripts and compaction |
//! | [`memory`] | Bounded memory blocks and the `memory` tool |
//! | [`skills`] | `SKILL.md` skills and the `load_skill` tool |
//! | [`delegate`] | Subagents as tools |
//! | [`proactive`] | Heartbeats, follow-ups, and delivery |
//! | [`jobs`] | The `agent_run` / `agent_resume` background jobs |
//! | [`ids`] | `RunId` and `SessionId` |
//! | [`plugin`] | `AgentPlugin` registration and the `AgentHandle` extractor |
//! | [`health`] | Provider health indicator for `/actuator/health` |
pub use ;
pub use ;
pub use ;
pub use AgentTool;
pub use ;
pub use AgentHealthIndicator;
pub use ;
pub use ;
pub use ;
pub use LoopGuard;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use Skill;
pub use ;