# Install dependencies
poetry install --with test
pnpm install
```

Setup scripts are run in a separate bash session than the agent, so commands
like `export` do not persist. You can persist environment variables by adding
them to `~/.bashrc`.

### Container Caching

Codex caches container state to make running new tasks and followups faster.
Environments that are cached will have the repository cloned with the default
branch checked out. Then the setup script is run, and the resulting container
state is cached for up to 12 hours. When a container is resumed from the cache,
we check out the branch specified for the task, and then run the maintenance
script. The maintenance script is optional, and helpful to update dependencies
for cached containers where the setup script was run on an older commit.

We will automatically invalidate the cache and remove any cached containers if
there are changes to the setup script, maintenance script, environment
variables, or secrets. If there are changes in the repository that would cause
backwards incompatibility issues, you can manually invalidate the cache with the
"Reset cache" button on the environment page.

For Teams and Enterprise users, caches are shared across all users who have
access to the environment. Invalidating the cache will affect all users of the
environment in your workspace.

### Internet access and network proxy

Internet access is available to install dependencies during the setup script
phase. During the agent phase, internet access is disabled by default, but you
can configure the environment to have limited or full internet access.
[Learn more about agent internet access.](https://platform.openai.com/docs/codex/agent-network)

Environments run behind an HTTP/HTTPS network proxy for security and abuse
prevention purposes. All outbound internet traffic passes through this proxy.

Environments are pre-configured to work with common tools and package managers:

1.  Codex sets standard environment variables including `http_proxy` and
    `https_proxy`. These settings are respected by tools such as `curl`, `npm`,
    and `pip`.
2.  Codex installs a proxy certificate into the system trust store. This
    certificate's path is available as the environment variable
    `$CODEX_PROXY_CERT`. Additionally, specific package manager variables (e.g.,
    `PIP_CERT`, `NODE_EXTRA_CA_CERTS`) are set to this certificate path.

If you're encountering connectivity issues, verify and/or configure the
following:

- Ensure you are connecting via the proxy at `http://proxy:8080`.
- Ensure you are trusting the proxy certificate located at `$CODEX_PROXY_CERT`.
  Always reference this environment variable instead of using a hardcoded file
  path, as the path may change.

## Using AGENTS.md

Provide common context by adding an `AGENTS.md` file. This is just a standard
Markdown file the agent reads to understand how to work in your repository.
`AGENTS.md` can be nested, and the agent will by default respect whatever the
most nested root that it's looking for. Some customers also prompt the agent to
look for `.currsorrules` or `CLAUDE.md` explicitly. We recommend sharing any
bits of organization-wide configuration in this file.

Common things you might want to include:

- An overview showing which particular files and folders to work in
- Contribution and style guidelines
- Parts of the codebase being migrated
- How to validate changes (running lint, tests, etc.)
- How the agent should do and present its work (where to explore relevant
  context, when to write docs, how to format PR messages, etc.)

Here's an example as one way to structure your `AGENTS.md` file:

```markdown