Skip to main content

Module agent

Module agent 

Source
Expand description

Autonomous Agent Runtime (perceive-reason-act loop).

Implements a sovereign agent that uses local LLM inference (realizar), RAG retrieval (trueno-rag), and persistent memory (trueno-db) — all running locally with zero API dependencies.

§Architecture

AgentManifest (TOML)
  → PERCEIVE: recall memories
  → REASON:   LlmDriver.complete()
  → ACT:      Tool.execute()
  → repeat until Done or guard triggers

§Toyota Production System Principles

  • Jidoka: LoopGuard stops on ping-pong, budget, max iterations
  • Poka-Yoke: Capability system prevents unauthorized tool access
  • Muda: CostCircuitBreaker prevents runaway spend
  • Genchi Genbutsu: Default sovereign — local hardware, no proxies

§References

  • arXiv:2512.10350 — Geometric dynamics of agentic loops
  • arXiv:2501.09136 — Agentic RAG survey
  • arXiv:2406.09187 — GuardAgent safety

Re-exports§

pub use capability::capability_matches;
pub use capability::Capability;
pub use guard::LoopGuard;
pub use guard::LoopVerdict;
pub use manifest::AgentManifest;
pub use manifest::AutoPullError;
pub use manifest::ModelConfig;
pub use manifest::ResourceQuota;
pub use memory::InMemorySubstrate;
pub use phase::LoopPhase;
pub use pool::AgentId;
pub use pool::AgentMessage;
pub use pool::AgentPool;
pub use pool::MessageRouter;
pub use pool::SpawnConfig;
pub use pool::ToolBuilder;
pub use result::AgentError;
pub use result::AgentLoopResult;
pub use result::DriverError;
pub use result::StopReason;
pub use result::TokenUsage;

Modules§

capability
Capability-based access control for agent tools.
code
Public entry point for apr code / batuta code.
contracts
Design-by-Contract verification harness.
driver
LLM driver abstraction.
guard
Loop guard — prevents runaway agent loops (Jidoka pattern).
manifest
Agent manifest configuration.
memory
Memory substrate — agent persistent state.
phase
Agent loop phase tracking.
pool
Multi-agent orchestration pool.
repl
Interactive REPL for apr code.
result
Agent loop result and error types.
runtime
Agent runtime — the core perceive-reason-act loop.
session
Session persistence for apr code.
signing
Ed25519 manifest signing and verification.
tool
Tool system for agent actions.
tui
Agent TUI Dashboard

Structs§

AgentBuilder
Ergonomic builder for constructing and running agent loops.