text
stringlengths
0
59.1k
<details>
<summary>Show ad-creator.agent.ts</summary>
```typescript
import { Agent } from "@voltagent/core";
import { openai } from "@ai-sdk/openai";
import { Memory } from "@voltagent/core";
import { generateInstagramAdGeminiTool } from "../tools/image-generation/instagram-ad-gemini.tool";
export const createAdCreatorAgent = (memory: Memory) => {
return new Agent({
name: "InstagramAdCreator",
purpose: "Create compelling Instagram ad visuals using Google Gemini AI",
instructions: `You are an Instagram advertising specialist using Google's Gemini AI for ad creation.
Your core competencies:
1. Transform brand insights into compelling Instagram ad concepts
2. Create square format (1:1) optimized ads for Instagram feed
3. Ensure brand consistency while maximizing engagement
4. Apply Instagram-specific best practices
Instagram Ad Guidelines:
- Square format (1:1 aspect ratio, 1024x1024)
- Visual storytelling focus
- Clean, aesthetic designs
- Concise, impactful copy
- Thumb-stopping visuals
- Clear visual hierarchy
- Mobile-first design
- Instagram's visual culture alignment
Creative Process:
1. Analyze brand data from LandingPageAnalyzer
2. Develop creative concepts aligned with brand identity
3. Consider Instagram audience preferences
4. Ensure clear call-to-action integration
Your output should include:
- Generated Instagram ad asset (provide the publicUrl)
- Embed the asset using Markdown: ![Ad Preview](publicUrl)
- Creative rationale
- Performance optimization suggestions
- Engagement predictions`,
model: openai("gpt-4o-mini"),
tools: [generateInstagramAdGeminiTool],
memory,
});
};
```
</details>
![Ad Creator Agent](https://cdn.voltagent.dev/examples/with-ad-generator/instagram-agent.png)
Functionality:
- Converts brand analysis to creative concepts
- Generates 1:1 aspect ratio ads for Instagram feed
- Uses Google Gemini for image generation
- Provides optimization recommendations
- Embeds generated assets for preview
**Configuration:**
- Model: `gpt-4o-mini` for conversational processing
- Instructions define Instagram ad specifications
- Google Gemini tool integration for image generation
- Memory persistence for context retention
- Agent name: `InstagramAdCreator` for logging
**Gemini models:** Uses `gemini-2.0-flash-exp` for creative briefs and `gemini-2.5-flash-image-preview` for image generation.
### Supervisor Agent
The supervisor orchestrates the entire workflow and coordinates both subagents:
<details>
<summary>Show supervisor.agent.ts</summary>
```typescript
import { Agent } from "@voltagent/core";
import { openai } from "@ai-sdk/openai";
import type { Memory } from "@voltagent/core";
import { createLandingPageAnalyzer } from "./landing-page-analyzer.agent";
import { createAdCreatorAgent } from "./ad-creator.agent";
export const createSupervisorAgent = (memory: Memory) => {
const landingPageAnalyzer = createLandingPageAnalyzer(memory);
const adCreator = createAdCreatorAgent(memory);
return new Agent({
name: "InstagramAdSupervisor",
purpose:
"Orchestrate Instagram ad generation workflow from website analysis to final ad creation",
instructions: `You are the Instagram Ad Generation Supervisor, responsible for orchestrating the Instagram ad creation workflow using Google Gemini AI.
Your Team:
1. LandingPageAnalyzer - Extracts brand information from websites
2. InstagramAdCreator - Synthesizes strategy and generates Instagram ads using Google Gemini AI