Skip to main content

Overview

Specialized agents are custom configurations that modify how any base AI agent behaves. Apply “personas” like “security expert” or “test writer” to any LLM for task-specific optimization.
Key Concept: Specialized agents are prompts + configurations, not separate models. They work with ANY base LLM!

How They Work


Built-in Specialized Agents

Security Expert

Focus on security best practices and vulnerability prevention.
Behaviors:
  • Always validates input
  • Considers injection attacks
  • Implements proper sanitization
  • Adds rate limiting
  • Includes security headers
  • Documents security decisions
Best for: Auth systems, API endpoints, data handling

Test Writer

Comprehensive test coverage with edge cases.
Behaviors:
  • Writes tests first (TDD)
  • Covers edge cases
  • Tests error handling
  • Adds integration tests
  • Achieves 90%+ coverage
  • Documents test scenarios
Best for: New features, refactoring, bug fixes

Performance Optimizer

Optimize for speed and efficiency.
Behaviors:
  • Profiles bottlenecks
  • Adds caching
  • Optimizes queries
  • Reduces allocations
  • Implements lazy loading
  • Measures improvements
Best for: Slow endpoints, database queries, large datasets

Documentation Writer

Clear, comprehensive documentation.
Behaviors:
  • Writes clear JSDoc/docstrings
  • Includes usage examples
  • Explains edge cases
  • Creates README sections
  • Adds inline comments
  • Documents assumptions
Best for: Public APIs, complex logic, team projects

Code Reviewer

Thorough code review with suggestions.
Behaviors:
  • Checks code style
  • Identifies bugs
  • Suggests improvements
  • Reviews tests
  • Validates architecture
  • Provides constructive feedback
Best for: PR reviews, code audits, refactoring validation

Accessibility Expert

WCAG-compliant accessible interfaces.
Behaviors:
  • Adds ARIA labels
  • Ensures keyboard navigation
  • Proper focus management
  • Screen reader support
  • Color contrast compliance
  • Semantic HTML
Best for: UI components, forms, interactive features

Creating Custom Agents

Configuration File

Create .forge/agents.yaml:

Using Custom Agents


Agent Combinations

Apply multiple agents to same task:
Result: Code that’s secure, well-tested, AND fast!

Agent Templates

Frontend Component Agent

Backend API Agent

Infrastructure Agent


SDK Usage

JavaScript/TypeScript


Best Practices

Match Agent to Task

Combine Strategically

Don’t use all agents at once:Good: security-expert + test-writer Bad: All 8 agents (conflicting priorities)

Create Team Agents

Codify your team’s style:

Iterate and Refine

Test agent configs:

Agent Configuration Options

Temperature

Controls creativity vs consistency:

Max Tokens

Control response length:

Examples

Provide examples for better results:

Measuring Agent Effectiveness

Track which agents work best:

Troubleshooting

Issue: Agent behavior not visibleSolutions:
  • Check agent config is loaded
  • Verify agent name matches
  • Inspect system prompt in logs
  • Try more explicit instructions
Issue: Multiple agents conflictSolution: Limit to 2-3 compatible agents:Good: security + testing Bad: performance + comprehensive-docs (conflicting goals)
Issue: Agent over-optimizes for one aspectSolution: Adjust temperature or prompt:

Real-World Examples

Example 1: Secure Payment Processing

Result:
  • Input validation on all endpoints
  • Webhook signature verification
  • Idempotency keys
  • Error handling
  • Comprehensive tests (95% coverage)
  • Security documentation

Example 2: Public API

Result:
  • RESTful URL design
  • Proper HTTP methods
  • OpenAPI specification
  • Request/response examples
  • Error documentation
  • Rate limiting docs

Next Steps

Task Templates

Reusable task patterns

Parallel Execution

Run multiple agents simultaneously

AI Agents Overview

Learn about base AI agents

Workflows

Complete development workflows