Skip to main content

Agents Overview

Meet the 16 specialized agents that power Apex AI Brain.

What Are Agents?​

Agents are specialized AI-powered assistants, each focused on a specific domain of Salesforce development. They work together through shared memory to break down complex tasks into manageable, quality-assured work.

Agent Directory​

🏗 Architects (4 Agents)​

Agents responsible for design and architecture decisions.

Apex Architect​

Specialization: Apex code structure and design patterns

  • Designs class hierarchies
  • Enforces FSD (Feature-Sliced Design)
  • Creates domain models
  • Ensures separation of concerns
  • Use when: Designing service layers, defining architecture

LWC Builder​

Specialization: Lightning Web Component development

  • Creates component templates
  • Handles data binding
  • Optimizes performance
  • Follows LWC best practices
  • Use when: Building interactive UI components

Schema Analyst​

Specialization: Data model design

  • Designs custom objects
  • Creates relationships
  • Defines fields and validations
  • Optimizes data structure
  • Use when: Planning data architecture

Flow Advisor​

Specialization: Salesforce Flow automation

  • Designs flow structures
  • Recommends automation patterns
  • Optimizes flow logic
  • Handles complex decision trees
  • Use when: Building process automation

🔍 Reviewers (4 Agents)​

Agents responsible for code review and quality assurance.

Apex Reviewer​

Specialization: Apex code quality and patterns

  • Reviews code for maintainability
  • Checks pattern usage
  • Suggests refactoring
  • Validates best practices
  • Use when: Need code review

Security Agent​

Specialization: Security & compliance

  • Checks for vulnerabilities
  • Verifies security patterns
  • Audits compliance
  • Recommends hardening
  • Use when: Auditing security

Test Writer​

Specialization: Test automation

  • Generates test classes
  • Creates test scenarios
  • Calculates coverage
  • Optimizes test performance
  • Use when: Need comprehensive tests

Diff Reviewer​

Specialization: Git diff analysis

  • Analyzes code changes
  • Reviews commits
  • Generates PR descriptions
  • Suggests improvements
  • Use when: Reviewing changes

Operations (5 Agents)​

Agents responsible for optimization and deployment.

SOQL Optimizer​

Specialization: Query optimization

  • Optimizes SOQL queries
  • Suggests indexing strategies
  • Analyzes performance
  • Reduces execution time
  • Use when: Optimizing queries

Metadata Manager​

Specialization: Metadata management

  • Configures metadata
  • Manages settings
  • Handles org configuration
  • Optimizes deployment
  • Use when: Configuring org

Git Agent​

Specialization: Version control

  • Creates meaningful commits
  • Generates PR descriptions
  • Manages branches
  • Handles release notes
  • Use when: Managing git workflows

Deployment Agent​

Specialization: Deployment & release

  • Plans deployments
  • Validates changes
  • Suggests rollback strategies
  • Manages environments
  • Use when: Planning deployments

Kanban Agent​

Specialization: Project management

  • Breaks down features
  • Creates backlogs
  • Manages sprint planning
  • Tracks progress
  • Use when: Planning sprints

🧠 Utilities (3 Agents)​

Agents providing cross-cutting capabilities.

Planner​

Specialization: Feature planning

  • Decomposes feature requests
  • Maps dependencies
  • Assigns agents
  • Sequences tasks
  • Use when: Planning complex features

Debug Agent​

Specialization: Troubleshooting

  • Diagnoses issues
  • Suggests fixes
  • Explains errors
  • Provides debugging guidance
  • Use when: Troubleshooting problems

Memory Agent​

Specialization: Memory management

  • Manages shared memory
  • Retrieves context
  • Organizes knowledge base
  • Optimizes storage
  • Use when: Managing project knowledge

Agent Interaction Matrix​

Who Talks to Whom?​

Planner
↙ ↘
Architect Kanban
↙ ↘
Service LWC
↓ ↓
Review Security
↾ ↾
Deploy Test

Typical Collaboration Flow​

User Request
↓
Planner breaks down
↓
Architect + Schema Analyst design
↓
LWC Builder + Apex team build
↓
Test Writer validates
↓
Reviewers + Security audit
↓
SOQL Optimizer + Deployment plan
↓
Ready for deployment

Agent Selection Guide​

By Salesforce Feature​

FeatureRecommended Agents
Custom ObjectSchema Analyst, Apex Architect
Apex ClassApex Architect, Test Writer, Reviewer
LWC ComponentLWC Builder, Security Agent
FlowFlow Advisor, Test Writer
SOQL QuerySOQL Optimizer, Apex Architect
Test SuiteTest Writer, Apex Reviewer
Data MigrationSchema Analyst, SOQL Optimizer

