Skip to content

How to run an agent on a task

To run an agent on a specific task, use the viv run command.

A simple example

For example, to run the modular-public agent on the reverse-hash example task:

# Clone the modular-public example agent
cd ..
git clone https://github.com/poking-agents/modular-public
cd vivaria

# Use the `viv run` command to run the agent on reverse_hash
viv run reverse_hash/abandon --task-family-path task-standard/examples/reverse_hash --agent-path ../modular-public

Running your own agent and task

There are two ways to run agents on tasks, depending on if your Vivaria instance has Git support set up or not.

Upload your task and agent directly to Vivaria

This works whether or not your Vivaria instance has Git support, and is the method used in our example above.

viv run general/count-odds --task-family-path path/to/general --agent-path path/to/my-agent-repo

Vivaria will create two zip files, one containing the task code in the folder path/to/general and another containing the agent in path/to/my-agent-repo. It'll upload both zip files to Vivaria, which will start a task environment based on the task code and run the agent in it.

Push your agent to a Git remote

This only works if your Vivaria instance has Git support.

cd path/to/my-agent-repo
viv run general/count-odds

Vivaria will commit and push any uncommitted agent changes from your computer to your Git hosting service. Then, it'll look up the task general/count-odds in your Vivaria instance's tasks Git repo, start a task environment based on that task, and run your agent in it.

Other features

Run viv run --help to see a full list of flags for viv run.

Intervention mode

You can use viv run <task> -i (or --intervention) to enable human input on certain agent actions, if the agent code supports this by calling the rate_options or get_input functions from pyhooks.