pub struct EvalRunner { /* private fields */ }Expand description
Evaluation runner using Orchestrator directly
§Example
let runner = EvalRunner::new(scenario, runtime.handle().clone())
.with_runs(5)
.with_seed(42)
.with_task(SwarmTask::new("Find the auth handler"))
.with_manager_factory(|| Box::new(MyManager::new()))
.with_batch_invoker_factory(|| Box::new(MyInvoker::new()));
let report = runner.run()?;Implementations§
Source§impl EvalRunner
impl EvalRunner
pub fn new(scenario: EvalScenario, runtime: Handle) -> Self
Sourcepub fn with_verbose(self, verbose: bool) -> Self
pub fn with_verbose(self, verbose: bool) -> Self
Enable verbose output (print tick snapshots)
Sourcepub fn with_exploration(self, enable: bool) -> Self
pub fn with_exploration(self, enable: bool) -> Self
Enable ExplorationSpace tracking
Sourcepub fn with_dependency_graph(self, graph: DependencyGraph) -> Self
pub fn with_dependency_graph(self, graph: DependencyGraph) -> Self
Set dependency graph for action sequencing
The graph defines valid action transitions and terminal conditions. When set, actions will be filtered based on the graph structure.
Sourcepub fn with_learning_store(self, path: impl AsRef<Path>) -> Self
pub fn with_learning_store(self, path: impl AsRef<Path>) -> Self
Sourcepub fn with_train_trigger(self, trigger: Arc<dyn TrainTrigger>) -> Self
pub fn with_train_trigger(self, trigger: Arc<dyn TrainTrigger>) -> Self
Set TrainTrigger for Learning
Controls when offline learning is executed after eval runs. Default: Learn after every run (if learning_store is configured).
§Example
use swarm_engine_core::learn::CountTrigger;
// Run learning after every 5 eval iterations
runner.with_train_trigger(Arc::new(CountTrigger::new(5)))Sourcepub fn skip_learned_action_order(self, skip: bool) -> Self
pub fn skip_learned_action_order(self, skip: bool) -> Self
Skip learned action order from offline model
When enabled, the learned dependency graph (action_order) from the offline model will not be applied. This is useful for testing without learned priors.
Sourcepub fn with_trace_subscriber(self, subscriber: Arc<dyn TraceSubscriber>) -> Self
pub fn with_trace_subscriber(self, subscriber: Arc<dyn TraceSubscriber>) -> Self
Set trace subscriber for ActionEvent output
The subscriber will receive all ActionEvents during evaluation. Use InMemoryTraceSubscriber to collect events and dump them after evaluation, or JsonlTraceSubscriber for real-time output.
§Example
use std::sync::Arc;
use swarm_engine_core::events::InMemoryTraceSubscriber;
let trace = Arc::new(InMemoryTraceSubscriber::new());
runner.with_trace_subscriber(trace.clone());
// ... run evaluation ...
trace.dump_to_file("trace.jsonl")?;Sourcepub fn with_scenario_profile(self, profile: ScenarioProfile) -> Self
pub fn with_scenario_profile(self, profile: ScenarioProfile) -> Self
Apply a ScenarioProfile to use learned exploration parameters and strategies
This converts the profile to an OfflineModel and applies it during execution. When set, the profile’s learned components (exploration params, strategy config, action order) will be used instead of defaults.
§Example
let store = ProfileStore::new("~/.swarm-engine/profiles")?;
let profile = store.load("troubleshooting")?;
runner.with_scenario_profile(profile);pub fn with_runs(self, runs: usize) -> Self
pub fn with_seed(self, seed: u64) -> Self
Sourcepub fn with_manager_factory<F>(self, factory: F) -> Self
pub fn with_manager_factory<F>(self, factory: F) -> Self
Set manager factory (creates new Manager for each run)
Sourcepub fn with_batch_invoker_factory<F>(self, factory: F) -> Self
pub fn with_batch_invoker_factory<F>(self, factory: F) -> Self
Set batch invoker factory (creates new BatchInvoker for each run)
Sourcepub fn with_extensions_factory<F>(self, factory: F) -> Self
pub fn with_extensions_factory<F>(self, factory: F) -> Self
Set extensions factory (creates new Extensions for each run)
Sourcepub fn with_operator_provider_factory<F>(self, factory: F) -> Self
pub fn with_operator_provider_factory<F>(self, factory: F) -> Self
Set OperatorProvider factory (creates new provider for each run)
Use this to configure the Selection strategy for exploration.
Default is AdaptiveProvider if not specified.
§Example
use swarm_engine_core::exploration::{HybridLlmProvider, ReviewPolicy};
use swarm_engine_llm::LlmStrategyAdvisor;
runner.with_operator_provider_factory(|| {
let advisor = LlmStrategyAdvisor::new(decider.clone(), handle.clone());
let policy = ReviewPolicy::default();
Box::new(HybridLlmProvider::new(advisor, policy))
})pub fn run(&self) -> Result<EvalReport>
Auto Trait Implementations§
impl Freeze for EvalRunner
impl !RefUnwindSafe for EvalRunner
impl Send for EvalRunner
impl Sync for EvalRunner
impl Unpin for EvalRunner
impl !UnwindSafe for EvalRunner
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more