3.4 KiB
3.4 KiB
Agent Guide
This guide explains how to configure and create custom agents in TAKT.
Built-in Agents
TAKT includes three built-in agents:
| Agent | Tools | Purpose |
|---|---|---|
coder |
Read, Glob, Grep, Edit, Write, Bash, WebSearch, WebFetch | Implements features and fixes bugs |
architect |
Read, Glob, Grep, WebSearch, WebFetch | Reviews code and provides feedback |
supervisor |
Read, Glob, Grep, Bash, WebSearch, WebFetch | Final verification and approval |
Specifying Agents
In workflow YAML, agents can be specified by:
# Built-in agent name
agent: coder
# Path to prompt file
agent: ~/.takt/agents/my-agent.md
# Project-local agent
agent: ./.takt/agents/reviewer.md
# Absolute path
agent: /path/to/custom/agent.md
Creating Custom Agents
Agent Prompt File
Create a Markdown file with your agent's instructions:
# Security Reviewer
You are a security-focused code reviewer.
## Your Role
- Check for security vulnerabilities
- Verify input validation
- Review authentication logic
## Guidelines
- Focus on OWASP Top 10 issues
- Check for SQL injection, XSS, CSRF
- Verify proper error handling
## Output Format
Output one of these status markers:
- [REVIEWER:APPROVE] if code is secure
- [REVIEWER:REJECT] if issues found
Status Markers
Agents must output status markers for workflow transitions:
| Status | Example Pattern |
|---|---|
| done | [AGENT:DONE] |
| blocked | [AGENT:BLOCKED] |
| approved | [AGENT:APPROVED], [AGENT:APPROVE] |
| rejected | [AGENT:REJECTED], [AGENT:REJECT] |
Advanced Configuration
Using agents.yaml
For more control, define agents in .takt/agents.yaml:
agents:
- name: security-reviewer
prompt_file: .takt/prompts/security-reviewer.md
allowed_tools:
- Read
- Glob
- Grep
status_patterns:
approved: "\\[SECURITY:APPROVE\\]"
rejected: "\\[SECURITY:REJECT\\]"
Tool Permissions
Available tools:
Read- Read filesGlob- Find files by patternGrep- Search file contentsEdit- Modify filesWrite- Create/overwrite filesBash- Execute commandsWebSearch- Search the webWebFetch- Fetch web content
Best Practices
- Clear role definition - State what the agent does and doesn't do
- Explicit output format - Define exact status markers
- Minimal tools - Grant only necessary permissions
- Focused scope - One agent, one responsibility
- Examples - Include examples of expected behavior
Example: Multi-Reviewer Setup
# .takt/agents.yaml
agents:
- name: security-reviewer
prompt_file: .takt/prompts/security.md
allowed_tools: [Read, Glob, Grep]
status_patterns:
approved: "\\[SEC:OK\\]"
rejected: "\\[SEC:FAIL\\]"
- name: performance-reviewer
prompt_file: .takt/prompts/performance.md
allowed_tools: [Read, Glob, Grep, Bash]
status_patterns:
approved: "\\[PERF:OK\\]"
rejected: "\\[PERF:FAIL\\]"
# workflow.yaml
steps:
- name: implement
agent: coder
# ...
- name: security-review
agent: security-reviewer
transitions:
- condition: approved
next_step: performance-review
- condition: rejected
next_step: implement
- name: performance-review
agent: performance-reviewer
transitions:
- condition: approved
next_step: COMPLETE
- condition: rejected
next_step: implement