Skip to content
55 changes: 55 additions & 0 deletions src/oss/deepagents/code/approval-modes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,61 @@ flowchart TD
```
</Accordion>

### Select a classifier model

By default, the Auto classifier uses the same model as the main agent. You can point it at a different (typically cheaper and faster) model to reduce cost and latency during Auto review without affecting the model used for your actual tasks.
Comment thread
mdrxy marked this conversation as resolved.
Resolved

Set the classifier model through any of these sources, listed from highest to lowest precedence:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we put this in an accordion


1. **`/auto model` TUI command** — takes effect immediately for the current session.
2. **`--auto-classifier-model` flag** — sets the classifier for the launch (interactive TUI sessions only).
3. **`DEEPAGENTS_CODE_AUTO_CLASSIFIER_MODEL` environment variable** — applies at startup.
4. **`[models].auto_classifier` in `config.toml`** — your persistent default.
5. **Inherit** — uses the main agent model (the default when nothing is configured).

A blank value at any level means "inherit from the next source". For example, an unset env var falls through to `config.toml`.

<Tabs>
<Tab title="TUI command">
```txt
/auto model anthropic:claude-haiku-4-5
/auto model clear
```

`/auto model` validates the spec before accepting it. Use `/auto model clear` to go back to inheriting the main model.
</Tab>
<Tab title="CLI flag">
```bash
dcode -y --auto-classifier-model anthropic:claude-haiku-4-5
```

`--auto-classifier-model` is only accepted in interactive TUI sessions. It errors in non-interactive (`-n`) and ACP server modes.
</Tab>
<Tab title="Environment variable">
```bash
export DEEPAGENTS_CODE_AUTO_CLASSIFIER_MODEL="anthropic:claude-haiku-4-5"
```

<Warning>
A **project `.env`** cannot set `DEEPAGENTS_CODE_AUTO_CLASSIFIER_MODEL`. Only shell exports, `~/.deepagents/.env`, the CLI flag, and `/auto model` work. This prevents a cloned repository from silently redirecting your approval review to a weaker model.
</Warning>
</Tab>
<Tab title="config.toml">
```toml title="~/.deepagents/config.toml"
[models]
auto_classifier = "anthropic:claude-haiku-4-5"
```
</Tab>
</Tabs>

The TUI displays which model is reviewing when Auto turns on and inside `/auto model` output—including models set by env var or `config.toml`.

<Warning>
A weaker classifier means weaker review. A less capable model may be more susceptible to prompt injection in the content it reads. This tradeoff is documented in the Deep Agents Code threat model (T14).
</Warning>

Comment thread
mdrxy marked this conversation as resolved.
Resolved
**Fail-closed on errors.** If the configured classifier model cannot be built—because of a bad spec, missing credentials, or a missing provider package—the calls it would have reviewed are **denied** and do not fall back to the main model. After repeated failures, Auto stops and shows you the normal approval UI. The error message names the model so you can identify and fix the problem.
Comment thread
npentrel marked this conversation as resolved.
Resolved

### Revalidate before side effects

The decision plan is bound to the thread, mode, batch, and exact gated calls. Missing or invalid state, a mode race, or a replay falls back to human review. For example, if you switch to Manual while classifier review is in progress, an earlier Auto decision cannot execute silently; the normal approval UI opens instead.
Expand Down
1 change: 1 addition & 0 deletions src/oss/deepagents/code/cli-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ Run OAuth login for MCP servers marked `auth: "oauth"` with `dcode mcp login <se
| `--no-stream` | Buffer the full response and write to stdout at once instead of streaming. Requires `-n` or piped stdin |
| `--stdin` | Read input from stdin explicitly instead of auto-detection. Errors clearly when stdin is unavailable or is a TTY |
| `-y`, `--auto-approve` | Enable classifier-backed [Auto](/oss/deepagents/code/approval-modes) mode. Requires an interactive local session; toggle with `Shift+Tab` during an interactive session |
| `--auto-classifier-model MODEL` | Model used by the [Auto classifier](/oss/deepagents/code/approval-modes#select-a-classifier-model) to review gated tool calls (`provider:model` format). Overrides `DEEPAGENTS_CODE_AUTO_CLASSIFIER_MODEL` and `[models].auto_classifier` in `config.toml`. Interactive TUI sessions only — errors in non-interactive and ACP modes |
Comment thread
mdrxy marked this conversation as resolved.
Resolved
| `--yolo` | Run gated actions without review after the one-time local risk acknowledgement. Interactive mode only |
| `-S`, `--shell-allow-list LIST` | Comma-separated shell commands to auto-approve, `'recommended'` for safe defaults, or `'all'` to allow any command. Applies to both `-n` and interactive modes |
| `--allow-fs-tools LIST` | Filesystem tools to expose. Defaults to `all`. See [Restrict filesystem tools](#restrict-filesystem-tools) |
Expand Down
3 changes: 3 additions & 0 deletions src/oss/deepagents/code/config-file.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@ description: Configure model providers, defaults, retries, and gateways in confi
[models]
default = "ollama:qwen3:4b" # your intentional long-term preference
recent = "google_genai:gemini-3.6-flash" # last /model switch (written automatically)
auto_classifier = "anthropic:claude-haiku-4-5" # optional: cheaper model for Auto approval review
Comment thread
mdrxy marked this conversation as resolved.
Resolved
```

`[models].default` always takes priority over `[models].recent`. The `/model` command only writes to `[models].recent`, so your configured default is never overwritten by mid-session switches. To remove the default, use `/model --default --clear` or delete the `default` key from the config file.

`[models].auto_classifier` sets the model used by the [Auto approval classifier](/oss/deepagents/code/approval-modes#select-a-classifier-model) to review gated tool calls. When unset, the classifier inherits the main agent model. You can override this at runtime with `--auto-classifier-model` or `/auto model`. See [Select a classifier model](/oss/deepagents/code/approval-modes#select-a-classifier-model) for full precedence and security notes.

## Default and recent agent

```toml
Expand Down
Loading