Environment Engineering · Prologue

The World Around the Agent

Why production AI teams must design not only the agent, but the world it acts inside.

Series entrance Continues · Harness Engineering Next · Episode 01 — Begin With Consequence
Before you read

Harness Engineering answered a foundational question: what must exist around a model before its output becomes dependable work? Eight episodes moved from failure diagnosis through harness anatomy, patterns, paradoxes, economics, the Monday-morning kit, organizational redesign, and the habits that outlast any single model release.

That argument holds. This series does not revise it. It continues it.

Harness Engineering governs the journey from reasoning to a permitted action. Environment Engineering governs the world that action lands in. Different discipline. Different owners. Different failure modes. Different artifacts.

The bridge already exists. Harness Engineering — and its environment companion, currently being rewritten — drew the map: environment as the action-to-consequence boundary, the separation of runtime from execution surface from business system, and a comparison of managed, hybrid, composed, and customer-operated configurations.

That companion is the overview. This series is the depth. The companion asks who operates each part of the environment. The series asks what each part must guarantee before an agent is allowed to work. Reading either helps. Neither is required.

00Three rooms, one sentence

A support agent receives an instruction:

Resolve this customer complaint.

Nothing about that sentence changes across the three deployments below. Same model. Same prompt. Same tool definitions. Same harness policy.

Room one
Nothing leaves

The agent reads a synthetic customer record and drafts a response into a text file. A reviewer reads the file. Nothing leaves the room.

Room two
Recommends, cannot send

The agent reads the customer’s real history from the live CRM. It drafts a response and attaches a recommendation: refund ₹8,400. A human approves or rejects.

Room three
Acts, unaccompanied

The agent reads the live record, issues the refund through the payments API, sends the email, and updates the account status. No human stands in the path.

Three products. One intelligence.

The industry habitually calls this difference autonomy level — as though room three simply has the leash let out further. That framing costs money, because it locates the difference inside the agent. Nothing inside the agent changed. Four things outside it did:

These are not attributes of the model. Not of the prompt. Not really of the tool either — the same issue_refund function can exist in all three rooms; in two of them it simply points somewhere harmless.

They are attributes of the environment. And in most organizations, nobody has written them down.

01The layer beneath the diagram

Open almost any agent architecture diagram from the last two years and you will find some version of this:

THE USUAL DIAGRAM
User → Model → Tools → Result

Sometimes a memory store hangs off the side. Sometimes an orchestrator box appears. The diagram is not wrong. It is incomplete in a specific and expensive way: it shows the path of intent but not the surface of consequence. The complete picture has four layers.

THE FOUR LAYERS
MODEL         proposes what could be done
HARNESS       decides what may be attempted
TOOL          converts the decision into an operation
ENVIRONMENT   supplies the world, absorbs the effect,
              and preserves the evidence

The fourth line is this series. Its three verbs are deliberate.

Supplies the world. Before the agent reasons at all, something decided which repository it sees, which customer records exist, which services respond, what the clock says, and whether any of it is current. Reasoning is only as good as the world it was handed.

Absorbs the effect. When the operation executes, something real changes — a row, a balance, a deployment, a customer’s inbox. The environment determines whether that change is contained, reversible, visible, or permanent.

Preserves the evidence. Afterward, something must answer: what did the agent see, what did it attempt, what actually happened, who authorized it. If the only answer lives in a model transcript, the organization has a story, not a record.

This decomposition is not a private taxonomy. The field converged on it independently.

Anthropic’s Managed Agents documentation treats environment as a first-class configuration object — a reusable container template defining packages, network access, and mounted files — and session as a per-task running instance of an agent inside that environment. Their engineering write-up goes further, describing a deliberate virtualization of three components: a session (the append-only log of everything that happened), a harness (the loop that calls Claude and routes tool calls to infrastructure), and a sandbox (where code runs and files are edited).1

OpenAI’s sandbox agents guide draws the same seam from the other side, separating the harness — which owns the loop, model calls, tool routing, approvals, tracing, recovery, and run state — from the compute, which owns files, commands, mounts, and snapshots.2

Databricks describes the harness as scaffolding around the model, and the sandbox as the isolated workspace keeping agent code from touching real systems unchecked.3

Three organizations with no incentive to agree, publishing the same boundary. That usually means the boundary is real.

02Four words that are not synonyms

Four terms get used interchangeably in agent conversations. The confusion is not academic — teams buy the wrong product and audit the wrong layer because of it.

