DEV Community

Cover image for Running my agent's code through DigitalOcean's Action Gateway
Alex Georgiev
Alex Georgiev

Posted on AI-assisted

Running my agent's code through DigitalOcean's Action Gateway

I use Claude Code as my MCP client, so when DigitalOcean Managed Agents went into public preview, the part I wanted to try first was not the hosted runtime. It was Action Gateway, the piece that hands an agent tools through one MCP endpoint, because that is the part a coding agent actually touches.

Action Gateway exposes a small set of meta tools instead of its whole catalogue. action_search finds tools for a described task, action_invoke calls them, and action_code runs Python in a sandbox that can call tools itself. The docs list 16,000+ tools behind that endpoint. I connected it to Claude Code and measured what came back.

Search hands back a short list, not a catalogue

I asked for two things in one request: Droplet sizes, and regions with their availability, five results each.

Query Top result Score
List available DigitalOcean Droplet sizes digitalocean_size-list 0.91
List DigitalOcean regions and their availability digitalocean_region-list 0.83

Both top hits were the right tool, each with its input schema attached, so the agent can call it without guessing argument names. The whole response for ten candidates was roughly 3 KB. Lower in the list were near misses that make sense, like digitalocean_db-cluster-list-options and a Harness Runtime tool for sandbox sizes. A region tool from Daytona, a third-party provider in the catalogue, also showed up at 0.58, which shows the search covers more than DigitalOcean's own tools.

The docs say action_search carries no tool-call charge, and that is the right design for this. Searching is the step an agent repeats most, and it is the step that keeps 16,000 schemas out of the context window.

The code sandbox, from the inside

action_code runs Python in a microVM. I printed what my code found there:

python 3.12.16 x86_64 cpus 2
mem_kB 4034116
PRETTY_NAME="Debian GNU/Linux 13 (trixie)"
/dev/root        97G  1.7G   91G   2% /
Enter fullscreen mode Exit fullscreen mode

Two vCPUs, about 4 GB of memory and a lot of free disk. pip install orjson finished in 1.4 seconds, so pulling a package for one job is cheap.

Each call starts clean, as the limits page says. I wrote /tmp/marker in one call and checked for it in the next:

marker_from_previous_run_exists False
Enter fullscreen mode Exit fullscreen mode

I also read /proc/uptime at the start of six separate calls. It said between 8.34 and 8.96 seconds every time. That is how long the VM had existed by the time my first line ran, not necessarily how long I waited, because I can't see whether a VM was prepared before my request arrived. It is consistent, though, which is what you want from something an agent calls in a loop.

When a tool needs an account you haven't connected

My first real tool call from inside the sandbox was digitalocean_size-list. It stopped and asked for an account link, because I had not connected a DigitalOcean account to the gateway yet. The error is worth showing, trimmed of the link and code:

{"class": "unauthorized",
 "message": "Tool \"digitalocean_size-list\" requires an OAuth connection for provider \"digitalocean\" ... Open https://cloud.digitalocean.com/security/connectlinks/confirm?... to authorize. Then retry the tool call. Confirm that verification code ... matches the code shown on the authorization page.",
 "retriable": true,
 "recovery_hint": "refresh_auth"}
Enter fullscreen mode Exit fullscreen mode

It came back in 102 ms. More useful than the speed is the shape: a class, a retriable flag and a recovery_hint, plus a link and a verification code for the human. An agent can stop and ask its user to authorise, instead of retrying blindly or inventing a workaround. The credential never passes through the model, which is the point of the gateway.

Short calls that each return a result

The limits page says code execution has a timeout that includes time spent calling other tools. I wanted a comfortable size for one call, so I ran a job that checks the machine and then sleeps for 45 seconds. It finished and returned everything it printed:

8.34 2
90 GiB free
slept 45.0
Enter fullscreen mode Exit fullscreen mode

That shaped how I write action_code jobs now: short steps that each finish and return their own result, chained by the agent. A sandbox call is cheap to start, so splitting a job costs almost nothing, and every step hands back something the agent can use. Long-running work belongs in a Harness Runtime session, which is built for it, with pause, resume and fork.

What I got wrong on the way

I assumed the gateway's DigitalOcean tools would use the DigitalOcean API token I already had. They don't. Action Gateway uses its own OAuth connection per provider and user, which keeps each connection scoped to the person who approved it. The error message above walked me through linking it.

Run it yourself

With Action Gateway connected to your MCP client, ask the agent to run this through action_code:

import os, shutil, time
print(open('/proc/uptime').read().split()[0], os.cpu_count())
print(shutil.disk_usage('/').free // 2**30, "GiB free")
t = time.time(); time.sleep(45); print("slept", round(time.time() - t, 1))
Enter fullscreen mode Exit fullscreen mode

What I'd do with it

  • Use action_search freely. It is free, and its first answer was right both times.
  • Keep each action_code call short and make it return a result, and give long jobs to Harness Runtime.
  • Link the provider accounts your agent will need before the first unattended run, so it doesn't stop on an authorisation prompt.
  • Set per-actor rate limits in the control panel before you let an agent loop. They're set per category from the Actors tab.

What impressed me most is how much I didn't have to build. One MCP connection gave my agent a tool search that found the right tool first time, a clean Linux sandbox for every run, and access to accounts without the agent ever holding the keys. That is the part of agent infrastructure I would otherwise be writing and maintaining myself, and Action Gateway handles it well.

Next I want to try the other half, Harness Runtime, and see how these sandbox numbers look when the whole agent runs inside it.

Top comments (0)