# Environment

> The world the agent acts on — anything outside the harness that the agent perceives via tool results and changes via tool calls.

The world the [agent](https://ai9k.vercel.app/en/agent) acts on — anything outside the [harness](https://ai9k.vercel.app/en/harness) that the agent perceives through [tool results](https://ai9k.vercel.app/en/tool-result) and changes through [tool calls](https://ai9k.vercel.app/en/tool-call). The harness _runs_ the agent; the environment is what the agent _works in_. A file like [`AGENTS.md`](https://ai9k.vercel.app/en/agentsmd) lives in the environment; the harness is what loads it into the [context window](https://ai9k.vercel.app/en/context-window). A [filesystem](https://ai9k.vercel.app/en/filesystem) is the most common kind of environment, but not the only one (a database, a remote API, a browser session can all be environments).

The agent only sees the environment when it looks. Everything it knows about the environment arrived through a tool result, so its picture is a collection of snapshots, each accurate at the moment it was taken. If a file changes after the agent read it — you edit it by hand, a build step regenerates it — the agent keeps reasoning from the stale copy until something prompts a re-read. An agent confidently describing a file that no longer looks like that is usually this: the environment moved, the snapshot didn't.

The environment is also the layer that persists — the only one that is always [stateful](https://ai9k.vercel.app/en/stateful). A [session](https://ai9k.vercel.app/en/session)'s context is gone when the session ends, but files written to the environment remain for the next session to read — which is what [memory systems](https://ai9k.vercel.app/en/memory-system), [handoff artifacts](https://ai9k.vercel.app/en/handoff-artifact), and `AGENTS.md` rely on. Anything an agent should still know tomorrow has to end up in the environment.

You decide how big the environment is. A [sandbox](https://ai9k.vercel.app/en/sandbox) shrinks it, limiting what the agent can reach; adding a [tool](https://ai9k.vercel.app/en/tool) extends it, bringing a database or an API into reach. What's inside the boundary is what the agent can perceive and change; everything outside it doesn't exist for the agent. How well the environment is set up to support the agent's work is the codebase's [AX](https://ai9k.vercel.app/en/ax).

_Avoid:_ using "environment" for the runtime or the harness itself — the harness is the wrapper, the environment is the workspace.

**Usage**

"The agent can't see the staging DB schema."

"Wire it into the environment — give it a `psql` tool scoped to read-only on staging. The harness is fine, it just has nothing to act on."

---

- Section 3 — Tools & Environment · Term 25 of 72
- Page: https://ai9k.vercel.app/en/environment
- Learn step by step: https://ai9k.vercel.app/en/learn#/environment
- On the map: https://ai9k.vercel.app/en?term=environment
- JSON: https://ai9k.vercel.app/data/terms/environment.json
- Mentioned in: [Stateful](https://ai9k.vercel.app/en/stateful.md), [Filesystem](https://ai9k.vercel.app/en/filesystem.md), [Tool](https://ai9k.vercel.app/en/tool.md), [Tool result](https://ai9k.vercel.app/en/tool-result.md), [Sandbox](https://ai9k.vercel.app/en/sandbox.md), [Handoff](https://ai9k.vercel.app/en/handoff.md), [Handoff artifact](https://ai9k.vercel.app/en/handoff-artifact.md), [Spec](https://ai9k.vercel.app/en/spec.md), [Memory system](https://ai9k.vercel.app/en/memory-system.md), [AGENTS.md](https://ai9k.vercel.app/en/agentsmd.md), [Skill](https://ai9k.vercel.app/en/skill.md), [Automated check](https://ai9k.vercel.app/en/automated-check.md), [DX](https://ai9k.vercel.app/en/dx.md), [AX](https://ai9k.vercel.app/en/ax.md)
- Previous: [Turn](https://ai9k.vercel.app/en/turn.md)
- Next: [Filesystem](https://ai9k.vercel.app/en/filesystem.md)

Every term page has a markdown copy: add .md to its address.