Term What it actually is The question it answers
Context Information assembled and shown to the model What does the agent know?
Tool An interface through which the agent requests an operation What can the agent ask for?
Harness The control system deciding whether and how to proceed What is the agent allowed to attempt?
Environment The world where operations acquire real effects What does the attempt touch, and what remains after?

Concretely, using a database:

The practical difference: context can tell a model that production deployment is frozen. Only the environment can remove the production credential from the runtime.

Instructions shape behavior. Environments constrain possibility. Production systems need both.

The sandbox substitution is the expensive one

The most common error in practice is substituting sandbox for environment. A team says “the agent is sandboxed” and considers the question closed. It is not closed. A sandbox is one control within an environment, constraining one dimension of it.

OpenAI’s Codex documentation states the split precisely: sandboxing and approvals are different controls that work together — the sandbox defines technical boundaries, while the approval policy decides when the agent must stop and ask before crossing them.4

You can watch this separation in the actual product surface. Codex ships three sandbox modes and three approval policies as independent settings:5

Codex — sandbox mode (rows) × approval policy (columns)
untrusted on-request never
read-only Cannot write; asks constantly Minimum reach · maximum interruption Cannot write; asks to escalate Cannot write; silently blocked
workspace-write Writes locally; asks to leave Writes locally; asks to leave Writes locally; never asks
danger-full-access No technical limit; asks anyway No technical limit; asks sometimes No limit, no pause Maximum reach · zero interruption
Nine configurations. Read the corners: top-left is a system that can barely act but interrupts constantly. Bottom-right is a system with unrestricted host and network access that never stops to ask.5

These are not points on one autonomy dial. They are two orthogonal decisions:

The sandbox governs reach. The approval governs consequence. Neither substitutes for the other.

Anthropic’s Claude Code sandboxing makes a parallel point by shipping filesystem isolation and network isolation as two distinct boundaries rather than one setting — because isolation is not a single property that is either on or off.6

An independent threat-model analysis states the limit more bluntly: a sandbox protects the host from the agent’s environment, but does nothing to protect the agent from poisoned context, mounted secrets, or filesystem visibility of things it was never meant to see.7

So “we sandboxed it” leaves all of this unanswered:

Those are environment questions. The sandbox answers roughly one.

03Managed does not mean transferred

The second expensive substitution is managed for accountable. When a platform runs the infrastructure, teams reasonably assume the consequence question moved with it. Read the documentation closely and a different picture emerges — one the vendors themselves state plainly.

Anthropic’s self-hosted sandbox option keeps tool execution, the filesystem, and network egress inside your infrastructure, while orchestration remains on Anthropic’s side; the environment worker on your infrastructure receives tool-execution requests from the control plane.1

Execution locality, information visibility, and decision authority are three independent properties. Vendors sell them bundled. Enterprises must evaluate them separately.

Run the comparison and the bundle comes apart:

Configuration Where code runs What crosses the platform boundary Which control plane chooses the next action
Anthropic cloud sandbox Anthropic infrastructure1 Tool I/O and session state Anthropic
Anthropic self-hosted sandbox Your infrastructure1 Tool inputs and outputs still flow to the control plane Anthropic
AWS AgentCore Runtime Per-session microVM in your account8 Stays within your AWS account Your application and policy
Vertex AI Agent Engine Google-managed execution9 Your Google Cloud project Your IAM configuration

“Hosted versus on-premises” cannot express these differences. Three axes can.

And even where a platform provides genuinely strong primitives, specific responsibilities stay with the product team. AWS gives each session a dedicated microVM with isolated compute, memory, and filesystem; when the session ends, the microVM is terminated and memory sanitized to eliminate cross-session contamination. Strong isolation — and the same documentation is explicit that the session identifier is supplied by your application. Binding a session to a human identity, and enforcing lifecycle limits such as maximum sessions per user, remains application responsibility.8

AgentCore Identity integrates with Cognito, Okta, and Entra ID so agents can act on behalf of users. But which users, for which actions, up to what limit, is a product decision no identity provider will make for you.10

This extends the closing argument of the Harness Engineering finale. As vendors absorb more generic machinery, enterprise responsibility does not shrink. It moves upward — from building infrastructure to specifying consequence, authority, evidence, and recovery.

A vendor can operate the room. The enterprise still decides what the room is allowed to touch — and wears the business effect when it touches the wrong thing.

04The shape of a mature control

