Skip to main content
devbox exec runs a command inside a Devbox without opening an interactive shell. Each run is recorded as an execution with its own ID, and its output is retained on the Devbox — so you can stream it live, or come back and read it later with devbox logs. This makes devbox exec a good fit for scripted and automated work: builds, test suites, migrations, and anything driven by a coding agent.

Running Commands

Run a command and stream its output back to your terminal.
When the command has flags of its own, add -- to separate the Devbox CLI arguments from the command that should run inside the Devbox:
If the Devbox is paused, it is resumed automatically before the command runs.
For interactive programs or piped input, use devbox ssh instead.

Detached Executions

Coding agents often need to start a long build or test run without blocking on it. devbox exec -d starts the command and returns immediately, leaving it running on the Devbox. It prints an execution ID, which the agent uses to check the output when it needs the result:
Output
A detached execution keeps running after the CLI exits. A foreground execution, by contrast, is tied to your CLI session, so prefer -d for long-running work or when your connection might drop. However, a detached execution ends if the Devbox stops. For a process that should keep running, restart when it fails, and start again on boot, create a service instead.

Streaming Logs

Output from every execution is retained on the Devbox, so you can read it while a command is still running or long after it has finished. Retained output survives pause and resume, and is removed when the Devbox is deleted. Stream the output of an execution by ID:
devbox logs first replays the output that has already been captured, then follows the live output, and returns once the execution completes. This works for executions that have already finished too, which is how you re-read the results of an earlier run.

Listing Executions

List the executions retained on a Devbox:
Output
The Status column is running while the command is still going, then completed, or failed with the command’s exit code.

Next Steps

SSH & Sessions

Open a shell on a Devbox with SSH or a session.

Running Long Tasks

Keep a Devbox running while a build or an agent works.

Agent Skills

Drive Devboxes from AI coding agents.
Last modified on October 16, 2026