text
stringlengths
0
59.1k
You are an expert blog writer. When given a YouTube transcript, convert it into a well-structured, engaging blog post with:
- A catchy, SEO-friendly title
- An engaging introduction
- Clear sections with subheadings
- Key points and takeaways
- A compelling conclusion
Format the output in Markdown.`,
model: openai("gpt-4o-mini"),
memory,
});
```
- The instructions describe the Markdown layout I expect in the final response.
- The shared memory instance keeps the transcript available without fetching it again.
- Because VoltAgent wraps the provider logic, I can swap to another LLM that the AI SDK supports.
### Coordinator Supervisor
![Supervisor agent trace](https://cdn.voltagent.dev/examples/with-youtube-to-blog/supervisor.png)
The supervisor enforces the handoff order and delegates work to both subagents.
```typescript
const coordinatorAgent = new Agent({
name: "YouTubeToBlogCoordinator",
instructions: `
You are a coordinator that orchestrates the process of converting YouTube videos to blog posts. You DO NOT write the blog post yourself - that is the BlogWriter's job.
IMPORTANT: You MUST follow these steps in EXACT ORDER:
STEP 1: Get the Transcript
- Delegate to the TranscriptFetcher agent with the YouTube URL
- WAIT for the TranscriptFetcher to complete and return the full transcript
- DO NOT proceed to Step 2 until you have the complete transcript
STEP 2: Generate the Blog Post
- After you have the COMPLETE transcript, delegate to the BlogWriter agent
- Pass the ENTIRE transcript to the BlogWriter
- DO NOT write the blog post yourself - let the BlogWriter do it
- WAIT for the BlogWriter to return the complete blog post
STEP 3: Return ONLY the Blog Post
- Return ONLY the blog post content that the BlogWriter created
- DO NOT add any additional commentary, explanations, or meta-information
- Just return the blog post as-is
CRITICAL RULES:
- Complete Step 1 entirely before starting Step 2
- You are ONLY a coordinator - BlogWriter creates the blog post, NOT you
- Your final response should be ONLY the blog post content from BlogWriter`,
model: openai("gpt-4o-mini"),
memory,
subAgents: [transcriptFetcherAgent, blogWriterAgent],
supervisorConfig: {
fullStreamEventForwarding: {
types: ["tool-call", "tool-result"],
},
},
});
```
- `subAgents` registers the transcript and writer agents, so the supervisor can call them with the built-in `delegate_task` tool described in the [subagent guide](https://voltagent.dev/docs/agents/sub-agents/).
- `supervisorConfig.fullStreamEventForwarding` forwards tool events to the caller, which VoltOps stores for observability.
- The shared memory instance lets the supervisor hand the transcript to the writer without restating it in the prompt.
### Memory and Observability
I reuse LibSQL adapters for working memory and observability. See the [memory overview](https://voltagent.dev/docs/agents/memory/overview/) and [VoltOps guide](https://voltagent.dev/docs/observability/overview/) for configuration details.
```typescript
const memory = new Memory({
storage: new LibSQLMemoryAdapter(),
});
const observability = new VoltAgentObservability({
storage: new LibSQLObservabilityAdapter(),
});
```
- `LibSQLMemoryAdapter` caps each conversation at 100 messages and can target local SQLite or remote Turso instances.
- `VoltAgentObservability` captures spans, logs, and tool events that VoltOps renders in the web console.
![Shared memory and observability view](https://cdn.voltagent.dev/examples/with-youtube-to-blog/memory.png)
#### VoltAgent Server Configuration
```typescript
new VoltAgent({
agents: {
coordinatorAgent,
transcriptFetcherAgent,
blogWriterAgent,
},
server: honoServer(),
logger,
observability,
});
```
- Registers all three agents so I can call them individually or through the supervisor.