Complete contract template
Copy this template as a starting point for your own agent.Contract definition
Create acontract.yaml file in your agent directory:
Required fields
name: str
The name of your agent contract.
install_cmd: str
Command to install the agent and its dependencies. Runs once during sandbox setup with the working directory set to /bundle/<agent_name>/.
run_cmd: str
Shell command to run the agent on a task. Must contain the {problem_statement_path} placeholder. Placeholders are substituted at runtime:
Optional fields
final_output: path
Absolute path to the final output to collect. The artifact found here will be copied into the corresponding S3 bucket at benchmark/benchmark_id/task_id/. Can be a directory or a file (copied as a tar).
output_artifacts: list
Small files to upload directly from the sandbox into the task’s S3 folder without adding them to agent_output.tar.gz. Use this for parser/evaluation inputs that need cheap direct reads.
String entries are shorthand: tracker reads /tmp/valkyrie/<path> and uploads to <path>.
Producers can write files under /tmp/valkyrie:
{task_id} and shell-style glob patterns resolved inside the sandbox:
required: false for best-effort telemetry that must not change the task result when it is missing or cannot be uploaded:
artifacts/model.patch is reserved for an optional validated text diff produced by
repository-editing agents. A trajectory artifact may reference it through
extra.vals.model_patch; Valkyrie still collects it as a separate artifact.
Valkyrie does not require a specific destination prefix. Vals-hosted result ingestion expects vals_format/config.json and vals_format/result.json.
Guardrails:
- Artifact destination paths are relative to the task’s S3 prefix. String entries use the same path under
/tmp/valkyrie; object entries use their explicitsource. - Object
sourcepaths must be absolute sandbox paths. Glob sources must include a non-root directory prefix such as/logsor/app/results/.... - String entries and object entries without
required: falseare required. Missing files, unresolved glob sources, validation failures, size-limit failures, download failures, and upload failures fail the task clearly. - Optional artifacts are skipped and logged when collection fails. They are intended for non-scoring telemetry; their absence never changes the task result.
- Individual files cannot exceed 50 MiB.
- At most 10 output artifacts can be declared.
- The total uploaded sidecar bytes per task cannot exceed 50 MiB.
task_0 in run run_id uploads to matching task-scoped keys such as:
egress_allowlist: list
URLs the agent may reach while run_cmd is running. Use this to allow model provider requests while denying other outbound requests from the agent sandbox; the sandbox provider resolves each host into its network rules at run time.
These rules only apply while the agent command runs. They help keep evaluations clean, but they are not a hard block against data leaks: egress is restored after run_cmd, root agents can change sandbox host files, and CDN hosts can share allowed edge IPs with other services.
secrets: dict
Secrets required by the agent. Maps environment variable names to AWS Secrets Manager secret names. These are resolved at sandbox creation time - raw values are never stored.
kwargs: dict
Define typed parameters with defaults that get substituted into run_cmd:
Kwargs are resolved at parse time:
- Defaults are applied for any kwarg the user doesn’t provide
- CLI overrides (
-k) replace defaults when provided - Required kwargs without a value raise a validation error
Model selection
The model is passed separately from kwargs via--model on the CLI:
Installation scripts
Theinstall_cmd runs inside the sandbox with the working directory set to /bundle/<agent_name>/. Use it to install dependencies and set up your agent.
Example setup.sh:
Wrapper scripts
If your agent requires a virtual environment or specific setup before running, create a wrapper script in/usr/local/bin/ during installation:
Creating a CLI
In order for valkyrie to pass in the required CLI arguments to your agent, the agent must accept CLI arguments. If your agent currently does not have a CLI, you can use this example to add it/bundle/<agent_name>/ in the sandbox (contract.yaml will be excluded).
Integrations
- Docent ingestion — set
ingest_lambdaincontract.yamlto declare which AWS Lambda converts this agent’s output into Docent records. Run it after a run finishes withvalkyrie run analyze <run-id>. See Analyze runs with Docent.