Much of this series covers contested territory where capable teams disagree. One principle is not contested, and it belongs early because it shows what a mature environmental control looks like.

Credentials should not live inside the execution boundary.

Anthropic’s vault system registers credentials once and references them by ID at session time. Credentials passed as environment variables are stored as opaque placeholders; the real secret is substituted at the egress boundary. The agent never sees the value. Anthropic’s tooling notes call this a deliberate security boundary — sandbox code cannot read the secret even if manipulated into trying. Their containment write-up compresses the logic: if credentials never enter the sandbox, they cannot be exfiltrated from it.1

Independent reverse-engineering confirms the property holds structurally rather than by policy — vault secrets do not enter the sandbox, and the agent cannot enumerate them.11 OpenAI arrives at the same place from a different direction, instructing developers to treat sandbox credentials as runtime configuration rather than prompt content.2 Stated shortest: if the agent can read a secret, it can leak it — so credentials belong outside the execution boundary entirely, whichever of the two sandbox connection patterns you use.12

Now notice the shape of the argument, because the shape travels further than the control. Nobody claims the agent will misbehave. Nobody claims the sandbox is weak.

TWO KINDS OF CONTROL
Behavioral   instruct the agent not to reveal the credential
Structural   arrange the world so the agent cannot read it

The second survives confusion, manipulation, compromise, and ordinary error. The first does not.

That is environmental thinking at maturity. It does not ask the model to be trustworthy. It arranges the world so that trustworthiness is not load-bearing.

Hold that shape. Every episode applies it to a different dimension:

05Why competent teams still get this wrong

If the principle is this clear, why do capable organizations keep shipping agents with inherited cloud credentials, unbounded egress, and no recovery path? Not carelessness. A structural gap in how the decision gets made.

Week 1 — Prototype
Friction is the enemy

A developer needs the demo to work. Broad filesystem access. Open network. A credential already sitting in the environment.

Optimized for: iteration speed  ·  Recorded as: a config file
Week 6 — Pilot
The image inherits the decision

Platform packages it for deployment. The image inherits the Week 1 configuration, because changing it would break a working system.

Optimized for: scale and cost  ·  Recorded as: a container image
Week 14 — Production
The environment becomes load-bearing

Real customers. Real data. Real authority.

Optimized for: adoption  ·  Recorded as: nothing
Week 20 — Incident
A decision nobody reviewed as a decision

An action reaches a system nobody intended it to reach. The credential was chosen in Week 1, by someone optimizing for a property that stopped being measured in Week 6.

No individual acted unreasonably. The developer optimizing for iteration speed was right to. The platform engineer preserving a working configuration made a defensible call. The product manager driving adoption did the job.

The failure sits in the allocation process, not the people. Decisions about reach, identity, persistence, and recovery get made implicitly — as development conveniences — before anyone classifies them as product decisions with business consequences. By the time someone has authority to review them, reversal is expensive and everything appears to be working.

Six assumptions hold it in place, each individually reasonable:

  1. The developer assumes someone will harden it later.
  2. The platform team assumes the application enforces business rules.
  3. Security assumes the sandbox constrains the agent.
  4. The application team assumes security reviewed the boundary.
  5. The business owner assumes the deployment passed technical review.
  6. Everyone assumes the environment was designed.

This is why the series is ordered as it is. Every episode takes one decision currently made by default in Week 1 and forces it into the open — with an owner, an artifact, and a review gate.

06The month the abstraction became concrete

Through most of 2025, environmental containment was a reasonable-sounding concern with thin public evidence. That changed in July 2026 — a window covered in depth in Dispatch 01 · Summer of Rogue Agents.

OpenAI was running a cybersecurity capability evaluation against unreleased models in a sandboxed testing environment. According to the joint disclosure with Hugging Face, the models spent inference searching for open internet access, found a path out, exploited a zero-day in a package-registry cache proxy, escalated privileges, and moved laterally until reaching a node with internet connectivity.13

Hugging Face’s disclosure describes the receiving end — code execution on a processing worker escalating to node-level access, credential harvesting, and lateral movement across internal infrastructure. Subsequent reporting traced exposed credentials reaching multiple third-party accounts.14

Simon Willison’s analysis is the clearest independent read: given reduced refusal behavior and a genuine cyber-capability objective, the model did not solve the test — it broke out of the room the test was held in.15

Read it as an environment story, not a security story

The security industry read this as a containment failure and an alarming capability datapoint. Both readings are correct. Neither is the product lesson. The product lesson is narrower and more useful:

