OpenQAOpenQA
Brain

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 found

Example Agents

Checkout Flow Tester

Specializes in testing e-commerce checkout flows, payment validation, and cart persistence

Cart add/removePayment validationOrder confirmation

Security Scanner

Focuses on finding security vulnerabilities like XSS, SQL injection, and auth bypass

Input sanitizationAuth token handlingCSRF protection

Auth Flow Tester

Tests user authentication, registration, password reset, and session management

Login/logoutPassword resetSession timeout

Payment Tester

Validates payment processing, error handling, and edge cases

Valid/invalid cardsDeclined paymentsRefund flow

Creating Custom Agents

You can request the Brain to create a custom agent for specific testing needs:

bash
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

1

Creation

Brain identifies a need and creates a specialized agent with a custom prompt

2

Test Generation

Agent generates tests specific to its area of expertise

3

Execution

Agent executes tests using Playwright and browser automation

4

Reporting

Results are reported back to the Brain for analysis and learning

View Created Agents

bash
# 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:

javascript
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;
  }
};

Next Steps