Skip to main content

Evaluation

Use evaluate() when the Program is already fixed.

Basic usage

from cartpole import CartPoleBenchmark
from evopolicygym import EvaluationConfig, Program, evaluate
from evopolicygym.execution import ProcessExecution

result = evaluate(
Program.from_directory("my-policy/"),
CartPoleBenchmark(),
execution=ProcessExecution.unsafe(),
config=EvaluationConfig(
split="validation",
episodes=100,
seed=42,
episode_timeout_seconds=30,
),
)

print(result.feedback.score)

evaluate() accepts one Program, one structural Benchmark, an explicit execution selection, and an optional EvaluationConfig.

EvaluationConfig

ParameterDefaultMeaning
split"validation"Benchmark-defined Episode split.
episodes1Positive number of Episodes.
seed0Unsigned 64-bit seed for Episode planning.
episode_timeout_seconds30.0Positive timeout for each Episode.

The Benchmark must return exactly the requested number of Episodes. Planning must be deterministic for the same split, seed, and count.

EvaluationResult

FieldMeaning
benchmark_idPublic Benchmark identity.
environment_digestIdentity of the public Environment parameters.
program_digestIdentity of the evaluated Program.
feedbackBenchmark-defined score, public content, and artifacts.
episodesSanitized public Episode summaries.

Episode summaries contain status, total reward, step count, and an optional Policy failure code. They do not contain scenarios, Environment seeds, Host paths, credentials, or private metrics.

Episode behavior

Each Episode receives a fresh Environment, Policy process, Policy instance, and scratch directory. Policy state may persist only between act() calls in that Episode.

Policy failures produce sanitized failed Episode summaries. Environment, Benchmark, execution, and cleanup faults abort the Evaluation.

Local process execution

ProcessExecution.unsafe() is not a sandbox. The Policy runs with your operating-system user permissions.

Next