GitHub Copilot CLI
Run GitHub Copilot CLI in an E2B sandbox with a real filesystem, terminal and git. Auto-approved tool calls stay in the sandbox, not on your machine.
- E2B
- Prebuilt copilot template
- copilot
- TypeScript, Python
Get started
Paste the prompt into your coding agent, or follow the steps yourself.
Paste this into your coding agent
Run GitHub Copilot CLI in an E2B sandbox from this project.
- 1.Install the e2b package using the project's package manager.
- 2.The SDK needs the E2B_API_KEY environment variable. If it isn't set, ask me for my API key from https://console.e2b.dev/?tab=keys. Never hardcode it. Copilot also needs COPILOT_GITHUB_TOKEN, a fine-grained token with the Copilot Requests permission.
- 3.Follow the GitHub Copilot CLI guide at https://docs.e2b.dev/agents/copilot-cli: create a sandbox from the copilot template and run copilot --allow-all-tools -p with a task and timeoutMs: 0.
- 4.Run it once, show me the output that came from the sandbox, then kill the sandbox.
Or set it up yourself
1. Install the E2B SDK
2. Set your keys
3. Run Copilot headless
4. Or open it interactively
What runs in the sandbox
Copilot's auto-approved tool calls run in the sandbox, away from your host files and credentials.
- Shell commands, file edits and git operations Copilot runs with --allow-all-tools, or only the tools you allow with --allow-tool.
- Sessions are stored in ~/.copilot in the sandbox. --continue resumes the latest and --resume picks one by ID.
- Pass a fine-grained COPILOT_GITHUB_TOKEN. Give a git token only to the git command, not as a sandbox-wide env.
- Sandboxes reach the internet by default. Limit where the agent connects with outbound network rules.
More coding agents
Other coding agents that run in E2B sandboxes.
- Claude CodeRun Claude Code in its own sandbox with a real filesystem, terminal, and git, so it can work unattended.
- OpenAI CodexRun OpenAI's Codex CLI headless in a sandbox and collect the diff when it's done.
- Gemini CLIRun Google's Gemini CLI in a sandbox with full filesystem, terminal, and git access.
