docs: keep Coder Agents off Agent Relay templates (#32861)

Templates allow Coder Agents by default, so a Coder Agents chat can pick
an Agent Relay template and create a workspace from it. This documents
how to block that.

- `docs/agent-relay/setup.md`: adds a "Keep Coder Agents off Relay
templates" recommendation to Step 3, with the CLI (`coder templates edit
<template> --agents-allowed=false`) and the dashboard path (**Admin
settings** > **AI** > **Coder Agents** > **Templates**, or the
template's settings page). It notes that the setting doesn't affect
Agent Relay, which creates workspaces with its service account.
- `docs/coder-agents/platform-controls/index.md`: adds a Template
routing example that links to the Relay template step.

`agents_allowed` is enforced only by the Coder Agents chat tools
(`list_templates`, `read_template`, `create_workspace`) and chat project
templates, so Relay's workspace creation is unaffected.
This commit is contained in:
Douglas Luman authored and GitHub committed 2026-12-01 16:38:59 -05:00
1 parent 5d64266184
commit ca8a7c24a1
2 files changed
+13

No files matched your search

+12
View File
@@ -195,6 +195,18 @@ We also recommend that you:
- **Use a dedicated template.**
Relay workspaces are ephemeral and machine-driven.
A separate template keeps quotas, access control, and activity policy for people from interfering.
- **Keep Coder Agents off Relay templates.**
Templates allow [Coder Agents](../coder-agents/index.md) by default, so a Coder Agents chat can choose a Relay template and create a workspace from it.
To block Coder Agents from a Relay template, run:
```shell
coder templates edit <template> --agents-allowed=false
```
To do this in the dashboard, go to **Admin settings** > **AI** > **Coder Agents** > **Templates** and turn off the switch for the template.
You can also turn off **Allow Coder Agents to create workspaces using this template** on the template's settings page.
This setting doesn't affect Agent Relay, which creates workspaces with its service account, not through Coder Agents.
For more information, refer to [Restrict available templates](../coder-agents/platform-controls/template-optimization.md#restrict-available-templates).
- **Use quotas to control spend.**
Relay builds count against the session owner's [quota](../admin/users/quotas.md), the same as any other workspace.
Coder enforces quota during the build, so a build that exceeds the owner's quota fails and Agent Relay deletes the workspace.
@@ -107,6 +107,7 @@ This is separate from what developers observe when manually creating workspaces,
The same control is available outside the dashboard.
Use `coder templates create --agents-allowed=false` or `coder templates edit --agents-allowed=false <template>` for a single template.
Use the search filter `agents-allowed:false` on `GET /api/v2/templates` to list the templates that block agents.
We recommend that you block agents from [Agent Relay templates](../../agent-relay/setup.md#step-3-prepare-a-workspace-template), because those templates are for Agent Relay only.
Refer to [Template Optimization](./template-optimization.md) for best practices on writing discoverable descriptions, restricting template visibility, configuring network boundaries, scoping credentials, and designing template parameters for agent use.