contract.yaml next to its code that says how to install it, how to run it on one task,
and which files to keep. Every field is in the
contract reference.
Give the agent a command-line entry point
Valkyrie starts your agent with a shell command, so the agent must take its inputs as command-line arguments. If it doesn’t, add a small wrapper:run_agent.py
Write the contract
Putcontract.yaml at the top of the agent’s directory:
contract.yaml
{problem_statement_path}, {task_id}, and {model} before it runs
run_cmd. The command runs from the benchmark’s working directory, so call your script by
its full path under /bundle/AGENT_NAME/, where AGENT_NAME is the contract’s name.
The following sections cover secrets and defaults, and the reference lists when each field is used.
Install dependencies
install_cmd usually runs a setup script from the agent’s directory:
setup.sh
setup.sh write a wrapper on PATH, so
run_cmd can call it by name:
setup.sh
install_cmd field for its time limit and the files that
uploading leaves out.
Give the agent its API keys
Store each key as a secret of your organization. The command prompts for the value and prints the reference to use:secrets, as
in the preceding contract. Valkyrie sets the variable in each task’s sandbox. To use another
key for one run, pass -s ANTHROPIC_API_KEY other-key to valkyrie run start.
Let runs choose the model and settings
defaults.model is the parameter that --model sets, and required: true makes every run
pass one. Declare other settings under kwargs, and runs set them with -k:
contract.yaml
run_cmd as {temperature}. See Parameters
for the types and checks.
Keep more output files
final_output is saved as one archive. To keep files you can read without extracting it,
such as a trajectory or a summary, list them under output_artifacts:
contract.yaml
required does, globs, and
size limits.
Report why the agent failed
When the agent fails, write a one-line reason to the file named byVALKYRIE_ERROR_PATH
and exit with a nonzero code. The reason then appears in the task’s error:
Test it on one task
Upload the agent and run it on one task:valkyrie run errors RUN_ID shows why, and
valkyrie run logs RUN_ID shows the install and run output, where RUN_ID is the ID that
valkyrie run start printed. Fix the agent, run
valkyrie agent push again to replace it, and rerun the task with
valkyrie run retry RUN_ID.
To run the agent on benchmarks that start it several times per task, add
turns field.
