> ## Documentation Index
> Fetch the complete documentation index at: https://docs.checkfu.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Checkfu is open source (https://github.com/checkfu/checkfu) and runs in the reader's own Cloudflare account. There is no shared hosted base URL: `checkfu deploy` prints the deployment's API URL (`https://<api-worker>.workers.dev` or the CHECKFU_API_DOMAIN hostname, exported as `CHECKFU_BASE_URL` for the CLI, SDK, and curl) and MCP URL (`.../mcp`). Local development serves the API on http://localhost:1337 and MCP on http://localhost:1338/mcp.
> Authenticated HTTP requests send the deployment's CHECKFU_API_KEY as `Authorization: Bearer $CHECKFU_API_KEY` (or `x-api-key`) and `Content-Type: application/json` for JSON bodies. Pass `Idempotency-Key` on retriable writes.
> Core workflow: create an Agent (`POST /v1/agents`) and an Environment (`POST /v1/environments`), create a Session that references both (`POST /v1/sessions`), send a `user.message` event (`POST /v1/sessions/{session_id}/events`), and follow `GET /v1/sessions/{session_id}/events/stream` until `session.status_idle`.
> Other resources: Memory stores (`/v1/memory_stores`), Files (`/v1/files`), Artifacts (`/v1/artifacts`), Vaults and credentials (`/v1/vaults`), Provider credentials (`/v1/provider_credentials`), Automations (`/v1/automations`), Inbound bindings (`/v1/inbound_bindings`), and Webhooks (`/v1/webhooks`). The deployment serves its OpenAPI 3.1 specification at `GET /openapi.json`.

# Environments

> Set the network rules for the Linux machine where Sessions run.

An Environment controls the network rules for the Sessions that use it: which hosts their Linux machine can reach, and which MCP servers their agent can call. Many Sessions can share one Environment.

```ts TypeScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
import Checkfu from "@checkfu/sdk"

const client = new Checkfu()

const environment = await client.waitForPending(
	await client.environments.create({
		name: "locked-down",
		config: {
			type: "cloud",
			networking: {
				type: "limited",
				allowed_hosts: ["github.com", "api.example.com"],
				allow_package_managers: true,
				allow_mcp_servers: true,
			},
		},
	}),
)
```

```sh CLI theme={"theme":{"light":"github-light","dark":"github-dark"}}
checkfu environments create --name default
```

On create, omitting `config` or passing `config: { type: "cloud" }` selects the existing unrestricted networking default. On update, omitting `networking` keeps the current policy. Responses always include the effective networking policy.

## Networking

`unrestricted` lets the machine reach any public host. `limited` allows only `allowed_hosts`, plus common package registries when `allow_package_managers` is `true`, and every MCP server when `allow_mcp_servers` is `true` (otherwise only MCP servers whose host is in `allowed_hosts`). See [Create an environment](https://docs.checkfu.com/api-reference/environments/create-an-environment.md) for the full host-matching rules and registry list.

A blocked request fails with `403` inside the machine, and the error names the blocked host. Mounted GitHub repositories clone from `github.com`, so include `github.com` under `limited` networking.

## The Linux machine

Each Session gets its own Linux container. It boots on the first `bash` call, or during first-turn preparation if the Session mounts a GitHub repository, and sleeps when idle. Across sleeps it preserves `/workspace` and `/mnt/session/outputs`. Packages and other files outside those directories are cleared when the machine is replaced.

Preinstalled tools include `git`, `node`, `npm`, `python3`, `pip`, `ripgrep`, `jq`, `curl`, `unzip`, and `zstd`. Only HTTP and HTTPS leave the container, so clone repositories over `https`.

Set `config.setup.packages.apt`, `config.setup.packages.npm`, or `config.setup.packages.pip` to install packages whenever a machine starts. Set `config.setup.script` to run Bash after the package installs. Setup runs after repository mounts are ready, uses the same networking rules as the turn, and has a five-minute limit. With `limited` networking, enable `allow_package_managers` or include the package registries you use in `allowed_hosts`.

## Updates

Pass the `version` you last read; the update fails with `409` if someone changed the Environment in the meantime. Environments are not pinned to a Session, so running Sessions pick up updated rules on their next turn.

```ts theme={"theme":{"light":"github-light","dark":"github-dark"}}
await client.environments.update(environment.id, {
	version: environment.version,
	config: { type: "cloud", networking: { type: "unrestricted" } },
})
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.