Giving ADK agents a tool that runs on your own machine (open-source async bridge) #6477
Replies: 1 comment 1 reply
|
The FunctionTool seam is reasonable for the control plane: enqueue a task, return a task ID, and let a later call retrieve status or results. I would avoid holding one tool invocation open while the local machine performs a 20-minute build. A separate status or cancel operation makes retries and sandbox timeouts much easier to reason about. The file mailbox also deserves a security review because it crosses a trust boundary. Use restrictive directory permissions, an allowlist of executable scripts, protection against symlink and path traversal attacks, task expiry, idempotency, bounded result sizes, and redaction of command output. The local daemon should run with the least privilege possible, and git credentials should never be included in task payloads or results. For ADK integration, expose a small typed task schema and explicit progress states rather than asking the model to construct arbitrary shell commands. A long-running or background tool abstraction is a good fit for the lifecycle, while the bridge remains the host-side transport. |
Uh oh!
There was an error while loading. Please reload this page.
One limit I kept running into with ADK: a deployed agent can reason about my development machine perfectly well, but it can't reach it. Once the agent runs on Cloud Run, in Agent Engine, or in any sandbox, the things I actually want automated — run the test suite, check what's eating the disk, push a branch, tail a container's logs — are on the other side of a wall. The filesystem, the toolchain, the local Docker daemon, and the git credentials are all on my laptop.
cowork-to-code-bridge (MIT) is a small async bridge for exactly that. The sandboxed agent queues a task; a daemon on my own Mac/Linux box runs it and hands the result back.
How it works
Intentionally unexciting: no network call from the agent side, no inbound ports, nothing listening on the internet. Both sides read and write files in a shared directory holding
queue/,results/, andto_cowork/. That's what makes it survive reboots and sandbox timeouts instead of dropping work on the floor.Where it fits in ADK
The clean seam is a
FunctionToolwrappingqueue_task+poll_task_result. Because polling is idempotent and non-blocking, it fits the long-running-tool pattern well: the agent kicks off a 20-minute build, returns control, and picks the result up on a later turn rather than holding a request open. Wrapping it as anAgentToolon a dedicated "local machine" sub-agent also works nicely if you want the LLM to route to it explicitly.The headline script is
run_claude.sh, which hands the task to a full Claude Code agent on the machine instead of a fixed command — so the local end can plan and iterate, not just execute. About 22 other bundled scripts cover the smaller stuff (health, RAM, disk, ports, Docker, git, package state).The parts worth scrutinizing
Giving an agent a shell on your own machine needs guardrails, so each task can set:
max_budget_usd— spend ceiling, so a runaway loop can't drain creditspermission_scope—plan/readonly/edit/fullplan="…"— a human approves before anything executesidempotency_key— retries don't double-fire state-changing workProgress streams back (
call_remote_streaming) so a long build isn't a silent wait, and there's a bidirectional mode where the machine-side agent can ask the calling agent a question mid-task.Status
Working and tested (330+ tests), MIT, macOS/Linux/WSL2. I'm the author and I'm after feedback more than stars. Open question I'd value ADK-specific input on: is the long-running
FunctionToolreally the right primitive for "this step must execute on host hardware," or is there a more idiomatic extension point I should be targeting instead?Repo: https://github.com/abhinaykrupa/cowork-to-code-bridge
All reactions