Est.

How Cloud Infrastructure Teams Wire Task Intake Systems Into Per-VM Agent Loops That Terminate as Pull Requests

Teams need VM isolation and intake-to-PR orchestration to run coding agents safely.

· 9 min read
Cover illustration for “How Cloud Infrastructure Teams Wire Task Intake Systems Into Per-VM Agent Loops That Terminate as Pull Requests”
Cloud Agent Environments · November 3, 2026 · 9 min read · 1,960 words

Isolated VM environments for cloud coding agents should cold-start for each task, keep model credentials separate from code execution, capture artifacts, and then destroy the task state. To run Claude Code or Codex safely in production, teams need orchestration that links task intake to those environments and ends each successful loop with a pull request that a human can review. The design must keep what agents can execute separate from what humans have the authority to approve.

Why "task in, pull request out" is an infrastructure problem, not just a prompt engineering one

A background coding agent does more than produce text. It reads files, runs commands, installs packages, and executes tests before an engineer sees the diff. A better prompt cannot supply the isolation boundary, credential scope, or cleanup process that execution requires.

Three developments make autonomous task completion tractable, namely fast-starting per-task VMs, harness-level orchestration, and models capable of completing work without intervention at every step. Capability alone is insufficient. The infrastructure must connect a task to the right environment, constrain what the agent can reach, and preserve its output for review.

How should teams isolate cloud coding agents safely, and why are containers not enough?

Standard Linux containers, gVisor, Kata Containers, and Firecracker microVMs offer different trade-offs in startup latency, isolation strength, and operational complexity. Containers isolate filesystems, process trees, and network namespaces, but share the host kernel. That shared kernel is the critical distinction. For an agent executing arbitrary generated code, filesystem separation alone does not provide the VM boundary appropriate to untrusted execution.

The choice depends on the workload and operating environment. gVisor fits teams prioritizing Kubernetes integration and stronger-than-container isolation, with partial syscall compatibility as a trade-off. Firecracker or Kata fits production agent workloads executing untrusted code. Firecracker's fast cold starts make per-task microVMs affordable even when there are many tasks, but the test of when they are ready is strict. The VM needs to be ready before the agent's first command.

The strongest architectural separation is between the brain and the hands. The brain talks to the model API outside the sandbox and holds the API key. The hands perform shell commands, tests, file edits, and package installation inside a locked-down VM with no secrets and restricted network access. This split keeps model access outside untrusted execution. It also establishes where the harness and execution environment meet, without granting generated code access to the whole cloud environment.

The sandbox lifecycle: cold-start per task, capture artifacts, destroy state

A sandbox must follow a strict create, run, capture, destroy sequence. It begins with an environment scoped to a specific task or PR and a snapshot of the relevant code. The agent runs there, after which the system captures the diff, test results, and generated files before destroying the sandbox and wiping its state.

The environment must never be reused across unrelated tasks. State caching for sequential work can improve performance, but it does not justify exposing another task to leftover files or credentials. The same lifecycle must also control the network and resources. Default-deny egress permits only explicitly required destinations, such as package registries, while CPU, memory, ephemeral storage, and process count limits constrain runaway execution.

The propose/dispose pattern extends this separation into CI permissions. The job running the agent has contents-read access and no deploy secrets, while the job allowed to write sits behind an environment requiring human reviewers. Approval comes before any credential is issued. The two-job design uses permissions to enforce the boundary, so it does not rely on the agent to hold itself back. It separates producing a proposed change from authorizing a consequential write.

What the harness contributes: how Claude Code, Codex, Cursor, and OpenCode handle the VM and what teams must supply themselves

Harness choice determines which protections a team inherits and which infrastructure it must operate. Claude Code uses Bubblewrap on Linux and Seatbelt on macOS, enabled through /sandbox or sandbox.enabled in settings.json. Bubblewrap is also used by Flatpak. These controls do not remove the team's responsibility to provide a VM boundary for CI execution.

OpenAI Codex enables sandboxing by default. On Linux, it combines bubblewrap for filesystem and namespace isolation with seccomp for syscall filtering, retaining Landlock only as a legacy fallback. That default reduces the setup burden for sandboxed execution. Codex is optimized for throughput across parallel tasks, although /goal also supports long-running sessions. Neither characteristic eliminates the need to understand the boundary supplied by a particular deployment.

OpenCode takes a different ownership approach. It is permissively licensed TypeScript, supports multiple providers and local models, and is free with the team's own model. It uses AGENTS.md for project instructions and provides full MCP support. Because it is self-hosted, the team owns the entire VM boundary.

For automated or shared deployments using Claude Code, local Cursor, or a custom harness, VM isolation remains the team's job. Codex and managed cloud agents shift more responsibility to the vendor, with less environment customization. Harness-agnostic orchestration preserves the ability to change that allocation. It lets teams switch harnesses without tying task intake and the handling of output to a single agent.

The intake layer: how work moves from Slack, Linear, GitHub, and GitLab into a VM

Intake turns delegation into part of an existing workflow. Slack mentions, Linear assignments, GitHub or GitLab issue assignments, webhooks, schedules, and API calls provide different entry points to the same execution system. Each must resolve into sufficient context to start work, including the repository reference, branch, environment specification, and credentials scope. Without those fields, a person still has to fill in the missing details at runtime.

