A clean, client-side web application that demonstrates the two-agent agentic workflow pattern. DualAgent helps users understand and experiment with the powerful pattern of Agent 1 (Planner) β Agent 2 (Responder).
Live demo showcasing the two-agent workflow interface
- Client-side Only: Fully functional in-browser, no backend required
- Secure API Key Management: OpenAI API key stored only in memory during session
- Two-Agent Workflow: Clear demonstration of Agent 1 β Agent 2 pattern
- Interactive UI: Clean, modern interface with real-time status updates
- Example Templates: Pre-built use cases to get started quickly
- Purpose: Analyzes high-level tasks and creates structured plans
- Function: Breaks down complex goals into actionable frameworks
- Output: Detailed plan templates with criteria and constraints
- UI: Dedicated panel showing analysis and structured output
- Purpose: Executes structured tasks on specific targets
- Function: Uses Agent 1's framework to analyze specific subjects
- Input: Structured plan + user-specified target (e.g., company name)
- UI: Second panel showing execution results
- β Edit Agent 1 Output: Modify structured plans before sending to Agent 2
- β Example Templates: Pre-built scenarios for startup evaluation, market research, legal analysis
- β Modular Design: Clean architecture for easy extension to other domains
- β Minimal Dependencies: Only OpenAI API and vanilla JavaScript
- Download Files: Clone or download the repository
- Open in Browser: Open
index.htmlin any modern web browser - Enter API Key: Type your OpenAI API key - it's automatically remembered for the session
- Choose a Task: Select an example template or enter your own high-level task
- Run Agent 1: Click "Start Analysis" to generate structured plans
- Specify Target: Enter a specific subject for Agent 2 to analyze
- Execute: Watch Agent 2 use Agent 1's framework on your target
"Evaluate startups for investment potential"
Agent 1 analyzes this task and creates a structured evaluation framework:
- Team assessment criteria
- Traction metrics to examine
- Technology defensibility factors
- Market opportunity analysis
- Financial health indicators
- Risk assessment framework
Agent 2 takes the framework and applies it to a specific startup:
Target: "OpenAI"
Result: Comprehensive analysis of OpenAI using the structured criteria from Agent 1.
dualagent/
βββ index.html # Main HTML structure
βββ styles.css # Modern, responsive styling
βββ script.js # Core JavaScript functionality
βββ README.md # This documentation
- API Management: Secure key storage and validation
- Agent Orchestration: Coordinates the two-agent workflow
- UI State Management: Handles button states and status updates
- OpenAI Integration: Direct API calls with error handling
createAgent1Prompt(userTask) {
// Creates structured analysis prompts
// Breaks down high-level tasks
// Defines criteria and constraints
}createAgent2Prompt(target) {
// Uses Agent 1's structured output
// Applies framework to specific target
// Executes detailed analysis
}- Agent 1: Creates investment analysis framework
- Agent 2: Evaluates specific startups (OpenAI, RunwayML, etc.)
- Agent 1: Structures market analysis approach
- Agent 2: Researches specific technologies or industries
- Agent 1: Defines compliance review framework
- Agent 2: Analyzes specific products or regulations
- Agent 1: Creates research methodology
- Agent 2: Applies to specific papers or topics
Edit the example cards in index.html:
<div class="example-card" data-task="Your custom task here">
<h4>Custom Template</h4>
<p>Description of your use case</p>
</div>Customize the prompt creation methods in script.js:
createAgent1Prompt()- Modify how tasks are analyzedcreateAgent2Prompt()- Adjust how frameworks are applied
Update styles.css to match your preferred design:
- Color schemes
- Layout adjustments
- Responsive breakpoints
- No Data Storage: All data exists only during the browser session
- API Key Security: Keys stored only in memory, never persisted
- Client-Side Only: No backend servers or data transmission
- HTTPS Required: OpenAI API requires secure connections
-
Separation of Concerns:
- Agent 1 focuses on analysis and structure
- Agent 2 focuses on execution and results
-
Reusability:
- One structured plan can analyze many targets
- Efficient use of API calls and tokens
-
Quality Control:
- Edit and refine Agent 1's output before execution
- Consistent analysis framework across targets
-
Scalability:
- Easy to add new domains and use cases
- Modular design for different workflows
- Modern web browser (Chrome, Firefox, Safari, Edge)
- OpenAI API key
- Internet connection for API calls
- JavaScript enabled
This is a demonstration project showcasing the dual-agent pattern. Feel free to:
- Fork and modify for your use cases
- Add new example templates
- Enhance the UI/UX
- Extend to other AI providers
Open source - use and modify as needed for your projects.
Built with vanilla JavaScript and OpenAI API β’ Client-side only β’ No data stored
