Stashbase

Overview

Run AI coding agents in a sandbox with governed access to credentials, network, files, and tools

Stashbase runs coding agents inside a sandbox, either a native OS sandbox or an isolated Docker container. An agent profile decides which credentials, hosts, files, dependencies, and MCP tools the agent can use. The agent never sees secret values.

How it works

Your shell → stashbase agent run → coding agent
                                      │
                                      │ placeholder in a supported request header
                                      ▼
                              Stashbase Agent Proxy
                                      │
                                      ▼
                              approved API destination
  1. stashbase agent run starts the agent in the sandbox and sends all its traffic through the Agent Proxy.
  2. Instead of secret values, the agent's environment holds short-lived placeholders.
  3. When the agent sends a placeholder in a request header, the Agent Proxy checks the request against the profile: the host, and any method and path rules you set.
  4. If the request is allowed, the proxy swaps in the real secret and forwards it. Otherwise it blocks the request, and the secret never reaches the agent.

The same profile also limits which other hosts the agent can reach, which files it can read and write, and which MCP tools it can call. The policy applies to the agent and every process it starts.

Secrets can come from a Stashbase environment, a local secrets file, or both. Remote sessions can also use your own personal credentials, which stay private to your account.

Choose a session type

SessionUse it whenWhere resolved secrets live
LocalYour profile uses a local file, has local overrides, or you need the simplest setup.In the short-lived local Agent Proxy process.
RemoteYour profile is backed by a Stashbase project and environment and you want credentials resolved in Stashbase.On Stashbase infrastructure.

Both modes give the child only placeholders and enforce the same host policy. Add --remote when starting an eligible remote session. Remote sessions are available only for workspaces on paid plans.

Quick start

In a trusted project directory, run the setup wizard:

stashbase agent init

It asks which agent you use, which secrets it may use and the host each one is for, the sandbox, and where to save the profile. Then it prints the command to start the agent:

Created agent profile: ./.stashbase/agents/claude.toml

Start the agent:
  stashbase agent run --profile claude -- claude

The profile starts closed: the agent reaches only its model provider and the hosts you name, each secret is read-only unless you allow writes, and no MCP servers or hooks are enabled. Nothing is saved until you confirm. Profiles that use a local secrets file don't need a Stashbase account.

The result is a regular TOML file with commented examples for what you skipped, so you can open it later to add path rules, MCP servers, or hooks.

Write the profile by hand

stashbase agent init <profile> writes a commented, closed starter template instead:

stashbase agent init local_agent

Then configure .stashbase/agents/local_agent.toml:

.stashbase/agents/local_agent.toml
egress_hosts = ["api.anthropic.com", "registry.npmjs.org"]

[secrets]
project = "project"
environment = "environment"

[secrets.GH_TOKEN]
env = "GITHUB_TOKEN"

[[secrets.GH_TOKEN.rules]]
effect = "allow"
hosts = ["api.github.com"]
methods = ["GET", "POST"]
paths = ["/repos/*/*/issues*"]

Validate the policy before it is granted secrets, then launch your agent:

stashbase agent validate --profile local_agent --profile-source directory
stashbase agent run --remote --profile local_agent --profile-source directory -- codex

The child process gets a placeholder named GH_TOKEN, never the real value. It may use that placeholder only for the configured GitHub issue requests; package-registry traffic is permitted without receiving a credential. Omit --remote to run the same profile through a local Agent Proxy.

Continue in the guide

On this page