> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gloo.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Agents

> Built-in agents for common workflows, plus how to create custom agents with any Gloo AI model.

GlooCode uses a multi-agent architecture. Each agent is a specialized mode optimized for a different type of work — planning, implementing, researching, or general coding. You can switch between agents mid-session, or let GlooCode select the right one automatically.

## Built-in Agents

GlooCode ships with four agents that cover the most common development workflows:

| Agent     | Command    | What it does                                                                                          |
| --------- | ---------- | ----------------------------------------------------------------------------------------------------- |
| `plan`    | `/plan`    | Thinks through architecture, design decisions, and implementation strategy before any code is written |
| `build`   | `/build`   | Focused implementation — writes code, runs tests, orchestrates multi-step changes, and commits        |
| `explore` | `/explore` | Researches codebases, reads documentation, explores APIs, and gathers context                         |
| `general` | `/general` | The default agent — handles most coding tasks without needing to switch                               |

### How to Switch Agents

Type the agent command (e.g., `/plan`) in the TUI to switch. You can switch as many times as you want within a session. Your conversation history carries over, so the new agent has full context of what you've been working on.

### When to Use Each Agent

**Use `plan` when** you're starting something complex — a new feature, a migration, a refactor that touches many files. It will think through the approach, identify risks, and lay out a step-by-step plan before any code is written.

**Use `build` when** you know what you want and need focused execution. You have a plan (or the task is straightforward enough to not need one), and you want code written, tests passing, and changes committed.

**Use `explore` when** you're unfamiliar with a codebase or need to understand how something works before changing it. It reads files, traces call chains, and summarizes what it finds.

**Use `general` when** the task is self-contained and doesn't need a specialized approach. This is the default — if you're not sure which agent to use, start here.

## Custom Agents

You can define your own agents that use any [model available through Gloo AI](/api-guides/supported-models). Custom agents let you create specialized tools for your team's specific workflows — code reviewers, QA testers, documentation writers, security auditors, or anything else.

Custom agents are configured in `~/.config/gloocode/gloocode.json`:

```json theme={null}
{
  "$schema": "https://gloocode.ai.gloo.com/config.json",
  "agent": {
    "<agent-name>": {
      "mode": "subagent",
      "model": "<gloo-model-id>",
      "description": "What this agent does.",
      "prompt": "System prompt that defines the agent's behavior.",
      "permission": {
        "glob": "allow",
        "grep": "allow",
        "read": "allow",
        "bash": "allow",
        "edit": "allow"
      }
    }
  }
}
```

### Configuration Fields

| Field         | Required | Description                                                                                                                         |
| ------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| `mode`        | Yes      | Always `"subagent"` for custom agents                                                                                               |
| `model`       | Yes      | A Gloo AI model ID (e.g., `gloo-anthropic-claude-sonnet-4.5`). See [Supported Models](/api-guides/supported-models) for all options |
| `description` | Yes      | A short summary shown when listing agents — helps you remember what each one does                                                   |
| `prompt`      | Yes      | The system prompt that defines how the agent behaves, what it focuses on, and how it should respond                                 |
| `permission`  | No       | Fine-grained control over what the agent can do. Defaults to all allowed if omitted                                                 |

### Example: Code Review Agent

This agent can read code and run commands but **cannot edit files** — useful for getting an independent review of your changes before committing.

```json theme={null}
{
  "$schema": "https://gloocode.ai.gloo.com/config.json",
  "agent": {
    "review": {
      "mode": "subagent",
      "model": "gloo-anthropic-claude-sonnet-4.5",
      "description": "Post-implementation code reviewer.",
      "prompt": "Review the diff for bugs, security issues, and performance problems. Be specific about what's wrong and why. Your verdict must be APPROVED, CHANGES REQUESTED, or BLOCKED.",
      "permission": {
        "glob": "allow",
        "grep": "allow",
        "read": "allow",
        "bash": "allow",
        "edit": "deny"
      }
    }
  }
}
```

Once saved, switch to this agent with `/review` in the TUI.

### Example: QA Agent

This agent tries to break your implementation by running tests and checking edge cases — also read-only so it can't fix what it finds.

```json theme={null}
{
  "$schema": "https://gloocode.ai.gloo.com/config.json",
  "agent": {
    "qa": {
      "mode": "subagent",
      "model": "gloo-openai-gpt-5.5-pro",
      "description": "Pre-commit verification agent.",
      "prompt": "Try to break the implementation. Run tests, check edge cases, verify API contracts. Report what you find with severity levels. Your verdict must be PASS, FAIL, or PARTIAL.",
      "permission": {
        "glob": "allow",
        "grep": "allow",
        "read": "allow",
        "bash": "allow",
        "edit": "deny"
      }
    }
  }
}
```

### Permission Reference

Permissions control what tools a custom agent can use. Set each to `"allow"` or `"deny"`. If you omit the `permission` block entirely, all permissions default to `"allow"`.

| Permission  | What it controls                                             |
| ----------- | ------------------------------------------------------------ |
| `glob`      | Search for files by name or pattern                          |
| `grep`      | Search inside file contents                                  |
| `read`      | Read file contents                                           |
| `bash`      | Execute shell commands (tests, builds, scripts)              |
| `edit`      | Create or modify files                                       |
| `lsp`       | Language server features (go-to-definition, find references) |
| `webfetch`  | Fetch content from URLs                                      |
| `websearch` | Search the web                                               |
| `skill`     | Use skills and plugins                                       |
| `task`      | Create and manage task lists                                 |
| `question`  | Ask you clarifying questions                                 |

<Tip>
  **Best practice:** Read-only agents (reviewers, auditors) should set `"edit": "deny"` to prevent accidental modifications. This is especially useful when you want an independent second opinion — the agent can analyze but not change anything.
</Tip>

### Available Models

Custom agents can use any model available through Gloo AI. Model IDs follow the format `gloo-<provider>-<model-name>`. Here are some common choices:

| Use case                     | Suggested model                    | Why                                              |
| ---------------------------- | ---------------------------------- | ------------------------------------------------ |
| Code review, planning        | `gloo-anthropic-claude-sonnet-4.5` | Strong reasoning, good at catching subtle issues |
| Fast iteration, simple tasks | `gloo-anthropic-claude-haiku-4.5`  | Fast and cost-effective for straightforward work |
| Alternative perspective      | `gloo-openai-gpt-5.5-pro`          | Different model family for diverse review        |
| Cost-sensitive bulk work     | `gloo-google-gemini-2.5-flash`     | Low cost per token for high-volume tasks         |

See [Supported Models](/api-guides/supported-models) for the full list.

## Related

<CardGroup cols={3}>
  <Card title="Bring Your Skills" icon="arrows-left-right" href="/gloocode/migrate-skills">
    Already have custom rules or agents in another tool? Migrate them to GlooCode.
  </Card>

  <Card title="Installation & Setup" icon="terminal" href="/gloocode/installation">
    Install GlooCode and connect it to your Gloo AI account.
  </Card>

  <Card title="Libraries & SDKs" icon="code" href="/api-guides/sdks-and-libraries">
    Use the same Gloo AI credentials with the OpenAI Python and Node.js SDKs.
  </Card>
</CardGroup>
