Blog / Agent Infrastructure

How to Run Self-Hosted AI Agents on Six Clouds

An overhead clay ocean scene with an orca swimming among six colorful tidal pools connected by sculpted currents.

Can your AI agent move to another cloud without a rebuild?

With II Agent Runtime, yes. Self-hosted AI agents run on infrastructure you control. Where your coding agent runs is one setting. Pick AWS, Azure, GCP, OCI, DigitalOcean or Hetzner, and your agent runs there in the same isolated container, with the same permissions and the same keys. Change the setting later, and it runs somewhere else.

Cloud providers keep leapfrogging each other on prices, credits, regions and new features. Your agents should be able to follow, without a migration project every time.

Key takeaways:

  • Six clouds, one setting. AWS, Azure, GCP, OCI, DigitalOcean and Hetzner all sit behind the same hosting setting.
  • Your agent stays the same. Its image, its harness and its permissions don't care which cloud it lands on.
  • Nothing is left running. Every run gets a fresh machine, and it's gone when the run ends.
  • Your keys stay home. Model and GitHub keys never leave your side; the agent only ever talks to your gateway.
  • It's open source. Clone it, run it, and help decide where agents can run next.

Clone it yourself

We have a tool built on this: Software Factory. File a GitHub issue, and an agent opens the pull request. You need Node.js 22.16 or later, the GitHub CLI, Docker, and a GitHub organization you own.

git clone https://github.com/intelligent-iterations/ii-agent-runtime.git
cd ii-agent-runtime
docker buildx build --platform linux/amd64 --build-arg CODEX_VERSION=0.159.2 \
  -t ghcr.io/OWNER/software-factory-worker:codex-0.159.2 --push example/software-factory/worker-image
example/software-factory/onboard.sh --worker-image ghcr.io/OWNER/software-factory-worker@sha256:<digest>

Your agents start out on GitHub's runners. When you want them on your own cloud, it's one setting in the hub's policy file (how to set it).

Why does cloud freedom matter for agents?

Agents are getting real work: fixing bugs, opening pull requests, touching production. That work needs compute, and the best place for it keeps changing. One cloud has the credits, another has the region your data has to stay in, a third ships the feature you've been waiting for.

Most agent setups weld the agent to the machine it runs on. II Agent Runtime keeps them apart: what your agent is and what it's allowed to do live in one place, and where it runs lives in another. So moving clouds is a setting, not a rewrite.

Stays the same on every cloud

  • Agent imagesame
  • Harness, such as Codexsame
  • Permissions and grantssame
  • Model and GitHub keysyour gateway

Configured once, outside the hosting block.

Changes with the cloud

  • Provider6 options
  • Machine image and sizeper cloud
  • Network and firewallper cloud
  • SSH user, key and host keyper cloud

All of it inside environment.hosting.

Figure 1. Switching clouds changes only the hosting block. Everything about the agent stays where it was.

What happens when your agent runs?

Each run gets a fresh virtual machine in the cloud you picked. Your agent starts inside the same locked-down container it uses everywhere, and it can talk to only one thing: your gateway, which holds the keys. When the run ends, the machine is destroyed. No idle servers, no leftover access, nothing to clean up by hand.

Your machine

Runtime and gateway

Holds
Model, GitHub and cloud keys
Does
Creates the VM with OpenTofu

Your chosen cloud

A fresh VM for this run

Runs
Your agent in Docker or OpenShell
Reaches
Only your gateway

Afterwards

VM destroyed

Removed
The worker, then the VM
Kept
A run report and a cleanup receipt

AlwaysIf creating the VM fails partway, the runtime still tries to destroy it, and reports any cleanup it couldn't finish.

Figure 2. One run on any of the six clouds: a fresh VM, the same isolated agent, and nothing left behind.

Frequently asked questions

Do I have to rebuild my agent to switch clouds?

No. You change the hosting setting and nothing else. The agent image, the harness and the permissions stay exactly as they are.

Will my API keys end up on a cloud machine?

No. Your model and GitHub keys stay with the gateway on your side, and the agent's container can reach only that gateway.

What's next?

More places to run agents. Cloudflare, Render and Fastly are next on the compatibility list, and because II Agent Runtime is open source, you can help build them.

Built on II Agent Runtime

This is II Agent Runtime, open-source infrastructure for the agents your team already uses. Pick a cloud, keep your agent, and star the repo to follow where it goes next:

intelligent-iterations / ii-agent-runtimeSecure. Deploy. Measure. Open infrastructure for agent harnesses. View on GitHub