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.
custom_agents
Custom subagent discovery from project-level markdown files.
driver
LLM driver abstraction.
guard
Loop guard — prevents runaway agent loops (Jidoka pattern).
hooks
Hook system for apr code — mirrors Claude Code’s hook events.
manifest
Agent manifest configuration.
memory
Memory substrate — agent persistent state.
org_policy
Managed organisation policy loader (Claude-Code parity).
permission
Permission modes for apr code (Claude-Code parity).
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.
skill
User-invocable + auto-loadable skill definitions (Claude-Code parity).
status_line
REPL status line renderer (Claude-Code parity).
task_tool
Task tool — Claude-Code Agent-equivalent for typed sub-agent delegation.
tool
Tool system for agent actions.
tui
Agent TUI Dashboard
worktree
Git worktree isolation for subagents (Claude-Code parity).

Structs§

AgentBuilder
Ergonomic builder for constructing and running agent loops.