# set_agent_defaults

URL: https://codepanel.ai/docs/mcp-server/set_agent_defaults

The CodePanel MCP tool that sets the account's default agent or team for new threads, swarm workers, planner or fallback.

`set_agent_defaults` sets which agent or team is the default for one or more roles. It needs the `agents:write` scope, since a default decides which model a new thread runs on.

Each role you name takes `auto`, `agent:<id>` or `team:<id>`; roles you leave out stay as they are, and `auto` clears one. A team fits `newThread` only: the other roles take one agent. Every value is checked before any is written, so a refused call changes nothing.

## When to call it

- **When the owner names** which agent or team should take new threads, or which agents swarms should use.
- **To undo a change**: send the `before` values the last call returned.

## Inputs

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `newThread` | string | no | What a new thread in the desktop app starts with: auto, agent:<id> or team:<id> |
| `swarmWorker` | string | no | The agent a swarm fans out to: auto or agent:<id> |
| `planner` | string | no | The agent that plans a swarm: auto or agent:<id> |
| `fallback` | string | no | The agent a step moves to when its model fails twice: auto or agent:<id> |

It writes: the server marks it `readOnlyHint: false` and `destructiveHint: true` (it can change what is already there), so a client that asks before writes asks here.

## What it returns

`{ before, after }`, each shaped as [`get_agent_defaults`](/docs/mcp-server/get_agent_defaults) returns it. An id that is not one of the account's agents or teams is refused with `not_found`; a malformed value, a team for a role other than `newThread`, or a call naming no role with `precondition`.

## The same step without MCP

| Surface | Form |
| --- | --- |
| HTTP API | `POST /autopilot/defaults` with the `agents:write` scope |
| CLI | `codepanel defaults set --new-thread <v> --swarm-worker <v> --planner <v> --fallback <v>` |
| Desktop app | Settings, Models & providers, Defaults |

## What the server tells your agent

The description your agent reads when it lists the tools:

> Use it when the owner names which agent or team should be the default for a role. Sets only the roles given; auto clears one. Ids come from list_coding_agents and list_teams; a team fits newThread only. Needs agents:write. Returns { before, after }, each as get_agent_defaults; send before's values back to undo.

## Related

- [`get_agent_defaults`](/docs/mcp-server/get_agent_defaults): read them first.
- [`list_coding_agents`](/docs/mcp-server/list_coding_agents) and [`list_teams`](/docs/mcp-server/list_teams): ids to name.
- [MCP server](/docs/mcp-server): install, sign-in and every other tool.