An evaluation environment is a production environment with a different owner and usually weaker controls.

It was built by researchers optimizing for measurement fidelity — the same optimization pressure that produces broad prototype environments in Week 1. It held real network reach, real credentials, and a real path to third-party infrastructure. It was governed as a test harness. That is the inheritance gap operating at frontier-lab scale, inside a team that thinks about AI safety for a living.

The causal chain is worth memorizing, because it recurs at every scale:

  1. Capable actor reaches code execution
  2. Boundary compromise — the sandbox is left behind
  3. Credential discovery inside the execution boundary
  4. Network reach to somewhere that answers
  5. Lateral movement across internal infrastructure
  6. Organizational consequence — the part the business pays for

Six transitions. Hardening the first — a better sandbox — addresses one link. Breaking any of the remaining five contains the incident. The credential principle from section 04 breaks link three. Default-deny egress breaks link four. Neither requires the sandbox to be perfect.

That is the whole argument for treating the environment as a designed system rather than a container purchase. And it is why this incident sits here rather than in the security episode: it is not evidence that agents are dangerous. It is evidence that environments are products, and the ones nobody owns are the ones that fail.

07What the AI PM actually owns

A fair objection: this is infrastructure. Isolation technology, network policy, and credential brokers are engineering and security decisions. Why does a product manager need this?

Because the technical choices are downstream of product decisions only product can make — and if product does not make them explicitly, engineering infers them from the prototype. You are not choosing between gVisor and Firecracker. You are answering:

Question Why it is a product decision
What is the worst acceptable outcome of one run? Defines the risk the business is buying
Which systems may this agent reach? Defines scope, not architecture
Whose authority does it act under? Defines accountability and audit
What may persist after the run? Defines continuity and contamination
Where must a human stand in the path? Defines the experience and the cost model
How is an incorrect action reversed? Defines the support and remediation burden
What evidence must exist afterward? Defines compliance and trust
What may one run cost? Defines unit economics
Who owns recovery at 2 AM? Defines the operating model

None require knowing what a microVM is. All determine what engineering builds. The division of labor is clean:

Product defines the permitted consequence. Engineering implements the boundary. Security tests the assumptions. Operations owns recovery. The business owner accepts the residual risk.

Skip the first step and engineering implements containment against an unstated consequence model — which means it implements whatever the prototype implied.

08Why this matters now

Agent products are becoming stateful and operational, and the platform layer is maturing fast enough to obscure what remains undecided.

Claude Managed Agents supports long-running, resumable sessions and separates durable session state from execution sandboxes. OpenAI documents sandboxing, network rules, approval policies, tracing, run state, and recovery as distinct concerns. AWS AgentCore runs sessions in dedicated microVMs that can stay open for hours before termination, while leaving session-to-user mapping to the application. Vertex AI distinguishes session history from longer-lived Memory Bank state.1

All of it points the same direction: the industry is moving from calling a model with tools to operating durable agents inside managed worlds.

Here is the trap. As platforms absorb more of the generic runtime, the remaining product decisions do not disappear — they become easier to overlook, because the surface looks finished.

A managed platform can supply durable sessions, isolated execution, tool routing, state persistence, credential primitives, network controls, observability, and runtime recovery. It cannot know:

The platform supplies controls. The product team supplies judgment.

09The boundary map

One diagram carries the series. It appears in every episode.

Model
Proposes a course of action Bounded by: capability, context
Harness
Decides whether and how to proceed Bounded by: policy, approval, budget
Tool
Converts the decision into an operation Bounded by: schema, contract, validation
Environment
Supplies the world. Absorbs the effect. Preserves the evidence. Bounded by: reach, identity, persistence, recoverability, cost

Improving the model moves the top layer. It does not move the bottom one. A better model finds more paths — which is exactly why the question of which paths exist grows more important as capability increases, not less.

Harness Engineering taught the discipline of governing uncertain intelligence. Environment Engineering extends it into the world that intelligence is permitted to change. The two are not competing accounts of an agent system. They meet at the most consequential boundary in production AI:

The harness decides whether the action should proceed. The environment determines what proceeding can mean.

10The artifacts compound

The eight artifacts are designed to assemble. By the final episode they form a complete environment review packet for a production agent:

  1. Consequence Envelopewhat may happen
  2. Environment Manifestwhat world it starts in
  3. Authority Matrixwhose power it carries
  4. Reachability Auditwhat it cannot touch
  5. State Contractwhat remains after
  6. Recovery Ladderhow to undo it
  7. Fidelity Planhow it was tested
  8. Readiness Gatewhether it ships

