---
title: "Custom Agents"
description: "Define specialized AI agents for specific workflows."
section: "configuration"
url: "https://forkline.dev/docs/opencode/agents"
markdown: "https://forkline.dev/docs/opencode/agents.md"
source: "src/content/docs/opencode/agents.md"
---

# Custom Agents

Define specialized agents for specific workflows in your repository.

## Overview

Agents are AI assistants with tailored expertise. Create them in `.opencode/agents/` to customize behavior for your project.

## Creating an Agent

Create `.opencode/agents/reviewer.md`:

```markdown
---
name: Security Reviewer
description: Reviews code for security vulnerabilities
tools: [read, grep, webfetch]
---

Check for:
- Authentication and authorization issues
- Input validation problems
- SQL injection and XSS risks
- Hardcoded secrets
- Insecure dependencies

Provide severity ratings (Critical/High/Medium/Low).
```

## Agent Configuration

| Field | Description |
|-------|-------------|
| `name` | Display name |
| `description` | What the agent does |
| `tools` | Allowed tools (optional) |

### Available Tools

- `read` — Read files
- `write` — Create files
- `edit` — Modify files
- `bash` — Run commands
- `grep` — Search code
- `glob` — Find files
- `webfetch` — Fetch URLs

## Example Agents

### Code Reviewer

```markdown
---
name: Code Reviewer
description: Reviews code quality
tools: [read, grep, glob]
---

Review for:
- Code quality and readability
- Potential bugs
- Performance issues
- Test coverage

Don't make changes — just report findings.
```

### Test Writer

```markdown
---
name: Test Writer
description: Generates tests
tools: [read, write, edit, bash]
---

Generate tests for:
- Unit tests for all functions
- Edge cases
- Error scenarios

Use the project's testing framework.
```

### Documentation Writer

```markdown
---
name: Docs Writer
description: Writes documentation
tools: [read, write, glob]
---

Create:
- API documentation
- Usage examples
- README sections

Keep it concise and practical.
```

## Using Agents in Forkline

Agents defined in `.opencode/agents/` are available in all runners for that repository.

Reference them in prompts:

```
Use the Security Reviewer to audit the authentication module.
```

## Resources

- [OpenCode Agents Documentation](https://opencode.ai/docs/agents)
