enact-runner
Robust agent loop runner for Enact — retries, compaction, multi-format parsing.
What Is This?
enact-runner is the "missing middle" between the apps (cli, api) and enact-core's deterministic kernel. It implements the robust agent loop mandated by the technical specs but never built.
Quick Start
use ;
// Default config (max 25 iterations, compaction at 40 messages)
let mut runner = default_new
.add_tool
.add_tool;
let outcome = runner.run.await?;
match outcome
Presets
// Short interactive sessions (10 iterations, 2 min timeout)
let config = interactive;
// Long-running background agents (100 iterations, 1 hour timeout)
let config = long_running;
Features
| Feature | Description |
|---|---|
| Multi-format parsing | Parses tool calls from JSON, XML, and Markdown |
| Retry with backoff | Exponential backoff for rate-limits and transient errors |
| Error classification | Distinguishes retryable (rate-limit, network) from fatal (auth, invalid) |
| Auto-compaction | Summarizes older messages when history exceeds threshold |
| Checkpointing | Saves state at configurable intervals |
| Cancel/Pause | Delegates to enact-core::Runner for cancel/pause signals |
| Stream events | Emits StreamEvents for real-time observability |
Module Structure
src/
├── lib.rs # Module root + re-exports
├── config.rs # RunnerConfig, RetryConfig, presets
├── loop_driver.rs # AgentRunner::run() — the core loop
├── parser.rs # Multi-format tool call parsing
├── compaction.rs # Auto context summarization
└── retry.rs # Error classification + backoff
tests/
└── integration.rs # Full loop integration tests
Testing
# All tests (31 total)
# Only integration tests
# Specific test