Sandbox Support in GH CLI
@patniko is already working on this.
Since May 19, 2026.
Assessment
This issue has not been assessed yet.
Description
Summary
Add first-class sandbox execution support for Copilot SDK sessions, so SDK consumers can run agent file edits, shell commands, MCP servers, and custom tools inside an isolated, resumable workspace rather than relying on the host process filesystem/network boundary.
Current state
From the public docs and examples, the SDK currently exposes several useful building blocks:
workingDirectory/ session workspace configurationavailableTools/excludedToolsonPermissionRequestonPreToolUseandonPostToolUsehooks- custom tools that can replace built-ins
- a virtual filesystem sample that disables built-ins and backs file tools with an in-memory store
Those are helpful, but they do not appear to provide a first-class sandbox lifecycle or provider abstraction. As far as I can tell, there is no SDK-level API for:
- creating or attaching a sandbox execution environment per session/run
- selecting a sandbox provider, such as local process, Docker/container, hosted sandbox, or custom provider
- mounting repositories/directories/object stores into the sandbox workspace
- enforcing filesystem/network/process isolation below the tool-permission layer
- snapshotting/restoring the sandbox workspace across sessions
- running MCP servers inside the same restricted boundary
- exposing sandbox artifacts/ports back to the host application
If this already exists and I missed it, a docs pointer would be great.
Motivation
Many agentic SDK use cases need more than tool allow/deny decisions. They need a concrete execution boundary for untrusted or model-directed work:
- coding agents that edit files and run tests without touching the host directly
- multi-tenant SaaS apps embedding Copilot agent workflows
- eval harnesses that need reproducible, isolated workspaces
- agents that install packages or run scripts
- MCP servers that should be constrained to specific filesystem/network scopes
- workflows that produce artifacts the host app can inspect after the run
The README says the SDK can enable first-party tools that perform filesystem operations, Git operations, and web requests. Permission hooks are useful for policy, but they are not a replacement for OS/container-level isolation.
Prior art / comparison
OpenAI Agents SDK has a first-class sandbox concept where the agent runtime can connect to local/Docker/hosted sandbox providers and the sandbox owns files, commands, ports, mounts, and persisted state.
Anthropic also has sandbox-runtime (srt), a lightweight sandboxing tool designed for agent/MCP/server process isolation using OS sandbox primitives and network/filesystem restrictions.
It would be valuable for Copilot SDK to expose an equivalent integration surface, while still preserving the existing Copilot SDK tool and hook model.
Proposed API direction
One possible shape:
const session = await client.createSession({
model: "gpt-4.1",
sandbox: {
provider: "docker", // or "local", "hosted", custom provider adapter
image: "ghcr.io/example/copilot-agent-sandbox:latest",
workspace: {
mounts: [
{ source: "/path/to/repo", target: "/workspace/repo", mode: "rw" },
],
persist: true,
},
network: {
allow: ["github.com", "registry.npmjs.org"],
default: "deny",
},
resources: {
cpu: 2,
memoryMb: 4096,
timeoutSeconds: 1800,
},
},
onPermissionRequest: async (req) => ({ kind: "approved" }),
});
- Dominant language
- Java
- Stars
- 10.5k
- Forks
- 1.5k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 133
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from github/copilot-sdk
-
agentic-workflows
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
github/copilot-sdk#2709 · 1 comment ·
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
github/copilot-sdk#2673 ·
-
bug testing
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
github/copilot-sdk#2628 ·
-
agentic-workflows
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
github/copilot-sdk#2627 · 1 comment ·
-
agentic-workflows
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
github/copilot-sdk#2493 ·
All issues in github/copilot-sdk
Similar issues
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 90/100
apache/cloudstack#14222 ·
-
[BUG]茶杯方块在取茶时会引发崩溃 Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
1.0.0-alpha2 Type/Improvement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
wso2/dpdp-accelerator#272 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
apache/rocketmq-dashboard#4860 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·