Skip to main content

Configuration

Experiment configuration lives in a hive.yaml file that you pass explicitly to hive create exp -c hive.yaml.

Field reference

Below, we document the fields that can be specified in a configuration YAML.

Top level fields

  • apiversion (string, default: v1alpha1)
    Configuration schema version.
  • experiment_name (string, required)
    Name of the experiment. Must be a valid DNS label ([a-z0-9-], max 63 characters, no leading -). If it ends with -, a random suffix is appended for uniqueness.

repo

Repository configuration for the experiment source code.
  • source (string)
    Where the experiment source code comes from. Can be:
    • A remote git URL — https://, ssh://, or git@.
    • A local directory path (absolute or relative; ~ and environment variables are expanded). The directory is uploaded directly, so you can run experiments on uncommitted local changes.
    If omitted (null), no source is uploaded — the base image must already contain the code at the sandbox workdir.
  • files (list of strings, default: [])
    Files and directories to include from source. An empty list includes everything. Patterns are applied in order; prefix an entry with ! to exclude. Globs (*, ?, […]) are supported. Hidden files and symlinks are skipped.
  • branch (string, default: main)
    Branch to use when cloning a remote source.
  • evaluation_script (string, default: evaluation.py)
    Script that evaluates experiment results (path relative to repo root).
  • evaluation_arguments (list, default: [])
    Splits the evaluation into a multi-evaluator, with one entry per evaluator. Each entry is passed to evaluation_script as its command-line arguments. Write a single value for one argument, or a list for several. Requires aggregation_script.
  • aggregation_script (string, default: null)
    Script that combines the per-evaluator results into the experiment’s final result, and the test evaluator results into the test result. Only valid together with evaluation_arguments or test_evaluation_arguments. See multi-evaluator.
  • test_evaluation_arguments (list, default: null)
    Defines a held-out test set using the same format and execution model as evaluation_arguments. Versions which the Hive found during evolution are also evaluated on this test set, but test fitness is for reporting only and doesn’t affect evolution. If you provide multiple entries, you must also set aggregation_script. See held-out evaluation.
  • target_code (list of strings, default: [])
    Code for agents to evolve. Must be a YAML list — see file list syntax.
    An empty list allows the Hive to evolve any file in the specified codebase (except for the evaluation script). Prefix an entry ! to exclude it from evolution, e.g.,
    allows the Hive to evolve any file except for fixed.py and the evaluation script.
  • additional_context (list of strings, default: [])
    Additional files to include as context. Must be a YAML list — see file list syntax.
The clone happens client-side. For private repos, consider using SSH (e.g. git@github.com:<org>/<repo>.git).

File list syntax

The target_code and additional_context fields must be YAML lists. Each entry is a file path with an optional line range:

Multi-evaluator

By default a single evaluator produces the fitness. Setting evaluation_arguments splits the evaluation into several sub-evaluators that run concurrently on the available sandboxes, and an aggregation_script combines their results. This is useful when the objective decomposes into independent pieces (e.g. slices of a dataset, or several benchmarks) that can be scored in parallel.
One reason to reach for a multi-evaluator is GPU provisioning. A single large allocation such as a100-80gb:8 is far slower to schedule than eight separate a100-80gb:1 sandboxes. Splitting the evaluation across many small single-GPU sandboxes provisions much faster than requesting one big multi-GPU sandbox.
How it works:
  1. For each entry in evaluation_arguments, the Hive runs evaluation_script with those arguments. Each sub-evaluator emits the usual final-line JSON: {"status": "success", "result": {"fitness": ...}} on success, or {"status": "failed", "error": ...} on failure.
  2. The aggregation_script receives a single argument: the path to a JSON file holding the list of per-evaluator results, in evaluation_arguments order. Failed evaluators appear in that list too, so the aggregator must check each status field.
  3. The aggregation script’s own output follows the same contract as evaluation_script, and its fitness becomes the experiment’s fitness.
A typical aggregation script looks something like:
The sub-evaluators run in parallel across sandboxes, so set runtime.num_sandboxes high enough to realize the parallelism. A good rule of thumb is one sandbox per sub-evaluation times the number of parallel sub-evaluations.

Held-out evaluation (experimental)

Evolution optimizes whatever your evaluator measures. When that’s a sample of a wider set of inputs (a set of problem instances, a dataset split, a suite of scenarios), the evolution can overfit to the sample: versions get better on those exact inputs without getting better in general. Setting test_evaluation_arguments gives the experiment a held-out test set. As the evolution runs, the Hive picks some of the versions it has found (always including the most promising ones, plus a spread across the fitness range) and scores them on the held-out test set too, reporting that test fitness next to their fitness. The test fitness never guides the evolution: it isn’t used to pick parents, rank versions or write prompts, so it tells you two things:
  • Generalization: whether the evolved code improves on inputs it was never optimized for.
  • Evaluator quality: whether your evaluation is a good proxy, i.e. whether a better fitness actually means a better test fitness.
As an example, say you’re evolving a heuristic that schedules delivery routes, and your evaluator scores it on 50 days of historical orders. You have 50 more days, so you hold those back as the test set. With an evaluator that can take the held-out test set as an argument, the config is one extra line:
How it works:
  1. Each entry in test_evaluation_arguments runs evaluation_script with those arguments, exactly like an entry in evaluation_arguments, and emits the same final-line JSON.
  2. With a single entry, its fitness is the test fitness. With several, the aggregation_script combines them into one test result, just as it does for the multi-evaluator.
  3. Test evaluations share the experiment’s sandboxes. Use test_evaluation_config to choose how many, and how the versions to test are picked.
