Dynamic Agents
The Brain creates specialized agents on-the-fly based on what it discovers about your application.
Two Origins โ One System
Dynamic agents can come from two places:
๐ Intelligence Blueprints
Phase 0 produces dynamicAgentBlueprints โ agent specs generated from the project's domain and risk profile. These agents were never pre-coded; the intelligence layer invents them based on what the project needs.
๐ง Brain ReAct Decisions
During the ReAct loop (Phase 2), the Brain can decide mid-session to create additional agents when it discovers a new area that needs specialist coverage.
Intelligence-Driven Example
๐ Intelligence: "This is a fintech app โ PCI-DSS applies"
โ
๐ Blueprint generated: {
name: "PCI-DSS-Validator",
role: "PCI-DSS compliance tester",
goal: "Verify cardholder data protection controls",
systemPrompt: "You are a PCI-DSS specialist..."
}
โ
๐ค Agent created: dynamic:PCI-DSS-Validator
(this agent type was never hardcoded โ invented on the fly)
โ
๐งช Agent runs: tests card data exposure, TLS, session timeouts
โ
๐๏ธ Findings โ Kanban ticketsPre-coded vs Dynamic
| Pre-coded Specialists | Dynamic Agents |
|---|---|
Type: form-tester | Type: dynamic:PCI-DSS-Validator |
| Prompt defined at build time | Prompt generated at runtime by intelligence |
| Always available regardless of project | Tailored to this specific project's needs |
| Selected by intelligence when relevant | Created from blueprints when no pre-coded equivalent exists |
Example Agents
Checkout Flow Tester
Specializes in testing e-commerce checkout flows, payment validation, and cart persistence
Security Scanner
Focuses on finding security vulnerabilities like XSS, SQL injection, and auth bypass
Auth Flow Tester
Tests user authentication, registration, password reset, and session management
Payment Tester
Validates payment processing, error handling, and edge cases
Creating Custom Agents
You can request the Brain to create a custom agent for specific testing needs:
1curl -X POST http://localhost:3000/api/brain/create-agent \2 -H "Content-Type: application/json" \3 -d '{4 "purpose": "Test the multi-step checkout process with various payment methods"5 }'The Brain will create an agent with:
- A specialized system prompt tailored to the task
- Relevant tools and capabilities
- Knowledge of your application context
- Specific test generation strategies
Agent Lifecycle
Creation
Brain identifies a need and creates a specialized agent with a custom prompt
Test Generation
Agent generates tests specific to its area of expertise
Execution
Agent executes tests using Playwright and browser automation
Reporting
Results are reported back to the Brain for analysis and learning
View Created Agents
1# List all dynamic agents2curl http://localhost:3000/api/dynamic-agents3ย 4# Response:5# [6# {7# "id": "agent_001",8# "name": "Checkout Flow Tester",9# "purpose": "Test checkout flow with various payment methods",10# "testsGenerated": 5,11# "bugsFound": 2,12# "createdAt": "2024-01-15T10:30:00Z"13# },14# ...15# ]WebSocket Events
Monitor agent activity in real-time via WebSocket:
1const ws = new WebSocket('ws://localhost:3000');2ย 3ws.onmessage = (event) => {4 const data = JSON.parse(event.data);5ย 6 switch (data.type) {7 case 'agent-created':8 console.log('New agent:', data.agent.name);9 break;10 case 'test-generated':11 console.log('Test created:', data.test.name);12 break;13 case 'test-completed':14 console.log('Test result:', data.result.status);15 break;16 }17};