Expand description
Manager bundle — capability traits and runtime infrastructure for agent loops.
Two categories of types govern how agent loops interact with their infrastructure:
§Capability Traits
Capability traits are composable interfaces that represent distinct
infrastructure concerns. Each trait describes a single ability —
observing lifecycle events, detecting loops, falling back to alternate
models, etc. The LoopManagers struct implements all capability traits,
providing a concrete, all-in-one infrastructure bundle.
| Trait | Purpose |
|---|---|
Observable | Emit lifecycle events to registered observers |
Detectable | Detect repetitive loops and convergence |
FallbackCapable | Circuit-breaker fallback to alternate models |
Compactable | Automatic context compaction when tokens exceed |
StreamCapable | Resilient streaming with retries and timeouts |
Hookable | Bidirectional hooks that can block actions |
PipelineAware | Dispatch tools through a middleware pipeline |
HealthTrackable | Per-tool health tracking with circuit breakers |
§LoopManagers
LoopManagers is the framework’s default infrastructure bundle.
It bundles all managers, observers, hooks, and middleware into a single
struct that can be passed to any agent loop implementation:
LoopManagers
├── ObserverHost → Observable
├── DetectionManager → Detectable
├── FallbackManager → FallbackCapable
├── Option<ContextManager> → Compactable
├── Option<StreamHandler> → StreamCapable
├── Option<HookExecutor> → Hookable
├── Option<ToolPipeline> → PipelineAware
└── Option<ToolHealthReg> → HealthTrackable§Design Philosophy
The trait hierarchy separates what the managers can do (capability
traits) from how it’s composed (the LoopManagers struct). This
allows:
- Generic programming — agent loops can be written against
impl Observable + Detectablerather than a concrete type. - Testing — swap
LoopManagersfor a stub that implements only the traits under test.
let managers = LoopManagers::new()
.with_fallback(FallbackManager::for_model("llm-70b"))
.with_detection(DetectionManager::default())
.with_observer(Arc::new(logging_observer));
let agent = BareLoop::new_with_managers(client, tools, config, managers);Every capability is optional. A bundle with no .with_*() calls still
works — it just has no observers, no hooks, no pipeline, etc. This means
you only pay for (and configure) the infrastructure you actually use.
Re-exports§
pub use crate::capabilities::*;
Structs§
- Loop
Managers - The framework’s default infrastructure bundle for agent loops.