Held-out evaluation is experimental.

runtime

Controls experiment execution.
  • num_sandboxes (integer, default: 1)
    Number of parallel sandboxes to run. (Formerly num_agents, now deprecated but still accepted.)
  • max_runtime_seconds (integer, default: -1)
    Maximum execution time in seconds. -1 = unlimited.
  • max_iterations (integer, default: -1)
    Maximum number of iterations for the experiment. -1 = unlimited.
  • stochastic_evaluator (boolean, default: false)
    Whether the evaluator is stochastic. When true, the Hive accounts for evaluation noise by re-evaluating high-variance candidates so fitnesses can be compared reliably.

test_evaluation_config

How the held-out test set is evaluated. Only valid together with repo.test_evaluation_arguments — see held-out evaluation.
  • num_test_sandboxes (integer, default: 20% of runtime.num_sandboxes)
    Number of sandboxes given to test evaluation, at most runtime.num_sandboxes. Each test evaluation holds one sandbox per test_evaluation_arguments entry.
  • greedy_fraction (float, default: 0.5)
    Share of test evaluations spent on the best untested version, between 0 and 1. The rest are spread across the fitness range.

sandbox

Container environment configuration.
  • base_image (string, required)
    Docker base image (e.g. python:3.14-slim).
  • workdir (string, default: /app)
    Working directory inside the container.
  • setup_script (string, default: null)
    Shell script to run before the experiment starts (e.g. install dependencies). Omit or set to null if no setup is needed.
  • evaluation_timeout (integer, default: 60)
    Maximum time (seconds) for the evaluation script to run.
  • envs (list)
    Environment variables to set in the container. Each entry has a name and value:
  • services (list)
    Sidecar services to run alongside the sandbox. See sandbox.services below.
  • cpu_consistency (string, default: none)
    Whether every sandbox runs on the same CPU platform. Use this when your score depends on how fast the code runs.
    • required: every sandbox runs on one platform, and waits for capacity on it.
    • preferred: sandboxes run on one platform when it has capacity, and on others when it doesn’t.
    • none: sandboxes run on any platform.

sandbox.resources

  • cpu (string, default: "1")
    CPU limit (e.g. "2", "500m").
  • cpu_platform (string)
    CPU platform every sandbox runs on. Setting it implies cpu_consistency: required, so leave cpu_consistency unset or set it to required. You can’t set it together with accelerators, because the GPU instance type decides the CPU.
  • memory (string, default: "2Gi")
    Memory limit (e.g. "4Gi", "512Mi").
  • accelerators (string)
    GPU resources (e.g. a100-80gb:8).
  • shmsize (string)
    Size of /dev/shm (e.g. "1Gi"). You can’t set it together with accelerators. Data in /dev/shm counts toward the sandbox’s memory limit, so set memory large enough to hold it.

sandbox.services[]

Each entry defines a sidecar container that runs alongside the sandbox.
  • name (string, required)
    Service name.
  • image (string, required)
    Docker image for the service.
  • ports (list)
    Ports to expose. Each entry has a port (integer) and optional protocol (TCP or UDP, defaults to TCP).
  • envs (list)
    Environment variables (same format as sandbox.envs).
  • command (list of strings)
    Container entrypoint override.
  • args (list of strings)
    Arguments to the entrypoint.
  • resources.cpu (string, default: "1")
    CPU limit for this service.
  • resources.memory (string, default: "2Gi")
    Memory limit for this service.

provider.regions

  • regions (string or list of strings, default: us)
    Where the sandboxes run, and so where the experiment’s code and data are processed: us for only the US region, or all for every region. Setting all may help with GPU availability, since sandboxes can land on capacity in any region. Only set all if your code and data may leave the US.

prompt

Optional prompt configuration for the Hive agents. Omit this section entirely to use defaults.
  • context (string)
    Experiment-specific context to provide to agents.
  • ideas (list of strings)
    Ideas that will be randomly sampled and injected into the Hive.
  • attachments (list of strings, default: null) PDF reference material for agents. Accepts local PDF files, local directories, and PDF URLs.

PDF attachments

PDFs provide reference material for agents and are not included in candidate code.
Relative paths resolve from the directory where you run hive. Directories are searched recursively for PDFs. Each PDF can be up to 20 MiB. URLs must return a PDF. The CLI validates attachments before creating the experiment.

agents

Which agents generate new versions of your code. Omit this section to run the default preset, medium-effort. You can either specify a preset agent configuration, or choose a custom weighted list of models yourself.
  • preset (string)
    A preset tier of agents, by name. One of low-effort, medium-effort, or high-effort.
  • models (list)
    A custom ensemble of models. Each entry takes:
    • model (string, required) — The model to run. Run hive list models to see the names.
    • weight (float, default: 1) — How likely the model is to be used, relative to the rest of the ensemble. Must be greater than 0.
    Replace the placeholders with two model names from hive list models:
hive get exp <name> reports the ensemble an experiment was created with.

Full example

hive.yaml

Next steps

Managing experiments

Create, monitor, and manage your Hive experiments.