Stateful vs Stateless Agent Environments
Coding agents need persistent state, and stateless runtimes can't supply it.

A coding agent assigned to a real engineering task, a multi-file refactor, a dependency upgrade, a bug hunt across a codebase with dozens of interdependent modules, fails in a specific and repeatable way when it runs inside a stateless environment. If the environment is stateful, the agent finishes the job, but if it is stateless, it loops forever rediscovering what it already knew.
Why Stateless Architectures Fail Coding Agents
An agent tasked with refactoring a codebase begins making progress: it reads files, forms a plan, starts editing. Then it hits the context window limit. The task does not fail because the model got something wrong. It fails because nothing in the environment compensated for the model's own statelessness between calls.
Stateless architectures were built for a different kind of work: atomic, high-throughput, single-shot requests like classification or extraction, where discarding everything after each call is the entire point. A coding agent that does the same thing is failing at its job, because each step in a coding task depends on what the previous step produced, discovered, or changed. The environment has to carry that continuity forward, or the agent has nowhere to stand.
Stateless, Stateful, and Hybrid Environments for an Agent Runtime
The distinction between stateless, stateful, and hybrid runtimes describes what happens around the language model call, not inside it. Every LLM call is stateless by nature, a single request and a single response, with no memory of its own. That continuous feel comes entirely from the layer surrounding that call, not from the call itself.
A stateless agent treats each request as complete in isolation. Operational simplicity and horizontal scaling are the advantages of a stateless agent. But a stateless design that resends the full context on every call trades that simplicity for a steep increase in token spend, and it forfeits the prefix-caching advantage that a stateful runtime can exploit instead.
A stateful agent persists context in a durable store and reconstructs it on every subsequent call. A multi-turn coding assistant tracking a repository's state over hours of work needs exactly this pattern: the files already read, the changes already made, the plan already formed all have to survive between invocations.
The hybrid pattern is the practical default for most production agents: a stateless language model wrapped by a stateful runtime that manages session, memory, and tool state on the model's behalf. This separates the reasoning step, which the model performs fresh each time, from the state that reasoning depends on, which the runtime carries forward. State under this pattern is not a single blob but a set of tiers. Run or session state lives for the duration of one task, keyed by session ID, and dies when the session ends. Conversation state holds message history and intermediate reasoning across turns, but only within one interaction. User state carries preferences and account context across sessions. Long-term memory stores durable knowledge accumulated over time, often embedding-based and queried by similarity. The storage, caching, and tracing architecture all follow from this first decision. Teams that defer it and try to retrofit session memory into a stateless design usually end up rebuilding the orchestration layer from scratch.

