text
stringlengths
0
59.1k
Workflow Management:
For Single URL → Instagram Ad Generation:
1. Delegate website analysis to LandingPageAnalyzer
2. Share extracted insights with InstagramAdCreator
3. Oversee final ad generation and compile results
For Parallel Processing:
- Can delegate multiple tasks simultaneously
- Coordinate results from parallel executions
- Aggregate outputs efficiently
Quality Control:
- Ensure brand consistency across the final ad
- Verify the requested format is generated
- Confirm all deliverables are complete
Output Organization:
- Summarize brand analysis findings
- List the generated ad file with description and public URL
- Embed final creative using Markdown image syntax so the user can preview it immediately
- Provide recommendations for usage
Communication Style:
- Clear and structured updates
- Executive summary at the end
- Highlight key deliverables
- Include next steps recommendations`,
model: openai("gpt-4o-mini"),
subAgents: [landingPageAnalyzer, adCreator],
supervisorConfig: {
customGuidelines: [
"Always start with website analysis before creative work",
"Focus exclusively on Instagram ad generation",
"Use Google Gemini AI for intelligent content creation",
"Ensure the ad output is square format (1:1) for Instagram",
"Provide the public URL for any generated creative",
"Embed the generated creative using Markdown image syntax in the final response",
"Include Instagram-specific optimization recommendations",
],
},
memory,
});
};
```
</details>
![Supervisor Agent](https://cdn.voltagent.dev/examples/with-ad-generator/supervisor.png)
Functionality:
- Manages workflow from URL input to ad output
- Coordinates landing page analysis and ad creation agents
- Enforces quality control and brand consistency
- Provides structured output with embedded previews
- Supports parallel processing for multiple URLs
**Workflow sequence:** Enforces analysis-first approach, brand data extraction precedes creative generation, maintains quality control throughout execution.
Infrastructure components:
### Stagehand Session Manager
Maintains singleton browser instance for web automation:
<details>
<summary>Show stagehand-manager.ts</summary>
```typescript
import { Stagehand } from "@browserbasehq/stagehand";
class BrowserAutomationController {
private static controllerInstance: BrowserAutomationController;
private browserClient: Stagehand | null = null;
private isActive = false;
private lastActivityTime = Date.now();
private readonly idleTimeLimit = 600000; // 10min in milliseconds
private cleanupTimer: NodeJS.Timeout;
private constructor() {
// Periodic maintenance task for resource management
this.cleanupTimer = setInterval(() => {
this.performIdleCleanup();
}, 60000); // Check every minute
}
/**
* Factory method for obtaining controller reference
*/
public static getController(): BrowserAutomationController {
if (!BrowserAutomationController.controllerInstance) {
BrowserAutomationController.controllerInstance = new BrowserAutomationController();
}
return BrowserAutomationController.controllerInstance;
}
/**
* Retrieve or create active browser automation client