Skip to main content

EvalRunner

Struct EvalRunner 

Source
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

Source

pub fn new(scenario: EvalScenario, runtime: Handle) -> Self

Source

pub fn with_verbose(self, verbose: bool) -> Self

Enable verbose output (print tick snapshots)

Source

pub fn with_exploration(self, enable: bool) -> Self

Enable ExplorationSpace tracking

Source

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.

Source

pub fn with_action_events_path(self, path: impl Into<PathBuf>) -> Self

Set path to save action events (JSONL format)

When set, all action events will be saved to the specified path. Each run will append to a file with the run index suffix.

§Example
runner.with_action_events_path("./logs/events.jsonl")
// Creates: ./logs/events_run0.jsonl, ./logs/events_run1.jsonl, ...
Source

pub fn with_learning_store(self, path: impl AsRef<Path>) -> Self

Enable LearningStore for cross-session learning

When enabled, statistics will be saved after each run and loaded as prior for subsequent runs. This enables incremental learning across sessions.

§Example
runner.with_learning_store("~/.swarm-engine/learning")
Source

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)))
Source

pub fn with_runs(self, runs: usize) -> Self

Source

pub fn with_seed(self, seed: u64) -> Self

Source

pub fn with_task(self, task: SwarmTask) -> Self

Set the task to execute

Source

pub fn with_manager_factory<F>(self, factory: F) -> Self
where F: Fn() -> Box<dyn ManagerAgent> + Send + Sync + 'static,

Set manager factory (creates new Manager for each run)

Source

pub fn with_batch_invoker_factory<F>(self, factory: F) -> Self
where F: Fn() -> Box<dyn BatchInvoker> + Send + Sync + 'static,

Set batch invoker factory (creates new BatchInvoker for each run)

Source

pub fn with_extensions_factory<F>(self, factory: F) -> Self
where F: Fn() -> Extensions + Send + Sync + 'static,

Set extensions factory (creates new Extensions for each run)

Source

pub fn with_operator_provider_factory<F>(self, factory: F) -> Self
where F: Fn() -> Box<dyn OperatorProvider<NodeRules>> + Send + Sync + 'static,

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))
})
Source

pub fn run(&self) -> Result<EvalReport>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more