Skip to main content

Agents

AIFactory has nine agents grouped into two pipelines.

Spec Creation Pipeline

Driven by apps/backend/spec_runner.py. Length is adaptive based on task complexity.

AgentPromptJob
Gathererprompts/spec_gatherer.mdCollects user requirements via Q&A
Researcherprompts/spec_researcher.mdValidates external integrations (only for complex tasks)
Writerprompts/spec_writer.mdAuthors spec.md
Criticprompts/spec_critic.mdSelf-critique pass using ultrathink (only for complex tasks)
Complexity Assessorprompts/complexity_assessor.mdAI-based complexity rating that drives pipeline length

Implementation Pipeline

Driven by apps/backend/run.py. Same agent classes every task.

AgentPromptJob
Plannerprompts/planner.mdProduces implementation_plan.json with subtasks
Coderprompts/coder.mdImplements each subtask; can spawn subagents for parallel work
Coder Recoveryprompts/coder_recovery.mdRecovers stuck/failed subtasks (auto-invoked)
QA Reviewerprompts/qa_reviewer.mdValidates the diff against the spec's acceptance criteria
QA Fixerprompts/qa_fixer.mdFixes QA-reported issues; loops with the reviewer until green

The BMad Method personas

For Level-2+ complexity tasks, agents adopt one of four BMad personas (defined in apps/backend/integrations/bmad/personas/):

  • Sarah (Planner) — Staff PM, ruthless prioritizer
  • Winston (Architect) — Principal Architect, security-conscious
  • Alex (Coder) — Senior Developer, ultra-succinct
  • Jordan (QA) — Lead QA Engineer, detail-oriented

These personas live in the system prompts and shape tone + decision making. They don't change tool permissions.

Tool permissions per agent type

Defined in apps/backend/core/client.py::create_client():

ToolPlannerCoderQA ReviewerQA Fixer
Read
Edit / Write
Bash (allowlisted)
WebSearch / WebFetch
MCP servers

The Planner can read but never write code. The QA Reviewer can read but never write — only the Fixer applies changes the Reviewer requests.

Sub-agents

The Coder agent can spawn sub-agents for parallel work via the SDK's nested invocation. Three named sub-agents under apps/backend/integrations/bmad/subagents/:

  • requirements_analyst — validates a requirements doc (80% completeness, 100% clarity)
  • codebase_analyzer — explores structure, detects tech stack, finds relevant files
  • technical_evaluator — assesses risks, evaluates decisions

Failure handling

If an agent's response is malformed (empty, missing required JSON keys), the runtime retries with a structured-output reminder appended to the prompt. After three retries, the task is paused and surfaced to the UI for human input.

If the LLM provider rate-limits, the runtime fails over to the next provider in the task's profile (see apps/web-server/server/services/agent_service.py::_handle_rate_limit).