Why Stateful Runtimes Fail at Scale
Choosing stateful or hybrid solves continuity, but the system develops a new failure mode once it runs under real load. Routing causes it, even though it looks like memory loss from the outside.
The fix is centralized caching, Redis or an equivalent, or pinned sessions, so that state is available to whichever instance picks up the next request rather than tied to the one that started the conversation. Prefix caching earns its keep here because it only works reliably when agent state is centralized and accessible to any instance handling the next request, and systems that persist sessions in a durable, shared layer, whether through Redis or by pinning sessions to dedicated compute, avoid the localized amnesia that distributed stateful runtimes otherwise introduce under load.
Concurrency raises a separate and genuinely harder problem. When parallel agent sessions touch overlapping files or shared workspace state, you need explicit coordination to avoid conflicts, and the runtime choice alone cannot give you that. It depends on how a team structures the agent's tasks. Debuggability is the third piece: every state mutation should be traceable, and correlating LLM calls, tool calls, and state changes with persistent trace IDs makes stateful agent behavior legible in production. Production systems converge on a pattern that pairs traditional function-as-a-service infrastructure for stateless event routing with a specialized platform for the stateful execution layer: stateless glue for coordination, a stateful environment for the agent actually doing the work.
What a coding agent environment needs, and why standard serverless cannot provide it
Standard serverless function-as-a-service platforms were designed for stateless request and response patterns, and they terminate environments after each invocation. That design destroys any workflow that depends on persistent state, and that is almost everything a coding agent does.
A coding agent session involves dozens or hundreds of execution steps, each shaped by what ran before it. Filesystem changes have to survive between steps within a single session. You get package installations, running services, and browser interactions, not just text generation. It involves external API and tool calls that require scoped outbound networking. The environment needs to support stateful execution within a session while remaining ephemeral across sessions, and those two requirements are not in tension: they simply operate at different scopes, one bounded by the task, the other bounded by the session's lifetime.
Standard ephemeral sandboxes were built for discrete, one-shot execution: a task runs, produces output, and the environment gets destroyed. When a task runs for hours, agent workloads violate that assumption at every step. The infrastructure underneath all of this also has to resume quickly, preserve filesystem and memory state across invocations within a session, and stop charging during idle time, capabilities that standard FaaS platforms do not offer by design, because they were never built to.
Isolation models: why the security boundary matters as much as the state boundary
Agent-generated code changes the threat model in a way human-authored code does not. The code running inside the environment is produced by a model at runtime and cannot be fully predicted or controlled in advance, which makes the environment's isolation boundary a security control in its own right, not merely an operational nicety. Container-level isolation carries real risk here: containers share the host kernel, and a kernel vulnerability can expose the host node along with every other session running concurrently on it.
Three isolation models hold up for production agent execution. For multi-tenant settings where multiple agents share infrastructure, the combination that holds up is Firecracker or Kata isolation, ephemeral sessions, default-deny networking, and state stored externally. Networking is its own axis of this problem. Agents need outbound access for tool calls and API calls, full lockdown breaks legitimate operation, and open access creates exfiltration risk, so the answer is scoped outbound networking rather than a choice between fully open and fully closed.
How Major Coding Agent Tools Handle State
Claude Code is a terminal CLI, and you can run it on your local machine or in a configured remote environment. It manages session state through a layered memory system: project-level instructions, persistent learnings, user preferences, organization policies, conversation transcripts stored in JSONL format, and multi-project isolation through path-encoded directory names, where the absolute path has its slashes replaced by hyphens.
Codex, built by OpenAI, is a terminal CLI alongside macOS and Windows apps, built for parallel, asynchronous execution. It uses Git worktrees to queue separate tasks in parallel without merge conflicts. The stateful artifact that persists is the pull request itself, not an ongoing session. Codex supports OpenAI models by default but also supports third-party and open-source models through an OSS mode and custom providers, including Ollama, LM Studio, DeepSeek, and Amazon Bedrock.
Each of these harnesses makes its own tradeoff about where state lives and how long it persists, and that shapes which tasks it handles comfortably and which ones push past its design.
Running harnesses inside isolated cloud environments rather than on developer machines
The harness a team picks and the environment that harness runs in are two separate decisions, and conflating them, treating whatever execution context a tool defaults to as the only one available, leaves real capability on the table. Running Claude Code, Codex, Cursor, or Opencode on a local developer machine ties the agent's stateful environment to that machine's dependencies, its filesystem, its network access, and its availability. Close the laptop, and the task dies with it.
Cloud agent environments remove that constraint by pre-loading a team's dependencies and tooling into an isolated VM, so the agent can install packages, run services, drive a browser, and verify its own work without touching anyone's local machine. This is precisely why platforms built to run coding agents at scale, Replicas among them, isolate each agent task in a stateful Linux VM rather than treating every call as a discrete, stateless request: the environment itself becomes the continuity layer that a purely stateless architecture cannot supply. A harness-agnostic cloud platform lets a team delegate a task to whichever agent fits the job, Claude Code for one, Codex for another, triggered from Slack or Linear, and get back a pull request without changing how the team already works. Replicas runs Claude Code, Codex, Cursor, and Opencode inside isolated, fully configured Linux VMs, triggered from Slack, Linear, GitHub, or GitLab, returning pull requests or recordings, with analytics that attribute every minute an agent runs down to the source, the person, the harness, the model, and the credential behind it. That attribution matters most for long, stateful sessions, where a team needs to inspect what an agent actually did across hours of work, not just what it eventually produced.
Integrating stateful agent environments into existing engineering workflows
A stateful environment only pays off if engineers can reach it from where their work already happens, and if what comes back fits into the review process they already use. An environment that demands a separate login, or returns output in a format nobody on the team recognizes, cancels out a meaningful share of the productivity gain it was built to deliver.
Slack Code, launched August 20, 2026, is the most visible example of this kind of integration. It embeds AI coding agents directly into dedicated Slack channels, supporting Claude Code, GitHub Copilot, Cognition's Devin, OpenAI's ChatGPT, and Vercel's agent, letting entire teams watch, steer, review, and ship software without leaving Slack. Once a coding task finishes, the channel archives automatically, leaving behind a linked record of the work and the discussion around it. Linear Agents let workspace members assign issues directly to third-party AI coding tools, including Cursor, GitHub Copilot, and Devin, the same way they would assign a human teammate, with the underlying coding work billed by the agent provider. Linear added coding sessions powered by Claude Code and Codex in June 2026, each one grounded in workspace context pulled from issue details, history, customer requests, and related discussions. Its Code Intelligence feature, launched in May 2026, gives Linear's agent controlled access to the codebase itself, turning the repository into shared product context the whole team can draw on, so the agent reasons about how the product actually behaves rather than only what the issue tracker says about it.
Warp's "Wilson" workflow is the clearest published example of what a complete integration looks like end to end: a public Slack request creates a Linear issue, the agent implements the change, opens a GitHub pull request, and completes QA using computer-use verification along with a proof video of the finished feature. That handoff works only because a stateful environment carries context from the Slack message through the Linear issue through the implementation through the verification step. Output format is what makes any of this usable day to day: pull requests, recordings, and inline replies are all things a team can review and act on without learning a new tool, while output in any other shape imposes a workflow change nobody asked for.
Measuring what stateful agent environments produce
Stateful agent environments produce real gains, but the metrics teams already track, pull requests per week, lines of code, commit counts, inflate under agent output in ways that do not map cleanly onto value delivered. Doctolib rolled out Claude Code across its entire engineering team, and now it ships features faster. TELUS built a large number of custom AI solutions, and it also shipped engineering code faster. Both results rest on a team-wide rollout that a consistent, managed environment made possible, not on any single clever prompt.
A Rakuten evaluation gives a sharper picture of what a stateful environment makes possible at the extreme end: Claude Code was given the task of implementing an activation vector extraction method inside vLLM, a codebase of 12.5 million lines, and finished in seven hours of autonomous work with high numerical accuracy. Agent mode specifically changes what needs measuring, since sessions where multi-step tasks get delegated with minimal human checkpoints produce the largest diffs and the widest variance in quality.
The signals that matter for agent work are not the ones standard engineering metrics track. The share of agent-created pull requests in the overall PR mix shows how much of the team's output comes from agents. That is the real distinction between the two environment types. A stateful environment that records what an agent did lets a team trace an outcome back to its cause. A stateless environment that restarts from zero does not just fail to finish the task, it leaves nothing behind to show what it tried.


