Module 6: Sub-Agents•Lesson 4 of 7
Build: Researcher Agent
Build: Researcher Agent
Let's create your first sub-agent: a researcher.
The Researcher's Job
- Receives a research question
- Searches the web
- Reads relevant pages
- Synthesizes findings
- Returns structured results
Step 1: Define the Task Template
When spawning a researcher, use this pattern:
## Research Task
**Question:** [What you want to know]
**Scope:**
- [Specific aspects to cover]
- [Sources to prioritize]
- [Things to ignore]
**Output Format:**
- Executive summary (2-3 sentences)
- Key findings (bullet points)
- Sources (with URLs)
- Confidence level (high/medium/low)
**Constraints:**
- Time limit: [X minutes]
- Focus on recent information
- Cite sourcesStep 2: Spawn the Researcher
sessions_spawn({
task: `
Research: What are the top 5 competitors to Duolingo?
Scope:
- Language learning apps only
- Focus on mobile apps
- Include pricing info
Output Format:
- Executive summary
- Top 5 with brief descriptions
- Pricing comparison table
- Sources
Constraints:
- Complete within 5 minutes
- Focus on 2024-2025 data
`,
model: "sonnet",
timeoutSeconds: 300
});Step 3: Handle Results
The researcher will deliver results to your session (or channel if specified).
Exercise: Your First Research Task
- Think of something you want researched
- Write the task using the template above
- Spawn the researcher
- Evaluate the results
Good research questions:
- "What are the top 5 X in category Y?"
- "How does company A compare to company B?"
- "What's the current state of X technology?"
Bad research questions:
- "Tell me everything about X" (too broad)
- "What's 2+2?" (not research)
- "How do I feel about X?" (not factual)
Validation
Your researcher is working when:
- Task spawns successfully
- Results return within timeout
- Output matches requested format
- Sources are cited
- Quality is acceptable