Safeguard
Developer Tools•

How do you run the Safeguard CLI inside a coding agent sandbox?

The Safeguard CLI is a single static binary that can scan and write code. How to run it inside a cloud or local agent sandbox, and what network it needs.

Safeguard Security Team
6 min read

The Safeguard CLI is a single static binary with no runtime to install, so it fits inside a sandbox image or setup script. It can scan a project from a terminal or pipeline, and it can also write code. Inside a locked-down agent sandbox, allow only the network path it needs to send results, and verify what leaves.

What the CLI is, per the download page

Safeguard's download page lists the CLI as Available, version 1.4.0, and describes it as a way to scan from your terminal or CI/CD pipeline, "a single static binary with no runtime to install." Install is a one-line command on macOS and Linux and a PowerShell command on Windows, and the installer verifies a checksum before putting anything on your PATH. The page says scans run on your machine or in your pipeline and send only the results. One example command on the page is a scan of a project directory.

The page also lists a Local agent and a Cloud agent as Available, and a Cloud CLI that runs the same tool on Safeguard's infrastructure so a scan needs no local runner. Beyond scanning, the CLI can write code. We state that plainly and make no comparison claims about how well it does so.

Why a static binary suits sandboxes

PropertyWhy it helps in a sandbox
No runtime to installThe setup phase stays small, with fewer packages to pin
Single fileEasy to bake into an image and hash
Checksum verified installPart of your supply chain evidence
Runs locally or in a pipelineWorks in the same places agents work
Sends only resultsA smaller data flow to reason about

A tool that needs a language runtime and a dozen packages adds setup steps, each with its own supply chain risk. A static binary shortens that list, though you still verify the binary itself.

Three places to run it

  1. Setup phase of a cloud agent. Install in the image or setup script, where network access is normally broader. Scan the repository once the dependencies are in.
  2. Agent phase, as a tool the agent calls. Useful if you want the agent to check its own changes. This needs a network path for results, so decide whether to allow it.
  3. Outside the sandbox, on the pull request. The agent pushes a branch and a pipeline step runs the CLI against the diff, before review.

The third is the most conservative. The scan runs where credentials and network are under your control, not inside the environment the agent shapes.

A worked example: scanning an agent's changes

An illustrative flow for a team using a hosted coding agent with default deny network access.

  1. The setup script installs the CLI by its pinned version and checks the installer's checksum step succeeded.
  2. The agent works on a task and edits a dependency manifest.
  3. The agent branch is pushed, and a pipeline job outside the sandbox runs the CLI on the branch.
  4. The scan results go to the Safeguard service, which the pipeline's network allows.
  5. A policy gate evaluates the results. A new dependency with a known serious issue blocks the pull request.
  6. A reviewer sees the finding next to the diff and rejects or asks for a different version.

The agent never needed outbound access to Safeguard, and the check still happened before merge.

Network decisions if you run it inside the sandbox

OptionNetwork neededTradeoff
Run only in setupDuring setup onlyCannot check changes the agent makes later
Run in agent phaseOne allowed host for resultsAdds a destination to your allowlist
Run outside in the pipelineNone in the sandboxCheck happens after the agent finishes
Use the Cloud CLINo local runnerWork runs on Safeguard's infrastructure, which you must be comfortable with

If you add a destination for results, record an owner and reason, and watch the block log. One host with one purpose is easy to defend.

Credentials

Give the CLI the narrowest credential that works, and do not put it in an environment variable the agent can read if you can avoid it. Use whatever proxy or network secret mechanism your sandbox offers. Check the CLI's current documentation for authentication details, since we do not describe them here.

Using the CLI to write code

Because the CLI can write code, apply the same rules as for any agent that changes files.

  1. Run it as a dedicated identity with repository limits.
  2. Let it push to a task branch only.
  3. Review what it produced like any other pull request, reading workflow and manifest changes first.
  4. Keep automatic fix pull requests off until you trust the review process. Safeguard's autonomous remediation is off by default, with every category on Manual.

Try it yourself

Click through it at your own pace, or open it full screen.

Look at how the CLI runs locally and what it reports, then decide where in your sandbox design that run belongs.

Where Safeguard fits

This post is about Safeguard itself: the CLI, the Local agent, and the Cloud agent are listed as Available on the download page, and SBOM and dependency scanning, reachability analysis, policies and gates, and a free scan at gold.safeguard.sh/scan are part of the platform.

Quick check

Does the Safeguard CLI need a language runtime?

No. The download page describes it as a single static binary with no runtime to install.

What leaves the machine when the CLI scans?

The download page says scans run on your machine or in your pipeline and send only the results. Review exactly what your configuration sends before using it on sensitive code.

Can the CLI write code?

Yes. Treat its changes like any agent's, with a dedicated identity, a task branch, and human review before merge.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.