Skip to content

Ready command

When building a sandbox template, you can use the —ready-cmd option to define a command that checks whether the sandbox is ready.

The sandbox will be considered ready once this command completes successfully.

Tip: Replace your-ready-command with a command that verifies your sandbox environment is fully initialized, such as checking if a service is running or a specific file exists.

agentbox template build --platform linux_x86 --ready-cmd "<your-ready-command>"

You can define the ready command directly in the agentbox.toml file, located in the same directory where you run agentbox template build --platform linux_x86.

This allows the build process to automatically check whether the sandbox is ready without passing the command via CLI each time.

# This is a config for AgentBox sandbox template
platform = "linux_x86"
team_id = "b0ba29e3-ca55-4368-b62e-07999bdfcfbe"
dockerfile = "agentbox.Dockerfile"
template_id = "1yyw2u1eqoa7is3qejrw"
ready_cmd = "your-ready-command"

Here are some example commands you can use to define the ready_cmd in your agentbox.toml.

1. Wait for a URL to return HTTP 200

ready_cmd = 'curl -s -o /dev/null -w "%{http_code}" http://localhost:3000 | grep -q "200"'

This command repeatedly checks the given URL and considers the sandbox ready once it returns a 200 status code.

2. Wait for a specific process to start

ready_cmd = 'pgrep my-process-name > /dev/null'

This command checks whether a process with the given name is running, and the sandbox is marked ready once the process starts.