By Task Type​

TaskAgent
PlanningPlanner
ArchitectureApex Architect, Schema Analyst
ImplementationLWC Builder, (Apex indirectly)
TestingTest Writer
Code ReviewApex Reviewer, Security Agent
OptimizationSOQL Optimizer
DeploymentDeployment Agent
DebuggingDebug Agent

Agent Capabilities​

What Each Agent Can Do​

AgentReadWriteAnalyzeGenerate
Apex ArchitectXXXCode
LWC BuilderXX-Components
Apex ReviewerX-XReviews
Test WriterXXXTests
SOQL OptimizerX-XQueries
Security AgentX-XFixes
Schema AnalystXXXDesign
Flow AdvisorXXXFlows
PlannerX-XPlans
Git AgentX-XCommits
Diff ReviewerX-XReports
Memory AgentXXXSnapshots
Kanban AgentXXXSprints
Deployment AgentXX-Deployments
Metadata ManagerXXXConfigs
Debug AgentX-XFixes

Agent Performance Metrics​

Speed​

Speed of response (typical):

Fast (<10s): Gemini agents, optimization
Medium (10-20s): LWC Builder, SOQL Optimizer
Slow (20-60s): Apex Architect, Security Agent, Test Writer

Accuracy​

Output quality rating:

Excellent (95%+): Apex Architect, Apex Reviewer, Schema Analyst
Very Good (85%+): LWC Builder, Test Writer, Security Agent
Good (75%+): SOQL Optimizer, Planner

Cost Efficiency​

Tokens per task (relative to Sonnet baseline):

Efficient (0.5x): SOQL Optimizer, Deployment Agent
Normal (1.0x): LWC Builder, Test Writer, Flow Advisor
Expensive (1.5x): Apex Architect, Security Agent

Working with Agents​

Basic Command​

sfai /spawn <agent-name> "<task description>"

Examples​

# Architecture
sfai /spawn apex-architect "Design the lead scoring service"

# Components
sfai /spawn lwc-builder "Create a data table component"

# Testing
sfai /spawn test-writer "Write tests for LeadService"

# Review
sfai /spawn apex-reviewer "Review AccountHandler for security"

# Optimization
sfai /spawn soql-optimizer "Optimize account dashboard queries"

Agent Workflow Example​

Building a Complete Feature​

Step 1: PLAN
sfai /plan "Create customer portal"

↓ Planner agent creates structured plan

Step 2: DESIGN
sfai /spawn schema-analyst "Design portal objects"
sfai /spawn apex-architect "Design portal service layer"

↓ Architecture stored in memory

Step 3: BUILD
sfai /spawn lwc-builder "Create portal components"

↓ Uses architecture from memory

Step 4: TEST
sfai /spawn test-writer "Write comprehensive tests"

↓ Tests both components and services

Step 5: REVIEW
sfai /spawn apex-reviewer "Review generated code"
sfai /spawn security-agent "Audit for security"

↓ Quality gates passed

Step 6: OPTIMIZE
sfai /spawn soql-optimizer "Optimize dashboard queries"

↓ Performance optimized

Step 7: DEPLOY
sfai /spawn deployment-agent "Plan deployment"

↓ Ready for production

Advanced Agent Features​

Agent Chaining​

Use output from one agent as input to another:

# First agent
sfai /spawn planner "Plan lead scoring"

# Access plan in memory
PLAN=$(sfai /memory get "planner_output")

# Second agent uses plan
sfai /spawn apex-architect "Design per this plan: $PLAN"

Parallel Execution​

Run multiple agents simultaneously:

sfai /spawn schema-analyst "Analyze existing schema" &
sfai /spawn planner "Break down requirements" &
sfai /spawn apex-architect "Design service layer" &
wait

Conditional Routing​

Use agent based on complexity:

READ complexity
if complexity > High:
sfai /spawn apex-architect "Complex design"
else:
sfai /spawn lwc-builder "Simple component"

Features Across Agents​

Shared Capabilities​

All agents can:

  • Read project context
  • Access shared memory
  • Generate documentation
  • Store results
  • Provide explanations

How Agents Share Knowledge​

Agent A → Stores result in memory
↓
Agent B → Reads result from memory
↓
Agent B → Uses Agent A's result as context
↓
Agent B → Generates enhanced result

Next Steps​

Ready to meet each agent?

Or jump to: