Skip to main content

Crate harness_loop

Crate harness_loop 

Source
Expand description

ReAct agent loop with self-correction.

Minimal v0.0.1 implementation:

  • Applies guides once at the start.
  • Sends Context (with tools) to the model.
  • Dispatches each returned tool call via ToolRegistry.
  • Runs Sensor::SelfCorrect sensors after each action; auto-fix patches are applied directly to the world, blocking signals are fed back to the model.
  • Stops when the model returns no tool calls, or when policy.max_iters is hit.

Re-exports§

pub use learning::*;
pub use memory_layer::*;
pub use profile_guide::*;
pub use recall_layer::*;
pub use registry::*;
pub use replay::*;
pub use subagent::*;
pub use telemetry::*;

Modules§

learning
Self-evolving learning loop for crate::AgentLoop.
memory_layer
Long-term-memory wiring for crate::AgentLoop.
profile_guide
Opt-in Guide that renders harness_core::UserProfile into the agent’s system prompt.
recall_layer
Cross-session recall wiring for crate::AgentLoop.
registry
A tiny name-keyed tool registry used by AgentLoop.
replay
Session record + replay (DESIGN.md §15 v0.2+).
subagent
Subagent: an isolated agent loop spawned from a parent.
telemetry
TelemetryHook — maps the agent’s lifecycle Event stream onto structured tracing spans and events, so a run becomes observable in any tracing subscriber.

Structs§

AgentLoop
The agent loop.
CompactPolicy
Governs when and how far the loop compacts context. Hysteresis: only start compacting once usage crosses high_water, and stop as soon as it’s back under target — instead of running every stage above a threshold on every turn. This avoids over-compacting (needlessly reaching the lossy, main-model AutoCompact stage) and, because compaction rewrites history and invalidates the provider prefix cache, avoids nibbling the context every single turn.
Session
A persistent multi-turn conversation over one AgentLoop.
StuckPolicy
Governs the loop’s stuck-detector. When the model repeats the same tool call (name + args) round after round without making progress, the loop first nudges it to change approach, then terminates cleanly with Outcome::Stuck rather than burning the rest of the budget spinning on a loop.

Enums§

Outcome
Where a run finished. Each variant is #[non_exhaustive] so new fields don’t break downstream matches — always include .. when destructuring.

Functions§

apply_patches
Apply auto-fix patches; return short descriptions of those that succeeded.
is_default_safe_fix
Audit #7: default safelist for FixPatch::RunCommand.