# Agents

> Set up the agents that run your tasks on the desk: pick for each one the way it works, a key checked before it is saved or its own sign-in, and give agents on your computer a key.

Your desk runs tasks with Claude Code, Codex, OpenCode or a command of your own. The **Agents** page lists the agents your account has, and whether each is signed in. Each agent has one setup page: its top line says what the agent runs on now, with **Change**; under it you pick one way, a key or its own sign-in, and only that way opens. No terminal is needed.

## Claude Code

Claude Code runs tasks on a Claude API key from the Claude Console, a Claude plan token, an LLM Gateway key or your Claude plan. On its setup page:

- Claude API key (from the Claude Console): paste a key from the Claude Console. Max and Team plans include monthly API credits, and they pay for tasks on this key ([how the credits work](https://platform.claude.com/docs/en/about-claude/api-credits-for-subscribers)). Tasks on this key run Claude Code in its non-interactive mode, the one the credits cover. A follow-up, a question to you and the summary work as on any task. When the key has no credit left, the task stops and says so, with the fix.
- Claude plan token: on a computer where Claude Code is signed in to your plan, run `claude setup-token` and paste the token.
- **LLM Gateway key**: paste the key, then pick the model.
- **Sign in with your Claude plan**: open the sign-in page, then paste the code it gives you. To use the desk terminal instead, press **Use the desk terminal instead**.

The way you pick is the one its tasks use: saving a key makes it the one in use, and a key already saved switches back with **Use this key** (**Use this token** for a plan token).

Remote Control lets you follow and steer Claude Code tasks from the Claude app on your phone or computer. Turn it on from the Agents page. Tasks on a Claude API key run without it, and with **Ask every time** permissions what would ask is refused (the agent says so in its answer).

## Codex

Codex runs tasks on your ChatGPT plan or on an LLM Gateway key. On its setup page, paste an LLM Gateway key, or sign in with your ChatGPT plan: the page shows the link and the code you type there. Codex needs the large Linux size, which counts 2.5 desk minutes a minute; the page asks before it switches.

Codex does not stop to ask during a task. How much it may do is **Settings**, **Tasks**, **Access**: **Standard** or **Full (default)**.

## OpenCode

OpenCode runs tasks on a Claude API key, an LLM Gateway key, your OpenCode account or your ChatGPT plan. Pick the way on its setup page, then the model for its tasks there. On a Claude API key it runs the Claude models.

## Your own agent

Your own agent is a command that runs on the desk with the task's text in `$TASK`. Define it from the API: `PUT /v1/agents/custom/{name}`.

## Sign-in

Each agent signs in once on your desk, on the vendor's own page. The sign-in browser on your desk keeps the session. On the **Sign-in for agents** page (in the account menu) you approve which agents may use each site, and for how long. Its activity log is signed, and your browser checks it.

> [!NOTE]
> Maindesk does not see your sign-ins. The vendor's page opens inside your desk's browser.

## Model keys

A model key (a Claude API key, a Claude plan token or an LLM Gateway key) goes in a password field on the agent's setup page. Press **Check and save**: Maindesk asks the key's provider once whether it accepts the key (it lists the models), and only then writes the key to a private file on your desk. Maindesk does not keep it, log it or send it back. A saved key shows only its last 4 characters, with **Replace** and **Remove**.

If the provider refuses the key, nothing is saved and the page says why, in the provider's own words (the error `key_refused`). Copy the whole key again, or make a new one, and save it again. If the provider does not answer, the error is `key_check_failed`: try again in a minute.

The same from your computer: `maindesk agents key set anthropic_key` (the key is read from standard input), `maindesk agents key check`, `list`, `remove` and `use`; over MCP the `agent_keys` tool; over the API `PUT /v1/agents/keys/{source}`, `POST /v1/agents/keys/{source}/check`, `GET /v1/agents/keys`, `DELETE /v1/agents/keys/{source}` and `PUT /v1/agents/{agent}/uses`.

## Keys

A key lets an agent on your computer use your desk. Make and revoke keys on the Agents page or in Settings. Each key shows when it was last used and how: from an agent app (MCP), from the command line or from a script. Revoking a key stops it at once.

## Next steps

- [Tasks](/docs/tasks): start a task with the agent you set up
- [Connect: CLI, MCP and API](/docs/connect): connect an agent on your computer
- [Security and your data](/docs/security): who sees what