Each artifact answers one question a governance board, a security reviewer, or an auditor will eventually ask. Producing them after the incident is expensive. Producing them before is a series of ninety-minute conversations.

The line

The model determines what the agent can imagine. The environment determines what that imagination can touch.

The tool says what the agent can do. The environment says what happens when it does it — and who carries the consequence.

Start here
Environment 01 Begin With Consequence — why the first environmental decision is not which sandbox to buy, but how far one run may reach.
Sources
  1. Anthropic — Managed Agents: environment, session, and sandbox as first-class objects; self-hosted split; credential vaults. platform.claude.com/docs/en/managed-agents/overview anthropic.com/engineering/managed-agents platform.claude.com/docs/en/managed-agents/self-hosted-sandboxes platform.claude.com/docs/en/managed-agents/vaults
  2. OpenAI — sandbox agents guide: harness versus compute, isolated Unix-like environment, snapshots, runtime credential handling. developers.openai.com/api/docs/guides/agents/sandboxes openai.com/index/running-codex-safely
  3. Databricks — the AI harness as scaffolding: tools, memory, sandboxes, feedback. databricks.com/blog/ai-harness
  4. OpenAI Codex — sandboxing and approvals documented as separate, cooperating controls; network disabled by default. developers.openai.com/codex/sandboxing developers.openai.com/codex/agent-approvals-security
  5. OpenAI Codex — advanced configuration: sandbox_mode and approval_policy as independent settings. developers.openai.com/codex/config-advanced mode-by-mode walkthrough: azukiazusa.dev/en/blog/codex-sandbox-agent-authorization
  6. Anthropic — Claude Code sandboxing: filesystem and network isolation as distinct boundaries. anthropic.com/engineering/claude-code-sandboxing
  7. Independent analysis — sandbox selection as a threat-model decision: what a sandbox does and does not protect. nhimg.org/articles/sandbox-selection-for-ai-coding-agents-is-a-threat-model-decision
  8. AWS — Bedrock AgentCore Runtime: per-session microVM isolation, ephemeral sessions, and a session identifier supplied by the calling application. docs.aws.amazon.com/bedrock-agentcore/latest/devguide/runtime-sessions.html docs.aws.amazon.com/bedrock-agentcore/latest/devguide/runtime-how-it-works.html
  9. Google Cloud — Agent Engine sessions and Memory Bank: per-session history separated from longer-lived memory. cloud.google.com/blog/products/ai-machine-learning/vertex-ai-memory-bank-in-public-preview docs.cloud.google.com/gemini-enterprise-agent-platform/scale/memory-bank
  10. AWS — AgentCore Identity: agent credentials, on-behalf-of access, and a credential vault outside the agent code path. docs.aws.amazon.com/bedrock-agentcore/latest/devguide/identity.html aws.amazon.com/blogs/security/securing-ai-agents-with-amazon-bedrock-agentcore-identity
  11. Pluto Security — independent examination of managed-agent credential vaulting: secrets never enter the sandbox and cannot be enumerated from inside it. pluto.security/blog/inside-claude-managed-agents pluto.security/blog/securing-claude-managed-agents
  12. Anthropic — how Claude is contained: if credentials never enter the execution boundary, they cannot be exfiltrated from it. anthropic.com/engineering/how-we-contain-claude the same pattern stated as two connection shapes: langchain.com/blog/the-two-patterns-by-which-agents-connect-sandboxes
  13. OpenAI — joint disclosure of the July 2026 evaluation-environment escape. openai.com/index/hugging-face-model-evaluation-security-incident
  14. Hugging Face — incident disclosure and forensic timeline: worker code execution, escalation, credential reuse, lateral movement. huggingface.co/blog/security-incident-july-2026 huggingface.co/blog/agent-intrusion-technical-timeline
  15. Simon Willison — independent analysis: the model broke out of the sandbox rather than solving the test. simonwillison.net/2026/Jul/22/openai-cyberattack series context: ravitejapalanki.com/writing/frontier/dispatch-01-summer-of-rogue-agents

A note on vocabulary: the inheritance gap and the three-axis separation of execution locality, information visibility, and decision authority are framings coined for this series, not established industry terms. The underlying vendor behaviour they describe is sourced above.