Skip to content

About

Savant RL environments CLI

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

savantenvs

savantenvs runs the Savant environments your organization holds as Harbor tasks. It lists what you hold, pulls an environment's images from the registry, writes its Harbor task directory, and runs it with harbor run.

Install

Download the binary for your system from the latest release: savantenvs_linux_amd64, savantenvs_linux_arm64, savantenvs_darwin_amd64, savantenvs_darwin_arm64, savantenvs_windows_amd64.exe or savantenvs_windows_arm64.exe. Check it against the release's checksums.txt before you run it, then put it on your PATH:

sha256sum --check --ignore-missing checksums.txt   # macOS: shasum -a 256 --check --ignore-missing checksums.txt
install -m 755 savantenvs_linux_amd64 ~/.local/bin/savantenvs

savantenvs needs Docker. run also needs Harbor 0.22.0 or later, and a --backend kata task needs Linux with Kata Containers and /dev/kvm.

Log in

savantenvs login

This opens your browser to sign in, where you choose your organization. On a machine without a browser, such as one you reach over SSH, it prints a URL and a code to enter on another device. The CLI then gets a registry key named savantenvs on <host>, saves it in ~/.config/savantenvs/config.json, readable by you alone, and logs Docker in to the registry with it. The key appears on the Keys page with your organization's other keys, and you are emailed that it was issued. It expires after 90 days; run savantenvs login again then.

To use a key you already have, such as one issued on the Keys page:

savantenvs login --with-key < key.txt

In CI, set SAVANTENVS_API_KEY instead.

savantenvs logout forgets the saved key and logs Docker out. A key from browser sign-in is also revoked, since only this machine has it. A key you saved with --with-key keeps working until you revoke it on the Keys page, because others may use it too.

List, pull and run

savantenvs list                      # the environments you hold, and their newest tag
savantenvs pull ENV[:TAG]            # writes harbor-tasks/<task>/
savantenvs run ENV[:TAG] -- -a terminus-2 -m MODEL --env-file .env

savantenvs <command> --help lists each command's options, with examples. savantenvs completion zsh (or bash, fish, powershell) prints a completion script, which also completes the names of the environments you hold.

pull writes the task for Docker with the agent's tools as shell commands and a pass/fail reward, unless you choose otherwise: --backend kata, --interface mcp, --reward graded. The task includes the reference solution whenever the environment ships one, which harbor run -a oracle uses to check your setup; --no-solution leaves it out.

An exploit or patch task's prompt carries a bug report, by default the one the environment was built with. --context-level (adaptive, or 0 to 4 with an optional + or -) and --inhibit-vulnerability-description choose another, and --cybergym-level 0|1|2 chooses the report that approximates that CyberGym level. The task's grader is started with the same report. Only the environment's setup can write a report, so on Docker add --render-prompt; a Kata pull runs setup in its VM. Level 4 (and CyberGym level 2) shows the program's output, which only patch environments carry for now. A run at another report measures another task, so it can't set an environment's difficulty rating. The levels are described at https://rl.bugcrowd.com/docs/environments/option-reference.

run pulls the task and starts harbor run with everything after --. Your model keys reach the agent the usual Harbor way, through --env-file or --ae; run keeps the registry key out of Harbor's environment.

Most tasks' containers can connect to services listening on the host that runs them, so the agent under test can too. run, and pull on a terminal, warn about it until you firewall those services from Docker's bridges and set SAVANTENVS_HOST_SERVICES_FIREWALLED=firewalled. The README.md that pull writes beside the tasks gives the rules. A Kata task on the default restricted network can't reach the host this way and gets no warning.

Running a task with Harbor yourself

A pulled task is an ordinary Harbor task, so harbor run -p <task directory> runs it. On a terminal, pull prints that command after the directory; piped or with -q, it prints the directory alone. When you run Harbor yourself:

  • A Kata task's services have fixed addresses, so run one trial at a time on a host (-n 1), or pull another copy into its own -o directory with a different --subnet.
  • Harbor runs a task whether or not SAVANTENVS_HOST_SERVICES_FIREWALLED is set. Firewall the host's services first, as above.
  • An agent Harbor installs in the task, such as claude-code, needs the task pulled with --network open.
  • A task pulled with --tool-auth enabled needs a fresh SAVANTENVS_MCP_TOKEN of at least 32 characters exported in the shell that runs Harbor: export SAVANTENVS_MCP_TOKEN=$(openssl rand -hex 32). On the MCP interface it also needs a Harbor that sends MCP server headers, which 0.22.0 doesn't; pull with --interface shell to use tool authentication there.
  • Leave SAVANTENVS_API_KEY unset in the shell that runs Harbor, so the agent can't read it.
  • harbor run -a oracle checks a task on your machine: the reference solution passes. A patch task has no reference fix, so it has no oracle check.

run does the Kata and SAVANTENVS_MCP_TOKEN checks for you, warns while SAVANTENVS_HOST_SERVICES_FIREWALLED is unset, and adds -n 1 to a Kata task's Harbor run unless you give -n. It can't tell whether your agent needs --network open.

Updates

Once a day at most, pull and run check this repository for a newer release and print one line if there is one. The check never delays a command by more than two seconds; SAVANTENVS_NO_UPDATE_CHECK=1 turns it off. savantenvs upgrade replaces the binary with the latest release after checking its SHA-256 against the release's checksums.txt.

Exit codes

Code Meaning
0 success
1 an unexpected failure: the network, Docker, an answer of the wrong shape
2 a wrong command line
3 no key, or a key the platform or registry refused
4 no such environment or tag, or one your organization doesn't hold
5 an environment that has no Harbor task
6 a host that can't run the task: no Docker or Harbor, no /dev/kvm, an unset variable
7 a task directory that exists with different contents

These codes are for what fails before Harbor starts. Once run has started Harbor, it exits with Harbor's own code (and 1 if Harbor was killed by a signal), so a script that needs to tell them apart checks the message on stderr.

The mcp and shell variants of a task share a directory name, so pulling one over the other in the same -o exits 7; give each its own directory, or pass --force to replace it.

Terms

Use of savantenvs is subject to Bugcrowd's terms and conditions: https://www.bugcrowd.com/customer-terms-and-conditions/

About

Savant RL environments CLI

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors