Files
coder/docs/coder-agents/architecture.md
T
Nick VigilanteandBen Potter 1baff57cb0 fix: resolve docs and code conflicts found in the main docs audit (#32158)
## Summary

Addresses 106 of the 113 conflicts between the docs and the code that
the November audit of `main` found: 102 are fixed and 4 have an interim
docs fix. Every finding was re-checked against the code before it was
fixed. Most fixes are docs-only. Three are small code fixes where the
docs described the intended behavior and the code was wrong, each in its
own commits so it can be split out. No change in this PR alters template
build or agent behavior.

## Changes

Fixes by area (finding counts): templates 28, install 13, integrations
and monitoring 13, auth and security 12, networking 11, Coder Agents 9,
AI governance 7, reference 7, workspaces 6.

Code fixes. Each needs a look from the code owner. If an owner prefers
not to take one, drop its commits and I will change the docs to describe
the current behavior instead.

| Commits | Change | Risk to check |
|---------|--------|---------------|
| `fix: keep built-in listener defaults in packaged coder.env`, and
three follow-up commits | `coder.env` comments out `CODER_HTTP_ADDRESS=`
and the three `CODER_TLS_*` lines, so an untouched package install
listens on `127.0.0.1:3000` as the docs say. Only the
`CODER_HTTP_ADDRESS=` line changed behavior. The TLS options default to
empty, so commenting them out is for consistency. The Lima examples
rewrite the commented line and fail if the line is not found. A test
compares every option that the file sets against the built-in defaults.
| The deb and RPM packages were not built or installed. Every released
package through v2.39.0 ships the empty line, and upgrades keep an
existing file (`config\|noreplace`), so the upgrade pages now say how to
fix it. |
| `fix(cli/clilog): accept log sinks that are all disabled`, and three
follow-up commits | `--log-human=/dev/null` with no other log location
no longer fails with "no loggers provided". It is the documented way to
disable logging. An empty location still fails with that error when no
other sink is set, as before. | Behavior change: with `/dev/null`, the
server and the provisioner daemon can start with no log output. |
| `fix(cli): detect CODER_PROC_PRIO_MGMT by presence`, and a comment
follow-up | Log line only. With the variable set to an empty value, the
agent now logs that process priority management is enabled, which is
what `agentexec` already does. No detection or behavior change. | Low. |

Two option descriptions in `codersdk/deployment.go` are corrected, with
the CLI reference, configuration reference, and golden files
regenerated: the default quiet hours schedule (the max deadline is the
quiet hours window on the next day that the template's autostop
requirement applies) and `--experiments` (`*` opts in to the experiments
marked safe, also in `enterprise/cli/provisionerdaemonstart.go`).

### Code fixes that were reverted after review

Two code fixes from the first version of this PR are reverted in the
branch. The net diff has no change under `agent/` or `coderd/`. The docs
now describe what the code does, and both issues stay open for the
owner.

- **`error` merge strategy for `coder_env` (DOCS-1669).** The fix made
`merge_strategy = "error"` fail whenever a name was set twice, whatever
the resource order. Existing template versions that pair an `error`
entry with a later `replace` or `append` entry would start to fail every
build after `terraform apply`. That is a breaking change that needs its
own PR and release note. The fix and its tests are in `dff8e7c6ce` and
can be cherry-picked. `environment-variables.md` now says the check runs
only when the `error` resource is processed.
- **Nice value before the capability drop (DOCS-1687).** The fix let
`coder agent-exec` apply a negative nice value by calling `setpriority`
before it drops effective capabilities. The current order is deliberate:
with the fix, any local process could run the agent binary with
`--coder-nice=-20` when the binary has the `CAP_SYS_NICE` file
capability. `process-priority.md` now says a nice value below the
agent's own is not applied, and no longer tells admins to grant
`CAP_SYS_NICE`.

## Not included

Seven findings are left out.

- DOCS-1629: covered by #31639.
- DOCS-1703 and DOCS-1724: covered by #31980.
- DOCS-1584, DOCS-1683, DOCS-1685, DOCS-1686: each needs an owner
decision, and no neutral docs wording exists until that decision is
made. The validation comment on each issue names the decision.

Four fixes are interim, so their issues stay open:

- DOCS-1600: the AI Gateway pages now agree that the legacy metric names
are deprecated and "will be removed in a future release". The code still
emits them, and its TODO names v2.37, which has shipped. The owner still
needs to set the removal release.
- DOCS-1689: the page now says **New Template** opens the builder only
for users with the Owner role, because the page gates on read access to
the deployment config. Whether Template Admins should get the builder is
still open.
- DOCS-1669 and DOCS-1687: docs-only for now. Refer to [Code fixes that
were reverted after
review](#code-fixes-that-were-reverted-after-review).

## Review notes

- Claims that describe product intent and need an owner's yes: the
Premium qualifier on per-organization workspace sharing (the API route
has no license check, the dashboard needs multiple organizations),
`organization` port sharing in OSS, the telemetry field list, and the
`1-5` cron range in the prebuilds schedule example.
- Not run end to end: the PostgreSQL TLS procedure on a cluster, the
OpenShift and air-gapped examples, the BSD `date` and `tar` forms on
macOS, the Windows command on the multiple Kubernetes clusters page, and
the keep-alive script in `docs/reference/index.md` (only its comparison
logic was run, against sample values). Nothing was checked on a live
deployment.
- Likely merge conflicts with open PRs: #31990 (`mcp-server.md`,
`feature-stages.md`, `docker-in-workspaces.md`), #31982
(`workspace-management.md`), #31980 (`health-check.md`), #31977
(`manage-provisioner-jobs.md`), #31869 (`airgap.md`), #30486
(`add-envbuilder.md`), and #31326 and #31531 (`codersdk/deployment.go`
and generated files).

## Testing

- `make pre-commit` (gen, fmt, lint, slim build), before the PR opened
and again after the review changes.
- `go test` for `./cli/clilog/...`, `./codersdk/`, `./cli/`
(`TestServer`, `TestAgent`, and golden files), and `./enterprise/cli/`
(provisioner, server, and help golden files). `./agent/agentexec/...`
and `./coderd/provisionerdserver/...` pass after the reverts. Linux
only. CI covers macOS and Windows.
- The `coder.env` test fails against the file on `main` and passes
against the new one. It reads the file with `godotenv`, which accepts
CRLF line endings.
- An empty `CODER_HTTP_ADDRESS=` was confirmed end to end with a full
build of the server (output below).
- The new `sed` and `grep` lines in the Lima examples were run with GNU
tools against the old and the new form of `coder.env`. The Lima VMs were
not started.
- `--log-human=/dev/null` and `CODER_LOGGING_HUMAN=` were confirmed with
the same build (output below).
- `coder agent-exec --coder-nice=-5 -- echo` from a full build, as a
non-root user: `coder-agent: failed to adjust niceness to -5 ...:
permission denied` on stderr, the command output on stdout, exit code 0.
- `postgres-ssl.md` rendered with the GitHub Markdown API: two ordered
lists with three and five items, where `main` has six lists.
- markdownlint, the table formatter, `make lint/emdash`, `make
lint/docs-html`, `make lint/docs-manifest`, `make lint/docs-redirects`,
`make lint/style-claims`, and Vale on the changed lines.
- A doc-check self-review of the docs diff by four independent
reviewers. It found six problems, which are fixed. The accuracy and
coverage lenses ran on every area. The language and structure lenses ran
in full on only part of the diff.

<details>
<summary>Test and terminal output for the code fixes (Linux)</summary>

```console
$ go test ./codersdk/ -run TestPackagedCoderEnvKeepsDefaults -count=1 -v
--- PASS: TestPackagedCoderEnvKeepsDefaults (0.00s)
ok  	github.com/coder/coder/v2/codersdk	0.071s

$ go test ./cli/clilog/ -run TestBuilder -count=1 -v
--- PASS: TestBuilder (0.00s)
    --- PASS: TestBuilder/NoSinks (0.00s)
        --- PASS: TestBuilder/NoSinks/JSONDevNull (0.00s)
        --- PASS: TestBuilder/NoSinks/StackdriverDevNull (0.00s)
        --- PASS: TestBuilder/NoSinks/NoConfiguration (0.00s)
        --- PASS: TestBuilder/NoSinks/HumanDevNull (0.00s)
    --- PASS: TestBuilder/WithHuman (0.00s)
    --- PASS: TestBuilder/WithFilter (0.00s)
    --- PASS: TestBuilder/WithJSON (0.00s)
    --- PASS: TestBuilder/Verbose (0.00s)
    --- PASS: TestBuilder/FromDeploymentValues (0.01s)
        --- PASS: TestBuilder/FromDeploymentValues/Defaults (0.00s)
        --- PASS: TestBuilder/FromDeploymentValues/EmptyHumanEnv (0.00s)
        --- PASS: TestBuilder/FromDeploymentValues/Override (0.00s)
ok  	github.com/coder/coder/v2/cli/clilog	0.171s

$ TMPDIR=$HOME/.cache/agentexec-tmp go test ./agent/agentexec/... ./coderd/provisionerdserver/... -count=1
ok  	github.com/coder/coder/v2/agent/agentexec	4.236s
ok  	github.com/coder/coder/v2/coderd/provisionerdserver	2.404s

# Full build of the server (go build ./cmd/coder). An empty value stops it before it connects to the database.
$ CODER_HTTP_ADDRESS= coder server --postgres-url 'postgres://127.0.0.1:1/x?sslmode=disable'
Encountered an error running "coder server", see "coder server --help" for more information
error: TLS is disabled. Enable with --tls-enable or specify a HTTP address

# With the variable unset, the server passes that check and goes on to the database.
$ coder server --postgres-url 'postgres://127.0.0.1:1/x?sslmode=disable'
2026-11-13 02:19:41.901 [warn]  ping postgres: retrying  error="dial tcp 127.0.0.1:1: connect: connection refused"  try=11
Encountered an error running "coder server", see "coder server --help" for more information
error: connect to postgres: connect to postgres: unable to connect after 11 tries; last error: dial tcp 127.0.0.1:1: connect: connection refused

# An empty log location with no other sink still stops the server.
$ CODER_LOGGING_HUMAN= coder server --postgres-url 'postgres://127.0.0.1:1/x?sslmode=disable'
Encountered an error running "coder server", see "coder server --help" for more information
error: make logger: no loggers provided, use /dev/null to disable logging

# /dev/null passes the logger check. The server prints no log lines and goes on to the database.
$ coder server --log-human=/dev/null --postgres-url 'postgres://127.0.0.1:1/x?sslmode=disable'
Encountered an error running "coder server", see "coder server --help" for more information
error: connect to postgres: connect to postgres: unable to connect after 11 tries; last error: dial tcp 127.0.0.1:1: connect: connection refused
```

</details>

## Linear

Fixes DOCS-1583, DOCS-1585, DOCS-1586, DOCS-1587, DOCS-1588, DOCS-1589,
DOCS-1590, DOCS-1591, DOCS-1592, DOCS-1593, DOCS-1594, DOCS-1595,
DOCS-1596, DOCS-1597, DOCS-1598, DOCS-1599, DOCS-1601, DOCS-1602,
DOCS-1603, DOCS-1604, DOCS-1605, DOCS-1606, DOCS-1607, DOCS-1608,
DOCS-1609, DOCS-1614, DOCS-1618, DOCS-1619, DOCS-1620, DOCS-1624,
DOCS-1635, DOCS-1639, DOCS-1644, DOCS-1651, DOCS-1652, DOCS-1653,
DOCS-1654, DOCS-1655, DOCS-1656, DOCS-1657, DOCS-1658, DOCS-1659,
DOCS-1660, DOCS-1661, DOCS-1662, DOCS-1663, DOCS-1664, DOCS-1665,
DOCS-1666, DOCS-1667, DOCS-1668, DOCS-1670, DOCS-1671, DOCS-1672,
DOCS-1673, DOCS-1674, DOCS-1675, DOCS-1676, DOCS-1677, DOCS-1678,
DOCS-1679, DOCS-1680, DOCS-1681, DOCS-1682, DOCS-1684, DOCS-1688,
DOCS-1690, DOCS-1691, DOCS-1692, DOCS-1693, DOCS-1694, DOCS-1695,
DOCS-1696, DOCS-1697, DOCS-1698, DOCS-1699, DOCS-1700, DOCS-1701,
DOCS-1702, DOCS-1704, DOCS-1705, DOCS-1706, DOCS-1707, DOCS-1708,
DOCS-1709, DOCS-1710, DOCS-1711, DOCS-1712, DOCS-1713, DOCS-1714,
DOCS-1715, DOCS-1716, DOCS-1717, DOCS-1718, DOCS-1719, DOCS-1720,
DOCS-1721, DOCS-1722, DOCS-1723, DOCS-1725, DOCS-1726, DOCS-1727

Part of DOCS-1600, DOCS-1689, DOCS-1669, DOCS-1687

<details>
<summary>Decision log</summary>

### Scope

- One PR for all findings, as agreed with the reviewer. The code fixes
are separate commits so an owner can ask for any of them to move to its
own PR. Nothing in the PR is a breaking change, so the title has no `!`.
- A finding was skipped only when an open PR already covers it, or when
every available wording would assert an undecided product behavior.
- Each validation comment on the Linear issues records the evidence, the
corrections to the original finding, and what was not verified.

### Docs or code

- The default was a docs-only fix that describes what the code does.
- A code fix was chosen when the docs describe a behavior the code
plainly intended and the code change is small and testable: the packaged
env file, the log sink check, and the log line for the environment
variable presence check.
- The `error` merge strategy and the nice value ordering started as code
fixes and went back to docs-only after review. The first breaks existing
template versions. The second weakens a deliberate security ordering.
- The SCIM `userName` finding (DOCS-1609) took the docs path. The
handler is unchanged.

### Wording choices worth a second look

- `feature-stages.md` says `--experiments=*` enables only the
experiments marked safe, and points to the "Get safe experiments" API.
It does not list the other experiments, because the list would drift and
those experiments are hidden on purpose. The `--experiments` flag help
now says the same.
- `agent-metadata.md` replaces the writes-per-second formula with a
description of the batcher (each server replica writes one statement
every 5 seconds, or sooner at 500 entries).
- `extending-templates/index.md` no longer calls `startup_script`
deprecated. The provider documents it as an alias for a `coder_script`.
- `postgres-ssl.md` separates client verification from server
verification, so the server verification steps work alone.
- `rpm.md`, `upgrade.md`, and the 2.29 to 2.34 ESR upgrade page explain
the empty `CODER_HTTP_ADDRESS=` line that older packages shipped,
because upgrades keep the old file. The behavior changed in v2.34.0 with
the serpent upgrade in #24926.
- The keep-alive script in `docs/reference/index.md` reads the current
deadline and skips the request when it is already later. The comparison
is on text, so it applies only when the API returns a UTC timestamp,
which needs the database to use the UTC time zone. Otherwise the script
sets the deadline on every pass, as it did before, and the page says so.
- `external-auth.md` anchors the new GitHub Enterprise regex example.
The older unanchored examples on that page and on `git-providers.md` are
not changed here.

### Self-review findings that were rejected

- "The builder opens for Template Admins": the Templates page needs a
successful deployment config read, which the Template Admin role does
not have.
- "Organization Admins can set AI model prices": the price write
authorizes against a site-level object, which organization-scoped grants
do not match.
- "The provisioner chart sets no default resources":
`helm/libcoder/templates/_coder.yaml` applies 2000m and 4096Mi when
`coder.resources` is empty.

### Automated review, round 1

The `coder-agents-review` app left 45 findings on `8853332`. Fixed: the
two reverts above, the anchored regex, the `coder.env` follow-ups (Lima
examples, upgrade notes, a comment in the file, and a test that covers
every option in the file), the clilog change, the two option
descriptions, and the docs findings (CORS behavior, token lifetime
example, keep-alive script, agent metadata, refresh token errors,
`switch` form type, `dbcrypt` skip list, and a stray line in a YAML
example).

Declined, with the reason on each thread:

- Refactoring the `agentexec` logging and renaming its log field: not
related to a docs conflict.
- Rewording the "process priority management not enabled (linux-only)"
log message: the docs quote the message, and the wording predates this
PR.
- Problems in code and docs that this PR does not change (the
`Capabilities` subtest, the Helm values comment, the AWS provider path
in `airgap.md`, and others in the review's out-of-scope list).

### Automated review, round 2

The app left 14 new findings on `04925bd`, and accepted the three
declined threads on `cli/agent.go`. All 14 are fixed. The main one: the
round 1 change that removed the "no loggers provided" error went too
far, because an empty log location would then start a server with no
logs. The error is back for every case except `/dev/null`.

Reported by the app as out of scope and not changed: the swagger
annotation for `GET /api/v2/experiments/available` declares an array,
but the handler returns an object with a `safe` array. Three Storybook
fixtures keep the old `--experiments` description.

### Automated review, round 3

The app confirmed that all round 2 findings are fixed, and left 10 small
findings on `f55cb6d` (8 P4, 2 Nit). All are fixed: the TLS condition
and the release range in the `coder.env` notes, one place for the
`/dev/null` rule in `clilog`, two test cases, a clearer test failure,
and the CPU example in `agent-metadata.md`.

### Automated review, rounds 4 and 5

Round 4 left one P4 on `8fffb38` (name the `--trace` option in the
logging note), which is fixed. Round 5 on `2ce754e` reports no new
findings and says every earlier finding is fixed or closed. The app did
not post an approval: it leaves its out-of-scope items and the code
fixes to a human reviewer. Two threads on `cli/agent.go` stay open on
purpose for the code owner.

### Doc-check review

The doc-check workflow left 12 comments on `2ce754e` (10 blocking, 2
suggestions). All are fixed in `c888885`: "refer to" or "visit" in place
of "see" for cross-references on the lines this PR added, the **New
template** label as the dashboard shows it, one instruction per step in
the server verification procedure of `postgres-ssl.md`, and two wording
changes in `process-priority.md`. The `CAP_SYS_NICE` sentence keeps a
short reason, which differs from the suggested text.

The `coder-agents-review` app then reviewed that commit (rounds 6 and
7). Round 6 left two P4 findings, fixed in `30b2c79`: the `failed to
adjust niceness` message is described once, in the troubleshooting
entry, with where it appears, and the client verification steps in
`postgres-ssl.md` render as one numbered list. Round 7 reports no new
findings. `2a6035c` then softens one sentence from that fix, because the
agent logs the stderr of devcontainer CLI commands. The app was not run
again on that commit.

### Adjacent gaps found and not fixed here

- `add-envbuilder.md` has the same `zip` command that
`template-from-scratch.md` had.
- `template-from-scratch.md` leaves the reader in `build/` after `cd
$_`, before a step that runs from `template-tour`.

</details>

---

_Generated by Coder Agents on behalf of @nickvigilante._

---------

Co-authored-by: Ben Potter <me@bpmct.net>
2026-11-13 21:34:59 +00:00

25 KiB

title
title
Architecture

Coder's AI agent interacts with workspaces over the same connection path as a developer's IDE, web terminal, and SSH session already use. There is no sidecar process and no new network paths. If your developers can already connect to their workspaces, the agent can too.

Architecture at a glance

Three components are involved in every agent interaction:

  1. The control plane runs the agent loop.

    It receives prompts, streams them to the large language model (LLM) provider, interprets tool calls, and dispatches them to workspaces.

  2. The LLM provider (Anthropic, OpenAI, Google, Azure, AWS Bedrock, or any OpenAI-compatible endpoint) performs model inference.

    It never communicates with the workspace directly.

  3. The workspace is standard compute infrastructure.

    It runs shell commands, reads and writes files, and executes processes (exactly what occurs when a developer connects via their IDE).

Architecture diagram

The same connection your IDE uses

This is the key architectural insight: the agent reaches into a workspace over the same Tailnet tunnel that a developer's tools already use.

When a developer opens a web terminal in the Coder dashboard, connects via VS Code Remote, or runs coder ssh, the traffic follows this path:

  1. The client connects to the control plane.
  2. The control plane routes the connection through its internal Tailnet node.
  3. The connection reaches the workspace daemon over a Designated Encrypted Relay for Packets (DERP) relay or direct peer-to-peer link.
  4. The workspace daemon handles the request (spawning a shell, forwarding a port, or serving a file).

When the agent executes a tool call (reading a file, running a command, writing code), it follows the same tunnel:

  1. The agent loop in the control plane issues a tool call.
  2. The control plane routes the call through its internal Tailnet node.
  3. The call reaches the workspace daemon over the same DERP relay or peer-to-peer link.
  4. The workspace daemon handles the request via its HTTP API (reading a file, starting a process, or writing content).

The underlying tunnel is identical. IDE connections use SSH, web terminals use a WebSocket protocol, and the agent uses the workspace daemon's HTTP API, but all three traverse the same Tailnet connection and rely on the same security boundary. No additional ports or network paths are introduced.

No inbound ports

The workspace daemon always dials out to the control plane, never the reverse. The control plane then uses that established tunnel to reach back in. This means:

  • The workspace needs no inbound ports or exposed services.
  • You can block all inbound traffic to the workspace.
  • The only required outbound connection from the workspace is to the control plane itself.

This is unchanged from how workspaces already operate in Coder. Enabling Coder Agents does not change your workspace network requirements.

The agent loop

When a user submits a prompt, the control plane processes it as a background job:

  1. The prompt is saved to the database and the chat is marked running.

  2. A chat worker in the control plane claims the chat and starts a turn.

  3. The control plane streams the conversation to the configured LLM provider.

  4. The model responds with text, reasoning, or tool calls.

  5. If the response includes tool calls, the control plane executes them and returns the results to the model.

    The control plane connects to the workspace as needed.

  6. Steps 3 through 5 repeat until the model produces a final response with no further tool calls.

  7. The chat is marked waiting for the next user message.

This loop runs inside the control plane process. There is no separate service to deploy. It is part of the same binary that serves the dashboard and API.

Context compaction

As conversations grow, the agent automatically summarizes older context to stay within the model's context window. When token usage exceeds a threshold, the agent generates a compressed summary and inserts it as a new message. Earlier messages remain in the database and are still visible to users, but are excluded from the model's context window. This happens transparently and keeps long-running sessions productive.

You can also trigger a compaction on demand by sending /compact while the agent is idle or in an error state, which clears the error. Manual compaction runs the same summarization regardless of current token usage and is labeled as manual in the conversation.

To start over without a summary, send /clear while the agent is idle or in an error state. The transcript stays visible, but the next message runs with a fresh context, as if the conversation were new. A "Context cleared" marker shows where the reset happened.

Message queuing

Users can send follow-up messages while the agent is actively working. Messages are held in the database and delivered before the agent's next model call. API and Model Context Protocol (MCP) clients can set busy_behavior to queue to deliver a message when the current turn ends (the full sequence of steps until the model stops calling tools). Interrupt the agent only to stop it, not to send it a message. There is no need to wait for a response before providing additional context or redirecting the agent.

Tool execution

Tools are how the agent takes action. Each tool call from the LLM translates to a concrete operation, either inside a workspace or within the control plane itself.

The agent is restricted to the built-in tool set defined in this section, plus any additional tools from workspace skills and Model Context Protocol (MCP) servers. Skills provide structured instructions the agent loads on demand (see Extending Agents). MCP tools come from admin-configured external servers (see MCP Servers) and from workspace .mcp.json files. The agent has no direct access to the Coder API beyond what these tools expose and cannot execute arbitrary operations against the control plane.

Workspace connection lifecycle

The connection to a workspace is lazy. It is not established when a chat starts, only when something needs to reach the workspace. This is typically triggered by the first tool call that requires workspace access. Once established, the connection is cached and reused for the duration of that chat session.

Chats that don't need workspace access (answering questions, planning an approach, discussing architecture) never provision or connect to a workspace.

Workspace tools

These tools execute inside the workspace via the workspace daemon's HTTP API. They traverse the same Tailnet tunnel used by web terminals and IDE connections.

Tool What it does
read_file Reads file contents with line-number pagination.
write_file Writes content to a file.
edit_files Performs atomic, per-file edits across one or more files, replacing old_text with new_text.
execute Runs a shell command, waiting for completion up to a timeout.
process_output Retrieves output from a tracked process.
process_list Lists all tracked processes in the workspace.
process_signal Sends a signal (SIGTERM or SIGKILL) to a tracked process.
attach_file Attach a workspace file to the current chat so the user can download it directly from the conversation. Use this when the user should receive an artifact such as a screenshot, log, patch, or document. Pass an absolute file path. The file must already exist in the workspace.

Windows workspace shell requirement

Coder Agents run workspace commands through a Portable Operating System Interface (POSIX)-compatible shell (sh). Windows workspaces must provide sh on PATH, for example from Git for Windows (Git Bash), MSYS2, or Windows Subsystem for Linux (WSL). PowerShell alone cannot run the execute tool. After installing a shell, restart the workspace to pick up the updated PATH.

Platform tools

These tools run entirely within the control plane. They do not require a workspace connection. Platform and orchestration tools are only available to root chats. Sub-agents spawned by spawn_agent do not have access to them and cannot create workspaces or spawn further sub-agents.

Tool What it does
list_templates Browses workspace templates, ordered by your recent use and organization-wide popularity. With a query, returns only matching templates, ranked by match first. For details, refer to Tools.
read_template Gets template details and configurable parameters.
create_workspace Creates a workspace from a template and waits for it to be ready.
start_workspace Starts the chat's workspace if it is currently stopped. Idempotent if already running.
stop_workspace Stops the chat's workspace and waits for the stop build to finish. Idempotent if already stopped.
propose_plan Presents a Markdown plan file from the workspace for user review before implementation.
ask_user_question Asks the user structured clarification questions during plan mode.

propose_plan and ask_user_question are only exposed while plan mode is active. In that mode, write_file and edit_files are restricted to the chat-specific plan file, while execute and process_output remain available for exploration such as cloning repositories, searching code, and running inspection commands. Root plan-mode chats can also receive administrator-approved external MCP tools. Workspace MCP tools remain unavailable in plan mode, and plan-mode sub-agents still do not receive any MCP tools. Dynamic, provider-native, and computer-use tools are not available.

Orchestration tools

These tools manage sub-agents (child chats that work on independent tasks in parallel).

Tool What it does
spawn_agent (type=general or explore) Delegates a task to a sub-agent with its own context window. Optionally accepts model_config_id and reasoning_effort to run the child on a specific enabled model instead of the configured default.
list_subagent_models Lists the enabled model configurations the agent can pass to spawn_agent as model_config_id.
wait_agent Waits for a sub-agent to finish and collects its result.
message_agent Sends a follow-up message to a sub-agent. An idle sub-agent starts a new turn. A busy sub-agent receives the message before its next model call.
interrupt_agent Halts a sub-agent's current turn; it transitions to waiting, to running if there are queued messages, or to paused if the next queued message, or any queued steer message, is being edited.
spawn_agent (type=computer_use) Spawns a sub-agent with desktop interaction capabilities (screenshot, mouse, keyboard). Runs on the organization's computer use model, or on its default model when no usable computer use model is set. The model must come from an Anthropic, OpenAI, or OpenAI-compatible AI provider, or be a Claude model from an AWS Bedrock AI provider. Requires the virtual desktop experiment.
list_agents Lists spawned child agents, most recently active first.

Provider tools

These tools are executed server-side by the LLM provider, not by the control plane or workspace. They are conditionally available based on the model configuration set by an administrator.

Tool What it does
web_search Searches the internet for up-to-date information. Available when web search is enabled for the configured Anthropic, OpenAI, or Google provider.

Workspace extension tools

These tools are conditionally available based on the workspace contents.

Tool What it does
read_skill Reads the instructions for a skill by name. Available when personal, organization, project, or workspace skills exist.
read_skill_file Reads a supporting file from a skill's directory. Available when the workspace has skills.

This tool runs in the control plane and replaces the full MCP tool schemas with a searchable catalog, so a large MCP surface does not consume the context window.

Tool What it does
find_tools Searches the deferred MCP tool catalog by keyword or exact name and activates the matching tools. Available only when the turn has MCP tools to defer.

What runs where

Understanding the split between the control plane and the workspace is central to the security model.

Responsibility Where it runs Details
Agent loop Control plane Prompt processing, tool dispatch, step iteration.
LLM inference LLM provider The control plane streams requests to the external provider.
Chat state Control plane All messages, token usage, and status stored in the database.
Git authentication Control plane Uses existing Coder external auth (GitHub, GitLab, Bitbucket).
User identity Control plane Every action is tied to the user who submitted the prompt.
Model/prompt config Control plane Administrators configure providers, models, and system prompts centrally.
File read/write Workspace The workspace file system is the source of truth for code.
Shell execution Workspace Commands run in the workspace's environment with its packages and tools.
Git operations Workspace Commits, pushes, and branch management happen inside the workspace.
Build and test Workspace Compilation, test suites, and dev servers run on workspace compute.

The workspace has zero AI awareness. There are no LLM API keys, no agent processes, and no AI-specific software installed. If you inspect a workspace created by the agent, it looks identical to one a developer created manually.

Chat state and persistence

All chat data is stored in the control plane database, not in the workspace.

  • Chat metadata: status, owner, associated workspace, timestamps, and parent/child relationships for sub-agents.
  • Messages: every message (user, assistant, tool calls, tool results) is stored as a separate record with role, content, and token usage.
  • Compressed context: when the agent compacts the conversation, summaries are stored with a compression flag so the original context budget is preserved.
  • Queued messages: follow-up messages sent while the agent is working are held until a delivery point: steer messages go in before the next model call, and queue messages go in after the turn ends.

Because state lives in the database:

  • Chat history survives workspace stops, rebuilds, and deletions.
  • An administrator can inspect any chat for audit or debugging.
  • The agent can resume work by targeting a new workspace and continuing from the last git branch or checkpoint.

Security posture

The control plane architecture provides built-in security properties for AI coding workflows. These are structural guarantees, not configuration options. They hold by default for every agent session.

No API keys in workspaces

LLM provider credentials exist only in the control plane. The workspace never sees them. There is nothing for a developer, a compromised dependency, or a rogue process to exfiltrate.

Workspaces can be fully network-isolated

Because the workspace does not need to reach any LLM provider, you can restrict its network access to only:

  • The control plane (required for the workspace daemon to function).
  • Your git provider (for push/pull operations).

Everything else can be blocked. The AI functionality comes from the control plane, not from the workspace's network.

Tip

For sensitive environments, create dedicated templates for agent workloads with stricter egress rules than your standard developer templates. Because the AI comes from the control plane, these templates do not need any outbound access to LLM providers.

Centralized enforcement

Administrators control which models are available, the system prompt, and tool configuration from the control plane. The deployment system prompt and the tool configuration are deployment-wide. Organization administrators can add organization instructions, which Coder adds after the deployment system prompt in the chats of their organization. The model list belongs to an organization, so a chat can only use the models of its own organization. Developers can select from the set of admin-enabled models when starting or continuing a chat, but cannot add their own providers or override system prompts or tool permissions. When an administrator removes a model, the change applies to all affected agent sessions immediately. Coder stores the system prompt and the organization instructions when it creates a chat, so a change to either applies to chats created afterward. Refer to Organization scope for the settings that belong to each scope.

User identity on every action

Every action the agent takes (PRs opened, code committed, commands executed) is tied to the user who submitted the prompt. There is no shared bot account or anonymous identity. If a developer submits a prompt that results in a pull request, that pull request is attributed to them via the git authentication already configured in your Coder deployment.

Permission boundaries

The agent operates with the exact same permissions as the user who submitted the prompt. If a user cannot access a template, workspace, or API endpoint through the Coder dashboard or CLI, the agent cannot access it either. There is no privilege escalation.

This extends to workspace isolation: the agent can only interact with workspaces owned by the user who started the chat. It cannot read files, execute commands, or connect to workspaces belonging to other users.

Template visibility follows the same rule. When the agent lists available templates, it sees only the templates the user is authorized to access. The agent cannot provision a workspace from a template the user does not have permission to use.

Scaling and resource impact

The control plane overhead for Coder Agents is minimal. The heavy computation happens elsewhere:

  • LLM inference runs on the external provider's infrastructure.
  • File I/O, builds, and tests run on workspace compute.
  • The control plane primarily proxies streaming responses and dispatches tool calls over existing network connections.