<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/running-self-hosted-ai-agents-63o5dx8vp" -->

---
title: Running Self-Hosted AI Agents | daily.dev
description: Oxide describes how to run Claude Code and Amp self-hosted AI agents as ephemeral virtual machines on its Oxide Cloud Computer. Instead of containers, an...
canonical: https://daily.dev/posts/running-self-hosted-ai-agents-63o5dx8vp
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Running Self-Hosted AI Agents | daily.dev
og:description: Oxide describes how to run Claude Code and Amp self-hosted AI agents as ephemeral virtual machines on its Oxide Cloud Computer. Instead of containers, an...
og:url: https://daily.dev/posts/running-self-hosted-ai-agents-63o5dx8vp
og:image: https://api.daily.dev/og/posts/63o5Dx8VP.png
og:image:alt: Running Self-Hosted AI Agents
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Running Self-Hosted AI Agents

**[Oxide](https://daily.dev/sources/oxide)** · 10 min read · 3 upvotes · 1 comments

## Summary

Oxide describes how to run Claude Code and Amp self-hosted AI agents as ephemeral virtual machines on its Oxide Cloud Computer. Instead of containers, an orchestrator VM provisions a fresh VM per agent session and tears it down afterward, since VMs offer stronger isolation than containers. For Claude Code, cleanup relies on a systemd service that runs poweroff when the agent exits, plus a separate reaper process polling the Oxide API for stopped VMs to delete. Amp's orb provider is simpler, supporting native pause and delete operations so it doesn't need to detect a stopped VM. Oxide says VM provisioning can take tens of seconds to minutes, creating cold-start latency, and it's exploring a microVM-inspired primitive to improve security, scale, latency, and cleanup.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://oxide.computer/blog/self-hosted-ai-agents>

## Questions this post answers

### Should I run self-hosted AI coding agents like Claude Code in containers or virtual machines?

Virtual machines are recommended over containers for self-hosted AI agents because they provide stronger isolation through a separate guest kernel, which matters since agents execute arbitrary tool calls. The tradeoff is slower startup (seconds vs. milliseconds) and larger size (GBs vs. MBs) compared to containers, but the isolation reduces risk of an agent damaging data or interfering with other agents.

_Weighing VM isolation against container speed for agent sandboxing is easier with daily.dev's technical deep dives._

### How do Claude Code self-hosted environments provision and clean up ephemeral virtual machines for each session?

An orchestrator VM runs the command 'claude self-hosted-runner orchestrator' with a '--hooks-dir' option pointing to a 'spawn-runner' hook that creates a new VM per work order. Cleanup is handled by configuring the VM to poweroff via a systemd service once the agent process exits, then a separate 'reaper' process polls the API for stopped VMs and deletes them along with their boot disks.

_Developers wiring up agent orchestration infrastructure can track these patterns as they evolve on daily.dev._

### How does Amp's self-hosted orb cleanup differ from Claude Code's self-hosted environment cleanup?

Amp orbs support native 'pause' and 'delete' operations through its dispatch contract, so there's no need to detect a stopped VM as a cleanup signal. 'Pause' deletes the instance but keeps its boot disk, while 'delete' removes both the instance and its boot disk, simplifying the architecture compared to Claude Code's approach, which requires a systemd poweroff hook plus a separate reaper process.

_Comparing agent provider architectures like this helps teams choosing a self-hosted setup on daily.dev._

## Community discussion

Top comments from developers on daily.dev.

**@kartiknvj** · 0 upvotes

> The reaper only looks for stopped VMs, so a Claude Code session that hangs and never exits never hits poweroff and keeps its VM. I'd give the reaper a max age as well and delete anything with the name prefix that has been running past it.

## Similar posts on daily.dev

- [Docker Sandboxes: Run Claude Code and More Safely](https://daily.dev/posts/docker-sandboxes-run-claude-code-and-more-safely-6ydoupfk7) · Docker · 1 upvotes · 0 comments
- [Coding Agent VMs on NixOS with microvm.nix](https://daily.dev/posts/coding-agent-vms-on-nixos-with-microvm-nix-srrlmefyj) · Lobsters · 0 upvotes · 0 comments

---

Tags: [#ai-agents](https://daily.dev/tags/ai-agents), [#infrastructure](https://daily.dev/tags/infrastructure), [#claude-code](https://daily.dev/tags/claude-code)

[View this post on daily.dev](https://daily.dev/posts/running-self-hosted-ai-agents-63o5dx8vp)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Running Self-Hosted AI Agents","url":"https://daily.dev/posts/running-self-hosted-ai-agents-63o5dx8vp","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/running-self-hosted-ai-agents-63o5dx8vp"},"datePublished":"2026-10-29T14:03:16.203Z","dateModified":"2026-10-29T14:16:28.683Z","description":"Oxide describes how to run Claude Code and Amp self-hosted AI agents as ephemeral virtual machines on its Oxide Cloud Computer. Instead of containers, an...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/facf40c97e2a5b12ace9eb86ab1397a9?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/facf40c97e2a5b12ace9eb86ab1397a9?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Oxide","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Oxide","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/a06afd0e0fbf40ec9d3128cd1c103021","url":"https://daily.dev/sources/oxide"},"commentCount":1,"discussionUrl":"https://daily.dev/posts/running-self-hosted-ai-agents-63o5dx8vp","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":3},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":1}],"keywords":"ai-agents,infrastructure,claude-code","timeRequired":"PT10M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Oxide","item":"https://daily.dev/sources/oxide"},{"@type":"ListItem","position":3,"name":"Running Self-Hosted AI Agents"}]}
{"@context":"https://schema.org","@type":"WebPage","@id":"https://daily.dev/posts/running-self-hosted-ai-agents-63o5dx8vp","comment":[{"@type":"Comment","text":"The reaper only looks for stopped VMs, so a Claude Code session that hangs and never exits never hits poweroff and keeps its VM. I’d give the reaper a max age as well and delete anything with the name prefix that has been running past it.","datePublished":"2026-10-30T13:35:01.781Z","url":"https://daily.dev/posts/63o5Dx8VP#c-A78UvZSwc","author":{"@type":"Person","name":"kartik-nvjk","url":"https://daily.dev/kartiknvj","image":"https://media.daily.dev/image/upload/s--3gGgsVCw--/f_auto/v1781456774/avatars/avatar_TvTVeiMdkRCqWUDullFmy?_a=BAMAMiWQ0"}}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/running-self-hosted-ai-agents-63o5dx8vp#faq","mainEntity":[{"@type":"Question","name":"Should I run self-hosted AI coding agents like Claude Code in containers or virtual machines?","acceptedAnswer":{"@type":"Answer","text":"Virtual machines are recommended over containers for self-hosted AI agents because they provide stronger isolation through a separate guest kernel, which matters since agents execute arbitrary tool calls. The tradeoff is slower startup (seconds vs. milliseconds) and larger size (GBs vs. MBs) compared to containers, but the isolation reduces risk of an agent damaging data or interfering with other agents. Weighing VM isolation against container speed for agent sandboxing is easier with daily.dev's technical deep dives."}},{"@type":"Question","name":"How do Claude Code self-hosted environments provision and clean up ephemeral virtual machines for each session?","acceptedAnswer":{"@type":"Answer","text":"An orchestrator VM runs the command 'claude self-hosted-runner orchestrator' with a '--hooks-dir' option pointing to a 'spawn-runner' hook that creates a new VM per work order. Cleanup is handled by configuring the VM to poweroff via a systemd service once the agent process exits, then a separate 'reaper' process polls the API for stopped VMs and deletes them along with their boot disks. Developers wiring up agent orchestration infrastructure can track these patterns as they evolve on daily.dev."}},{"@type":"Question","name":"How does Amp's self-hosted orb cleanup differ from Claude Code's self-hosted environment cleanup?","acceptedAnswer":{"@type":"Answer","text":"Amp orbs support native 'pause' and 'delete' operations through its dispatch contract, so there's no need to detect a stopped VM as a cleanup signal. 'Pause' deletes the instance but keeps its boot disk, while 'delete' removes both the instance and its boot disk, simplifying the architecture compared to Claude Code's approach, which requires a systemd poweroff hook plus a separate reaper process. Comparing agent provider architectures like this helps teams choosing a self-hosted setup on daily.dev."}}]}
```

