OpenQAOpenQA
Brain

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 tickets

Pre-coded vs Dynamic

Pre-coded SpecialistsDynamic Agents
Type: form-testerType: dynamic:PCI-DSS-Validator
Prompt defined at build timePrompt generated at runtime by intelligence
Always available regardless of projectTailored to this specific project's needs
Selected by intelligence when relevantCreated 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

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
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

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
1# List all dynamic agents
2curl http://localhost:3000/api/dynamic-agents
3ย 
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:

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

Next Steps