Skip to main content
Valkyrie runs any agent that has a command-line entry point. To package yours, add a 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

Put contract.yaml at the top of the agent’s directory:
contract.yaml
Valkyrie fills in {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
When the agent needs a virtual environment, have setup.sh write a wrapper on PATH, so run_cmd can call it by name:
setup.sh
See 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:
Then map the environment variable your agent reads to that reference under 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
Use each one in 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
See Output files for what required does, globs, and size limits.

Report why the agent failed

When the agent fails, write a one-line reason to the file named by VALKYRIE_ERROR_PATH and exit with a nonzero code. The reason then appears in the task’s error:
See Error reports for the format and limits.

Test it on one task

Upload the agent and run it on one task:
If the task fails, 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.