Repository navigation
Idea: one-click Docker Sandbox (sbx) environments in Settings → Connections #7841
Replies: 11 comments 12 replies
|
I actually have a working prototype — split into two branches so each stays one concern: The sandbox integration itself — a "Docker Sandbox" card in Settings → Connections: it detects the main...mdelapenya:t3code:feat/docker-sandbox-connections Optional follow-on, stacked on the above — activating T3 Connect for a sandbox when it's connected, so it's reachable from mobile. Worth ignoring unless the first one interests you: @t3dotgg is this something you and your team are interested in discussing? BTW thanks for this great OSS project, I'm enjoying it every time I use it since discovered 🙇 |
|
This would be very useful for benchmarks (avoiding contamination, fresh harness and security). |
|
@t3dotgg @juliusmarminge would you like to discuss about what I proposed here? Cheers! |
|
This would also be useful for keeping parallel agent sessions from interfering with each other. The devcontainer request in #2310 describes a similar goal: separate checkouts, dependencies and backing services for each agent. Could the approach here eventually support allocating an isolated workspace per thread, with its own filesystem, processes, ports and development services? Ideally, reconnecting would reuse that workspace, and the agent, terminal, project scripts and previews would all operate inside the same boundary. The provisioning could stay with an external backend such as Docker Sandboxes, a container manager or a microVM service. T3 would only need to associate the thread with the workspace and connect to it. That seems worth exploring without requiring T3 to manage a Docker or Kubernetes platform itself. Would orchestration v2 (#2829) provide a suitable integration point for that, or is the intended model to keep isolation at the environment level, with a separate T3 server in each sandbox? I realize this is broader than the initial Add Environment proposal; I’m asking about the direction and integration boundary, not suggesting it should block this smaller integration. |
|
+1, I'd love to see this integrated. I'm currently using T3 Code as my main coding-agent interface and trying to make it the provider-agnostic replacement for workflows I previously relied on Cursor/Cloud Agents for. One of the main blockers for me is compute isolation and elasticity. I don't necessarily want every concurrent agent session sharing the same permanent VPS/worktree. Ideally, a new T3 session could optionally get a fresh isolated sandbox/microVM, run Codex/Cursor/Claude/etc. there, and have the environment suspended or destroyed when the work is finished. I'm completely fine with the actual compute being provided by Docker or another cloud provider — what I care about is T3 remaining the control plane and the compute being replaceable. The fact that Docker Sandboxes already expose SSH and therefore fit T3's existing Environment abstraction seems like a really clean path. A first-class “Docker Sandbox” environment provider would already remove one of the biggest blockers to me adopting T3 more fully. Longer term, it would be amazing if T3 had a generic compute/environment provider abstraction so Docker Sandboxes could be one implementation alongside things like Daytona, E2B, CUA, or arbitrary cloud devboxes: New session → choose/provision environment → run agent → optionally suspend/destroy when idle. That would get T3 very close to the best parts of Cursor Cloud while remaining agent- and compute-provider-agnostic. |
|
+1. Our use is the same, plus a remote variant. We want to start a workspace either in a local container or on a cloud server, push the heavy work there so the laptop isn't overloaded, and manage it from inside T3 (create, start/stop, see status, destroy). Since both end up reachable as SSH hosts, @mdelapenya's approach (hand the host to the existing SSH environment flow) seems right for both. The cloud case would only add a provisioning step in front. It also overlaps with #15516 (isolated compute for delegated workers): a workspace like this is a natural place to start a delegated child. @juliusmarminge @t3dotgg, is a "workspace provider" abstraction (Docker Sandbox first, then SSH or cloud VMs) a direction you'd accept? We'd help build or test it. |
|
Thanks everyone for the thoughtful comments, and @juliusmarminge for taking it to Theo 🙏 A few people asked about the integration boundary, so let me describe where the prototype sits today and where I think it leaves room to grow, without pretending it's more than it is. What the prototype deliberately is (and isn't)It introduces no new environment or connection kind. Desktop main has a small service that shells out to the I kept it that narrow on purpose. It's a first PR, and a sandbox is already a complete environment in T3's model, so there was nothing to generalise yet. On the "workspace provider" question (@fadymondy, @hazem3500)I think the honest answer is: the prototype already has the seam you're describing, with exactly one implementation behind it. "Provision something → get an SSH host → hand it to the SSH flow" is the whole contract. A cloud VM, Daytona, or a self-managed devbox would be another implementation of create/remove that yields an SSH host, with the same card UI in Connections. What I would not want to do is invent that abstraction in this PR. A one-implementation abstraction tends to be shaped by guesses; the second real provider is what tells you where the interface actually bends. If the maintainers like the direction, I'd rather land the concrete sandbox version first and let the provider boundary fall out of a second one. Lifecycle (@fadymondy): today the card creates, lists with status, and removes. Start/stop is a mechanical follow-up once the card exists. The local-vs-remote split you describe maps well too: Docker Sandboxes are microVMs that run directly on your machine, managed by the On per-thread isolation (@LegandaryRa, @hazem3500)That one is a genuine architectural decision for the maintainers, not something I'd want to sneak in under a Connections card. Right now a project and its threads belong to one environment, and that's what makes checkpoints, diffs, and reconnection work. Mapping threads to sandboxes would touch that invariant, and orchestration v2 is the right place to have that conversation (#2829, #2310, #15516 all point the same way). What does work today, with nothing more than this prototype: create N sandboxes and you get N isolated environments, each with its own filesystem, processes, and ports. What's missing is T3 doing that for you per thread and suspending/destroying on idle. I'd love to see that too, but it's a second step that benefits from the first one existing. Where the code isI've folded the T3 Connect follow-on into the same branch and rebased everything onto today's main...mdelapenya:t3code:feat/docker-sandbox-connections I'm dogfooding it daily and keeping it current. If the direction is acceptable, I'm happy to open the PR whenever suits you, and equally happy to hear "not now" or "not like this". |
|
Hey @juliusmarminge, @t3dotgg, @mdelapenya, Just wanted to follow up on this since it’s probably one of the biggest features still missing for my workflow. I currently use Claude Code’s Cloud Sessions quite a lot, mainly because every session runs in its own isolated environment. I’ve tried running multiple Claude Code and Codex CLI sessions on my own VPS servers before, but sooner or later they start interfering with each other. For example, one agent compiling a large Rust project might temporarily consume almost all available CPU and RAM, slowing down every other session. What I’d really love is something similar to Claude Code’s Cloud Sessions, but running entirely on my own VPS servers. Ideally, I’d be able to connect my VPS servers to T3 Code, select a GitHub repository, optionally configure a startup script, and launch a new session that automatically gets its own Docker container with configurable CPU and RAM limits. That way, I could have multiple agents working on the same physical server without them constantly fighting over resources. Each session would have its own filesystem, dependencies, processes, and resource limits. Being able to automatically stop or resume these containers would also be really useful. Since T3 Code already supports remote environments, SSH connections, and load balancing, I feel like a lot of the groundwork is already there. The main missing part would be automatically creating and managing isolated containers for individual sessions. I also saw #15516, which seems to propose something quite similar. @mdelapenya, your Docker Sandbox implementation looks like a great starting point. Would it be possible to extend it to support Docker running on remote VPS servers and automatically create a separate sandbox for each session? @juliusmarminge, you mentioned back in September that you’d bring this up with Theo. Has there been any progress or internal discussion about supporting something like this? Even a basic implementation where I could connect my own Docker-enabled VPS and have T3 Code automatically create a resource-limited container for each new thread would already be amazing. I think this would make T3 Code a really attractive self-hosted alternative to Claude Code’s Cloud Sessions. Thanks! |
|
Hey @mdelapenya — thanks for this! I tried to bring your branch forward into the curret state of T3 Code and gave up on it (too dumb with git it seems...). It's ~3,700 commits A few things I added on top, mostly from the comments in this thread:
Two kit findings you may want on your side:
Also worth flagging for anyone following the original instructions: Thanks again for your work! |
|
@phate45 wasn't aware of the other one 🤣 ...that looks way more complete and flexible, how hard would it be to add sbx to the drivers? |
|
One-click Docker environments are a good local default. If you also want a remote option later, a per-run microVM gives a stronger boundary because each run has its own kernel rather than sharing the host's. I work on Sandscale, which does that as a hosted service (Firecracker microVM, TypeScript SDK, early access, US only). Whatever you pick, an explicit network allowlist matters as much as the isolation layer. |
Uh oh!
There was an error while loading. Please reload this page.
Hi! 👋
First, quick disclosure so there's no surprise halfway through: I work at Docker on the Docker Sandboxes team (
sbx). I'm also a happy T3 Code user, which is how this idea came about. I'd love to hear whether you'd welcome a contribution here — and if the answer is "not a fit", that's a completely fine answer too.What already works today (thanks to your architecture)
Docker Sandboxes run coding agents in isolated microVMs. Because
sbx setup sshwrites a managed SSH config, every sandbox is reachable as an ordinary SSH host at<name>.sbx— and T3 Code's desktop-managed SSH launch handles it beautifully from there. No T3 changes needed at all. That's a real compliment to the "SSH is an access helper, not an environment type" design indocs/internals/remote.md; it made this work out of the box.The friction is everything around that moment. Today a user has to:
sbx run --name t3sbx --kit docker.io/sbx/t3code-kit:latest ... claude .in a terminal/exitit, close the terminal (the sandbox keeps running)sbx setup sshoncet3sbx.sbx, know the username isagentt3install fails silently because node-pty has no Linux prebuilds and fresh sandboxes ship no compilerThat's a lot of tribal knowledge for what is conceptually one action.
The idea
A Docker Sandbox card in the Add Environment dialog that does the machinery: detects the
sbxCLI (offering a one-click install via Homebrew/winget, in the same spirit as the provider-update toast; copyable commands on Linux), runs the idempotentsbx setup ssh, creates the sandbox non-interactively withsbx createand the t3code kit always applied, then hands<name>.sbxto the existing SSH environment flow.Design-wise I tried to follow the grain of the codebase: no new connection target kind. The persisted profile is a plain
SshConnectionProfile; the integration is a thin, desktop-only provisioning adapter (apps/desktop/src/sbx/, ~2 files) plus one dialog card, hidden entirely when the bridge doesn't expose it. Nothing downstream — supervisor, resolver, catalog, mobile, web — knows sandboxes exist. The one sandbox-aware reverse path: removing a.sbxenvironment asks whether to delete the sandbox too, so no orphaned VMs.Why I think T3 Code users would care
Your users drive agents all day, often with permissions cranked up. The sandbox model is a nice complement to that (all from the official docs):
--dangerously-skip-permissionswithout the dangerous part.The obvious question: sbx isn't open source
I want to be upfront about this rather than have it come up in review. The
sbxCLI is freely available but not OSS. My honest read is that this sits in the same category as the provider CLIs T3 Code already integrates — Claude Code, Codex, Cursor aren't open source either, and T3 Code even one-click-updates them. The integration itself would be fully OSS in this repo, driving a CLI the user chose to install, and invisible when they didn't. But you may weigh this differently, and I'd genuinely like to hear how you think about that boundary.Where things stand
I have a working PoC on a branch: contracts, the desktop adapter, the dialog card with install/login/create states, the removal flow, focused tests, and updates to
docs/user/remote-access.md+docs/internals/remote.md. Happy to open a PR with screenshots and a short video if there's interest — and since I'm on the sbx team, you'd have a direct line to us for maintaining the integration as the CLI evolves (we'd also take fixes on our side if T3 Code needs something, e.g. stabler--jsonoutput; the PoC already caught one format wobble between releases).No pressure at all — if you'd rather see this live as a fork, an external plugin pattern, or not at all, I'm glad to have learned this much about the codebase either way. Thanks for building T3 Code in the open. 🙏
All reactions