cowork-to-code-bridge — let a sandboxed smolagent run work on your real machine, over a shared directory instead of a socket #2602
abhinaykrupa
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
smolagentsis deliberately small and runs wherever you put it — including inside a sandbox, a CI job, or a hosted notebook where the agent has no access to the machine you actually care about. I kept hitting the same wall: the agent could reason about my repo perfectly well, but couldn't run the test suite, hit the local Docker daemon, or push a branch, because none of that existed in the sandbox.So I built cowork-to-code-bridge — an async, file-based RPC bridge that lets a sandboxed agent hand work to Claude Code running on your own machine.
How it works. There is no listener and no open port. The sandbox and the host share one bind-mounted directory. The agent writes a task JSON into it; a daemon on the host picks it up, runs it, and writes the result back. That's the whole protocol.
The reason it's shaped that way: a socket or a tunnel means something on your laptop is accepting connections, which is a real attack surface for a convenience feature. A shared directory means the only thing crossing the boundary is a file you can read before and after. It also survives reboots and sandbox restarts for free — the queue is just files on disk.
Where it fits a smolagents tool. The client is pure stdlib, single-file, and non-blocking, so it drops into a
@toolwithout adding a dependency:queue_taskreturns immediately, which matters for agent loops — a blocking call that takes four minutes to build a Docker image will blow past most agent step timeouts.poll_task_resultis idempotent, so a retried step doesn't re-run the work.The parts that took the longest, in case they're useful regardless of this project:
plan,readonly,edit,full— each mapping to a vetted flag set. The machine's owner can always override; the caller can only ever tighten.timeoutbounds how long a task runs;max_age_secbounds how long it may wait. If your laptop was asleep, you do not want a two-hour-old backlog of "deploy" tasks all firing at once on wake. Past the age limit the daemon skips execution and returns a normal result with a distinct exit code.Runs on macOS and Linux. MIT. Genuinely interested in whether the file-queue-instead-of-a-socket tradeoff holds up for other people's setups, or whether there's a failure mode I haven't hit yet.
All reactions