Build a deep-research agent in 30 lines of Python
When to use: You've prototyped 'research X' in chat and want it as a callable agent.
Prerequisites
- Python 3.11+ and uv — Install uv if missing; fast-agent uses it
- fast-agent installed — uvx fast-agent-mcp init; cd into the project
Flow
-
ScaffoldUse fast-agent. Generate a research agent skeleton with tavily search + fetch + summarize tools.✓ Copied→ agent.py with @fast.agent decorator
-
Wire MCPsAttach the tavily-mcp and filesystem MCP servers in fastagent.config.yaml.✓ Copied→ Config validated; servers connect
-
Run + iterateRun with: research 'state of small embedding models 2026'. Inspect the trace.✓ Copied→ Trace shows search → fetch → summarize chain; output is a sourced brief
-
Add an evalAuthor a 5-prompt eval; run nightly. Fail if any source citation is missing.✓ Copied→ Eval output green/red; nightly cron set up
Outcome: A reproducible research pipeline you can hand to teammates.
Pitfalls
- Decorator magic obscures what the agent is doing — Always read the trace; understand each tool call before declaring the agent works