WritingDigitalOcean (GradientAI)DigitalOcean (GradientAI)published Nov 18, 2026seen 1w

Build an On-Call Team of AI Agents on DigitalOcean MicroVMs

Open original ↗

Captured source

source ↗

Build an On-Call Team of AI Agents on DigitalOcean MicroVMs | DigitalOcean

Engineering

Build an On-Call Team of AI Agents on DigitalOcean MicroVMs

By Kushal Walia and Calin Lupa

Published: November 18, 2026 18 min read

its own MicroVM specs = per_subagent_specs( SUBAGENTS, backends=files_only, default_model=strong_model )

(the full file also gives each role its own tools and adds the remediator)

commander = create_deep_agent( model=strong_model, system_prompt=SYSTEM_PROMPT, subagents=specs,

the commander sees /subagents//, files only

backend=sandboxes.mount(StateBackend()), )

The boundary between investigators is a MicroVM with its own kernel, not a separate directory or a shared container. A mistake in one stays inside it; we show this with rm -rf / in the failure section below.

We also limit what an investigator can do inside it:

The investigators have no shell : They reach their MicroVM through a FilesOnly backend, which can read and write files but cannot run commands, so Deep Agents never offers the model an execute tool. Instead, each investigator gets a small set of purpose-built tools that run fixed analysis scripts installed in the MicroVM. The model decides when to call them, but not what they do.

No credential for an outside system enters a MicroVM : The investigators’ tools run on the server that hosts the agents, not inside the MicroVM. They read the commit history through Action Gateway, and the service’s metrics over HTTP, then write the results into the MicroVM’s /data/ directory. The Infra investigator reads the Droplet and its snapshots through the gateway from outside the MicroVM too, and gets the results directly rather than as a file. Anything running inside a MicroVM can read the variables and files it was given, so we don’t give it any credentials for outside systems. The only credential in a MicroVM sandbox is a key for its own file and command server, unique to that MicroVM and useless anywhere else.

The first seconds: investigators clone from a checkpoint

Each investigator needs a prepared environment before it can work: data uploaded, packages installed, and helper scripts copied in. Building that from scratch takes time, and an active outage is the worst time to pay that setup cost three times over.

MicroVM checkpoints remove most of that wait. You prepare a temporary MicroVM once and checkpoint its memory , files, and running processes. When an incident hits, the package clones all three investigator sandboxes from that checkpoint simultaneously. TemplateCache keeps the template ready, so they start work in seconds:

examples/09_incident_response/agent.py

def seed_files() -> list[tuple[str, bytes]]: """What every investigator's MicroVM starts with: the analysis helpers.""" return [ (f"/tools/{script.name}", script.read_bytes()) for script in sorted(SANDBOX.glob("*.py")) ]

Built (or its checkpoint found) once per process;

rebuilt once if the checkpoint is deleted meanwhile.

templates = TemplateCache( lambda: lifecycle.build_template("incident", seed_files=seed_files()) )

build_template also accepts setup commands, such as setup=["pip install matplotlib"] , so dependencies are installed once and baked into the checkpoint. The template is keyed on a hash of its inputs, so any change to them builds a fresh template. Because it is stored as a checkpoint rather than a running MicroVM, it doesn’t count against your team’s MicroVM limit. The heavier the setup, the more cloning a template saves.

The decision: a human approves, and the fleet pauses

Within minutes of the alert, with most of that time spent waiting on model responses, the commander has its diagnosis: when the errors started, the commit and line of code that broke it, and the cleanest snapshot to roll back to.

The fix is to restore the Droplet from that snapshot, which overwrites the entire disk and cannot be undone. That requires human sign-off.

Requiring human approval with an Action Gateway policy

“Ask a human first” can’t live in a prompt that a model might ignore. It has to be enforced by a policy layer outside the agents. This build uses DigitalOcean Action Gateway to run external operations on the agents’ behalf. Because the gateway holds the connected credentials (in this case, GitHub and the DigitalOcean API), the agents never touch those secrets.

Every action falls into one of three tiers:

examples/09_incident_response/policy.yaml

Three tiers; anything not listed is denied.

allow: # the investigators read

  • github_list_commits@5
  • github_compare_commits@4
  • digitalocean_droplet-get@3
  • digitalocean_image-list@2

ask: # a human decides first

  • digitalocean_restore-droplet@3

deny: # refused, whoever asks

  • digitalocean_droplet-delete@3

Any policy layer that holds credentials and can signal when approval is required works the same way.

Only the remediator holds the tool that invokes external actions, so its Droplet restore request hits the ask tier. The gateway holds the action and flags that a human must approve it. The integration package turns this into a native LangGraph interrupt, which pauses the run and surfaces the proposed action, its arguments, and the supporting evidence.

The approval console doesn’t take the agent’s word for what it’s touching. It looks up the Droplet and snapshot names itself, through the gateway, and shows them next to the request. Once you approve, the console posts your decision with its own token (no agent has an approval tool) and resumes the graph with LangGraph’s Command(resume=...) . In production, put this behind SSO and require a second approver for destructive operations, because a shared token only records that an action was approved, not who approved it.

Pausing MicroVMs while waiting for approval

Pausing at the approval gate also saves money. When the interrupt ends the run, the package pauses every MicroVM the investigation used, in seconds. A paused MicroVM keeps its memory, files, and running processes, and only its disk bills .

Every MicroVM pauses while a person decides, so the wait bills only for storage.

A human reviewing the evidence can take minutes, longer than the agents’ whole investigation. With MicroVMs, the waiting is the cheap part: compute bills per second only while a MicroVM runs, and a paused one bills only for its disk. Rates are on the MicroVMs pricing page .

Once approved, the...

Excerpt shown — open the source for the full document.

Notability

notability 5.0/10

Substantive tutorial from DigitalOcean on AI ops