Autonomic
Homeostasis controller — three-pillar regulation for operational, cognitive, and economic stability.
Autonomic
Autonomic is the homeostasis controller for the Agent OS. It regulates agent behavior across three pillars -- operational, cognitive, and economic -- ensuring agents remain stable and resource-efficient without constant human oversight.
The biological analog is the autonomic nervous system: always running in the background, maintaining equilibrium, and intervening only when something drifts out of range.
Design principles
Advisory, not authoritarian. Arcan consults Autonomic before taking actions, but failures are non-fatal. If Autonomic is unreachable, the agent continues with an allow-all default. Regulation never blocks the core agent loop.
Pure controller. The controller logic contains no I/O and no side effects. The homeostatic state is a deterministic fold over the event history -- given the same events, you always get the same state projection. This makes the controller fully testable without mocks.
Hysteresis gates. Mode transitions require a metric to exceed a threshold AND remain there for a minimum duration. This prevents rapid oscillation ("flapping") when metrics hover near boundaries.
Architecture
| Crate | Role |
|---|---|
autonomic-core | Homeostatic state types, economic modes, hysteresis gate logic |
autonomic-controller | Pure evaluation engine -- RuleSet evaluation and state projection |
autonomic-lago | Bridge to Lago journal for event-driven state updates |
autonomic-api | HTTP API server (axum) on port 3002 |
autonomicd | Daemon binary |
Three pillars of regulation
Operational pillar
Monitors the runtime health of the agent system:
- Error rate -- ratio of failed operations to total operations. Tracked as a rolling window.
- Latency -- P50/P95/P99 response time for LLM provider calls
- Uptime -- continuous running time since last restart
- Resource pressure -- memory and storage consumption
When operational health degrades, Autonomic recommends more conservative behavior: simpler prompts, fewer tool calls, or switching to faster models.
Cognitive pillar
Monitors the quality of the agent's reasoning process:
- Context utilization -- percentage of the context window currently in use (0.0 to 1.0)
- Memory pressure -- rate of context growth relative to available space. Values:
normal,elevated,critical - Decision confidence -- self-assessed confidence scores from recent decisions
- Task completion rate -- ratio of tasks started to tasks completed successfully
High cognitive pressure triggers recommendations to reduce context consumption, summarize earlier conversation segments, or defer to the human for guidance.
Economic pillar
Monitors the agent's financial resources:
- Budget remaining -- credits or funds available for operations
- Burn rate -- current spending rate extrapolated to hourly/daily rates
- Revenue inflow -- income from completed tasks (if Haima is active)
- Runway -- projected time until budget exhaustion at current burn rate
The economic pillar drives the economic mode, which is the most visible output of Autonomic's regulation.
Economic modes
The EconomicMode enum is defined in autonomic-core:
pub enum EconomicMode {
/// Balance > 2x monthly burn. Full autonomy.
Sovereign,
/// 1-2x monthly burn. Prefer cheaper models, limit expensive tools.
Conserving,
/// 0-1x monthly burn. Cheapest model only, no expensive tools.
Hustle,
/// Balance <= 0. Skip LLM calls, heartbeats only.
Hibernate,
}| Mode | Trigger | Behavior |
|---|---|---|
| Sovereign | Budget > 2x monthly burn | All operations allowed, premium models available, speculative research permitted |
| Conserving | Budget 1-2x monthly burn | Prefer cheaper models, reduce speculative work, warn on expensive operations |
| Hustle | Budget 0-1x monthly burn | Prioritize revenue-generating tasks, minimize costs, use cheapest viable models |
| Hibernate | Budget at zero | Only essential operations, cheapest models only, no tool use except critical paths, skip LLM calls |
Hysteresis gates
Mode transitions use hysteresis to prevent flapping. Each transition has an entry threshold, an exit threshold, and a minimum hold duration:
Entry Exit
Sovereign ───────── 2.0x ──── (always sovereign above 2x)
│ │
│ Below 2.0x for 5min │ Above 2.0x for 5min
▼ │
Conserving ───────── 1.0x ──── 2.0x
│ │
│ Below 1.0x for 5min │ Above 1.0x for 5min
▼ │
Hustle ──────────── 0.0x ──── 1.0x
│ │
│ Below 0.0x for 5min │ Above 0.0x for 5min
▼ │
Hibernate ────────────────────────The gap between entry and exit thresholds prevents oscillation when the budget is near a boundary. The 5-minute hold duration ensures that brief spikes or dips do not trigger mode changes.
RuleSet evaluation
The RuleSet is a collection of HomeostaticRule trait objects in autonomic-controller. Each rule is a pure function that evaluates the current homeostatic state and returns a set of recommendations:
pub struct RuleSet {
rules: Vec<Box<dyn HomeostaticRule>>,
}Rules are evaluated independently. Their outputs are combined into a GatingProfile that represents the consensus of all rules.
Gating profiles
The primary output of Autonomic is a GatingProfile -- a map of operation types to allow/warn/block decisions:
{
"profile": "conserving",
"gates": {
"expensive_model": "warn",
"cheap_model": "allow",
"tool_execution": "allow",
"web_search": "allow",
"file_write": "allow",
"speculative_research": "block",
"long_context": "warn"
}
}Arcan reads this profile during its regulation phase and adjusts its behavior:
| Decision | Effect |
|---|---|
| allow | Operation proceeds normally |
| warn | Operation proceeds but is logged as potentially wasteful |
| block | Operation is denied; the agent is told why and asked to choose an alternative |
The gating profile changes dynamically as the homeostatic state evolves. Each gating decision is recorded in the Lago journal as an autonomic.gate_triggered event.
Running Autonomic
cd autonomic
cargo run -p autonomicd
# Listening on http://localhost:3002With Lago persistence for durable state:
cargo run -p autonomicd -- --lago-data-dir ./autonomic-dataAPI endpoints
| Endpoint | Method | Description |
|---|---|---|
/v1/autonomic/state | GET | Full homeostatic state projection (three-pillar) |
/v1/autonomic/gating | GET | Current gating profile |
/v1/autonomic/health | GET | Service health check |
Integration with Arcan
During the regulation phase of the agent loop (after reconstructing state, before the LLM call), Arcan sends:
GET http://localhost:3002/v1/autonomic/gatingIf the request succeeds, the gating profile governs what operations are available for that tick. If it fails, Arcan logs a warning and uses an allow-all default. This ensures the core agent loop is never blocked by Autonomic unavailability.
Event persistence
Autonomic events use EventKind::Custom with an "autonomic." prefix in the Lago journal. This enables forward-compatible persistence -- new event types can be added without schema migrations:
| Event | Description |
|---|---|
autonomic.mode_changed | Economic mode transition (e.g., Sovereign -> Conserving) |
autonomic.gate_triggered | A gating decision was made (operation, decision, reason) |
autonomic.state_snapshot | Periodic state checkpoint (full three-pillar state) |
The controller logic is fully deterministic. You can replay Lago events through the controller and get the exact same gating decisions. This is critical for debugging agent behavior -- you can understand exactly why the agent was blocked from a particular operation by replaying the economic event history.