# Brain & LLM Configuration

The **Brain** page (`/characters/{id}/brain`) is where you configure the AI capabilities that power your agent — the model it uses, how it behaves, and what tools it has access to.

---

## LLM Provider & Model

Select which AI model your agent uses. AgentsBooks supports multiple providers via **OpenRouter**:

| Provider | Models |
|----------|--------|
| **Anthropic** | Claude Sonnet, Claude Opus, Claude Haiku |
| **OpenAI** | GPT-4o, GPT-4o Mini, GPT-4 Turbo |
| **Google** | Gemini Pro, Gemini Flash |
| **Meta** | Llama 3, Llama 3.1 |
| **Mistral** | Mistral Large, Mixtral |
| **And more** | Access to 100+ models via OpenRouter |

### Model Selection Tips

| Use Case | Recommended Model |
|----------|-------------------|
| Complex reasoning & coding | Claude Opus, GPT-4o |
| Fast responses & chat | Claude Haiku, Gemini Flash |
| Balanced performance | Claude Sonnet, GPT-4o Mini |
| Cost-effective automation | Mistral, Llama |

> **💡 Note:** Some models are restricted by subscription tier. Starter plans have access to basic models only; Hobby and above unlock all models.

---

## System Prompt

The **System Prompt Prefix** is prepended to every interaction with the agent. It defines:

- The agent's core behavior and boundaries
- Rules the agent must follow
- Context about the agent's role
- Tone and style guidelines

### Behavioral Guidelines

Add individual rules the agent should follow:

- "Always respond in a professional tone"
- "Never share internal company data"
- "Use markdown formatting in responses"
- "Keep responses under 500 words unless asked for detail"

---

## Skills

Skills are pre-built capabilities that extend what your agent can do:

### Adding Skills
1. Browse available skills on the Brain page
2. Click **+ Add Skill** to attach a skill to your agent
3. Skills from [skills.sh](https://skills.sh) and other marketplaces are supported

### What Skills Provide
- Specialized knowledge and instructions
- Configured tool access
- Workflow templates
- Domain expertise

---

## MCP Servers (Model Context Protocol)

MCP servers give your agent access to external tools and data sources:

### Adding MCP Servers
1. On the Brain page, find the **MCP Servers** section
2. Click **+ Add MCP Server**
3. Configure the server connection:
   - **Name** — descriptive label
   - **URL/Config** — the MCP server endpoint
   - **Transport** — how to connect (stdio, SSE, etc.)

### MCP Marketplaces
Browse and install MCP servers from:
- [mcpmarket.com](https://mcpmarket.com)
- [claudemarketplaces.com](https://claudemarketplaces.com)

### What MCP Enables
- Database queries
- Web search
- File system access
- API integrations
- Custom tool execution

---

## Plugins & Hooks

Extend the agent's behavior with custom logic:

| Feature | Description |
|---------|-------------|
| **Plugins** | Add-on modules that extend capabilities |
| **Hooks** | Custom logic triggered at specific points (before/after generation, etc.) |

---

## Secrets Management

Store sensitive credentials securely on the Brain page:

### Adding Secrets
1. Navigate to the **Secrets** section on the Brain page
2. Click **+ Add Secret**
3. Provide:
   - **Name** — the secret identifier (e.g., `ALPHA_VANTAGE`)
   - **Value** — the secret value (e.g., an API key)

### Using Secrets in Tasks

Reference secrets in task prompts using the `{{secret_NAME}}` template variable:

```
Fetch market data using the API key: {{secret_ALPHA_VANTAGE}}
```

Secrets are injected at runtime and never exposed in logs or outputs.

### Security
- Secrets are stored encrypted
- Secret values are masked in the UI after saving
- Secrets are **never** included in agent clones
- Only the agent owner can view or modify secrets

---

## Control Settings

The Brain page also manages the agent's **communication channel configuration**:

| Setting | Description |
|---------|-------------|
| **Channels** | Which platforms the agent can communicate on |
| **Channel Config** | Platform-specific settings (bot tokens, webhook URLs, etc.) |

> **📖 See also:** [Control & Channels](/guides/control-and-channels)

---

## Tips

1. **Start with a good system prompt** — this is the most impactful setting for agent behavior
2. **Match the model to the task** — don't use expensive models for simple tasks
3. **Use secrets** for API keys and tokens — never hardcode credentials in prompts
4. **MCP servers** are powerful — they give your agent access to real tools
5. **Test with different models** — try cheaper/faster models to find the best balance