GitHub issue assignment illustrates the complete path. Assigning an issue to an agent triggers orchestration to boot a VM, clone the repository, and run the harness. The resulting PR links back to the issue. Branch protection and required code-owner review then prevent the agent from merging its own output, so intake does not imply permission to ship.

Linear's GitHub integration links the work back to planning. A commit message or PR description containing Fixes ENG-123 links the work to the corresponding issue. Linear can be configured to move the issue to “In Review” when the PR is created and “Done” when it merges. The status change makes delegated work visible. It distinguishes implementation completed by the agent from acceptance completed through review.

Slack and scheduled triggers broaden that pattern to recurring maintenance, remediation waves, and backlog work without requiring a developer to initiate every task. A mention or schedule invokes the same VM boot and harness run as a manual assignment. Webhooks and APIs extend intake beyond native integrations. Their architectural value is that another project tracker can supply the same structured task payload through the same execution path.

The output contract: why the pull request is the right termination condition for an agent loop

A pull request gives the agent a clear point at which to stop. Its diff is inspectable and can be accepted or rejected by an engineer who was not present during execution. A running conversation has no equivalent handoff boundary. Branch protection and required code-owner review make that distinction enforceable by preventing the agent from merging its own proposal.

The review package must survive the sandbox that produced it. The test results and generated files that were captured give the reviewer more to go on than the patch alone. For teams using full-stack environments, the PR can also include a link to a running preview where the change can be assessed end-to-end. That evidence supports review without preserving the task VM. The agent's execution environment and the human's review surface serve different purposes.

A run ending in a PR can be connected to its trigger, harness, model, credentials consumed, and eventual shipped change. Interactive line suggestions lack that discrete agent-completion event. The PR-termination design therefore provides a basis for attributing delivered work, rather than merely recording that an AI tool was active.

What to measure once the loop is running: agent leverage, not agent activity

Commit counts, lines of code, and story points become unreliable proxies when agents can increase them without delivering corresponding value. More activity is not necessarily more useful output. Evaluation instead needs delivery measures such as lead time, deployment frequency, and the DORA set, quality measures such as change failure rate and code churn, and leverage. Leverage measures how much output, including what agents shipped, comes from each unit of real effort.

A developer completing a feature in focused hours with agents running contributes a different amount of manual effort from one spending many hours implementing the same feature. DORA metrics cannot reveal that difference by themselves. Throughput must also be weighed against change failure rate and churn, because code quality does not automatically improve when more people use assistants.

The architecture supplies the records needed for this comparison. Harness-level attribution can connect coding activity to commits and PRs, while tracing can connect prompts, tool calls, model choices, and token spend to tickets and production results. A per-task VM gives orchestration a known harness, model, and credential scope for each run. Captured artifacts and the PR then identify what it produced.

Handling long-running tasks: context management and the failure modes that kill agent loops

Long tasks test whether orchestration can keep the work on track beyond the model window. Context overflow loses needed information when the window fills, while context drift preserves recent actions but loses the original intent or earlier architectural decisions. State loss is a separate failure. It occurs when a VM is destroyed before its artifacts have been captured, regardless of how well the model retained context.

Checkpointed subtasks address overflow by making progress durable. Each subtask ends with a captured artifact, such as a diff, a passing test suite, or a written decision record. The next invocation loads that output as context. Continuity comes from artifacts across separate sessions. This makes task decomposition an orchestration responsibility.

Drift requires preserving intent as well as progress. Every subtask invocation needs the original task description and architectural constraints alongside the most recent tool calls. AGENTS.md, used natively by OpenCode and adoptable by other harnesses, provides one mechanism for persistent project instructions across VM boots. Artifact capture must also remain a required step before teardown. A fresh environment is useful only if the work needed to continue exists outside it.

Putting the layers together: the repeatable architecture from intake to PR

The contracts between layers make this architecture repeatable. Intake produces a structured task payload, orchestration selects the harness and boots the environment with the required context, and isolated execution produces captured artifacts before teardown. Output turns those artifacts into a reviewable PR with an attribution record. Each handoff has a defined purpose. Missing context blocks execution, missing isolation exposes shared infrastructure, and missing capture destroys the evidence needed for review.

The hardest connection is between intake and orchestration. A Slack message or Linear issue must resolve into enough information to configure the VM deterministically, without runtime assistance from an engineer. Building the stack means owning that translation together with webhook handling, harness routing, VM lifecycle management, artifact capture, and attribution. A managed platform shifts those responsibilities. Teams that take that route still need to check that the platform's integration points work with their workflow tools and let them choose their harness.

The cloud platform approach makes this a team operating model. Its value is not simply running more agents, but giving their work consistent execution boundaries, review surfaces, and attribution across the engineering organization. Harness independence keeps those contracts from being tied to one agent as what models can do changes. Engineers retain the decisions that authorize change. Agents handle implementation, maintenance, and review work within the boundaries provided, then return something a human can inspect and merge.

More in Cloud Agent Environments