Dynamic Agents
The Brain creates specialized agents on-the-fly based on what it discovers about your application.
How It Works
When the Brain analyzes your application, it identifies areas that need specialized testing. Instead of using generic tests, it creates custom agents with specific expertise:
๐ง Brain: "I see this app has a checkout flow. Let me create a specialist."
โ
๐ค Creates: "Checkout Flow Tester" agent with custom prompt
โ
๐งช Agent generates: 5 tests for cart, payment, confirmation
โ
โ
Executes tests, reports 2 bugs foundExample 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:
curl -X POST http://localhost:3000/api/brain/create-agent \
-H "Content-Type: application/json" \
-d '{
"purpose": "Test the multi-step checkout process with various payment methods"
}'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
# List all dynamic agents
curl http://localhost:3000/api/dynamic-agents
# Response:
# [
# {
# "id": "agent_001",
# "name": "Checkout Flow Tester",
# "purpose": "Test checkout flow with various payment methods",
# "testsGenerated": 5,
# "bugsFound": 2,
# "createdAt": "2024-01-15T10:30:00Z"
# },
# ...
# ]WebSocket Events
Monitor agent activity in real-time via WebSocket:
const ws = new WebSocket('ws://localhost:3000');
ws.onmessage = (event) => {
const data = JSON.parse(event.data);
switch (data.type) {
case 'agent-created':
console.log('New agent:', data.agent.name);
break;
case 'test-generated':
console.log('Test created:', data.test.name);
break;
case 'test-completed':
console.log('Test result:', data.result.status);
break;
}
};