Agentic run loops
With the RWX CLI, CI workflows can be kicked off locally without committing and pushing changes. rwx run includes all local edits on top of the most recent commit in your branch's history that's already on your remote (see Testing Workflows Locally). Combined with content-based caching, this lets agents iterate quickly to get CI to pass.
Kicking off a run loop
Below is an example prompt you can give to an agent to kick off a run loop:
Make sure CI passes by running
rwx run .rwx/ci.yml --wait --fail-fast, and then commit and push.
You can see a demo in this blog post. When the run finishes (or has an actionable failure while still in progress), the CLI will output easy-to-follow instructions for an agent (or human) to pull logs or artifacts as needed and fix any issues.
Switching between a push-triggered CI run and a local run loop
If you've already pushed your changes and want your agent to monitor CI and ensure a green build, try a prompt like this to get the same actionable output to your agent as soon as it's available:
Monitor CI with
rwx results --wait. If anything fails, fix it and kick off a new run withrwx run .rwx/ci.yml --wait.
If you're using the RWX agent skill, you can usually be more brief with these prompts, but the full syntax is shown for reference.
Using sandboxes with agents
Run loops help drive your agent toward a green CI build, but your agent sometimes needs a real, isolated environment of its own to work in. An RWX sandbox provides one in the cloud. Because your agent runs outside of RWX's compute rather than inside the sandbox, you can drive a sandbox from any agent, wherever it runs.
A sandbox is defined with the same task definitions as your CI, so configuring one takes very little extra setup. Once it's running, you can have your agent verify a fix in the sandbox before confirming it in CI:
Fix the failing login tests and verify in an RWX sandbox with
rwx sandbox exec -- npm test. Then, make sure CI passes withrwx run .rwx/ci.yml --wait.
Local changes sync up before each command and any generated files sync back down afterward. The sandbox itself persists between commands, so your agent iterates quickly without rebuilding state every time. And when you want a clean slate, rwx sandbox reset blows away the remote state and starts fresh.
Running in a sandbox is helpful for:
- agents without a local development environment, such as Claude Code on the Web
- agents sharing one machine that need isolation to avoid trampling over each other
- agents running untrusted or experimental code, which executes in the cloud rather than on your own machine
Configure a sandbox to get started, and see the guide for worktree-based parallelism.
CLI reference
For more CLI documentation, see the references for rwx run and rwx results.