text
stringlengths
0
59.1k
import { LibSQLMemoryAdapter, LibSQLObservabilityAdapter } from "@voltagent/libsql";
import { createPinoLogger } from "@voltagent/logger";
import { honoServer } from "@voltagent/server-hono";
import { serveStatic } from "@hono/node-server/serve-static";
import { createSupervisorAgent } from "./agents/supervisor.agent";
// Create a logger instance
const logger = createPinoLogger({
name: "ai-ad-generator",
level: "info",
});
// Configure persistent memory (LibSQL / SQLite)
const memory = new Memory({
storage: new LibSQLMemoryAdapter({
url: "file:./.voltagent/memory.db",
logger: logger.child({ component: "libsql" }),
}),
});
// Create the supervisor agent with all subagents
const supervisorAgent = createSupervisorAgent(memory);
// Initialize VoltAgent with Instagram ad generation system using Gemini AI
new VoltAgent({
agents: {
InstagramAdSupervisor: supervisorAgent,
},
server: honoServer({
configureApp: (app) => {
app.use("/output/*", serveStatic({ root: "./" }));
},
}),
logger,
observability: new VoltAgentObservability({
storage: new LibSQLObservabilityAdapter({
url: "file:./.voltagent/observability.db",
}),
}),
});
```
</details>
**Components:**
**Memory System:**
- `LibSQLMemoryAdapter` for SQLite persistence
- 100-message limit per conversation
- Shared memory across agents
- Context retention for agent references
**Observability:**
- `LibSQLObservabilityAdapter` for trace logging
- VoltOps platform integration
- Agent interaction and tool execution tracking
- Decision path monitoring
**VoltAgent Core:**
- `InstagramAdSupervisor` as main orchestrator
- Automatic subagent management (LandingPageAnalyzer, InstagramAdCreator)
- Pino logger for structured logging
- End-to-end workflow execution
### Running the Agent
The agent handles Instagram ad generation via conversational interface.
![Application Architecture](https://cdn.voltagent.dev/examples/with-ad-generator/overall.png)
Usage:
#### Step 1: Connect to VoltOps
1. Start the server with `npm run dev`
2. Open [console.voltagent.dev](https://console.voltagent.dev)
3. Your local instance automatically connects
4. Select the `InstagramAdSupervisor` agent
#### Step 2: Generate an Ad
Provide a prompt like:
```
Go to https://www.amazon.com/Roku-Streaming-Stick-Plus-2025/dp/B0DXY833HV and extract brand information for Instagram ad
```
The supervisor will:
1. Analyze the landing page
2. Extract brand information
3. Capture screenshots
4. Generate creative brief
5. Create Instagram ad with Gemini
6. Return the ad with preview
### Next Steps