Small CrewAI examples that show two common agent orchestration patterns:
sequential_research_handoff_demo.py: a fixed research -> edit handoffhierarchical_manager_research_demo.py: a manager-led workflow that delegates work across specialist agents
The repo is intentionally compact and uses a local custom web search tool so the execution flow is easy to inspect.
- A custom DuckDuckGo / DDGS-backed search tool
- A sequential multi-agent handoff example
- A hierarchical manager example
- Local CrewAI runtime storage configuration
- A
.gitignorethat excludes secrets, virtualenvs, and local runtime artifacts
- Python 3.11 or newer
- A Gemini API key
- macOS / Linux shell commands below assume
bashorzsh
Create and activate a virtual environment:
python3 -m venv .venv
source .venv/bin/activateInstall dependencies:
pip install "crewai[google-genai]" pydantic ddgsCreate a local .env file from the example:
cp .env.example .envThen set your Gemini API key in .env:
GEMINI_API_KEY=your_api_key_here.env is ignored by Git and will not be committed.
Activate the virtual environment first:
source .venv/bin/activateRun the sequential handoff example:
python sequential_research_handoff_demo.pyRun the hierarchical manager example:
python hierarchical_manager_research_demo.pyProcess.sequential runs tasks in a fixed order.
In this repo:
- The researcher gathers information
- The editor rewrites the result into an executive summary
Use sequential when you already know the workflow order.
Process.hierarchical introduces a manager that decides which agent should handle the work.
In this repo:
- The manager LLM delegates across market research, metrics, and executive writing roles
Use hierarchical when task routing should be decided dynamically.
sequential_research_handoff_demo.py: fixed two-agent handoffhierarchical_manager_research_demo.py: manager-led delegation exampleproject_overview_slide.md: a presentation slide summarymulti_agent_workshop_qr.svg: QR code for the GitHub repository
- The examples use live web search, so output quality depends on current search results.
- The examples use Gemini models through CrewAI's Google GenAI provider.
- Both scripts disable CrewAI telemetry and store runtime SQLite data in a local
.crewai_storage/directory.
If CrewAI reports that the Google Gen AI provider is unavailable, reinstall with:
pip install "crewai[google-genai]"If Gemini calls fail immediately, verify that .env contains:
GEMINI_API_KEY=your_api_key_hereThat is usually a live web-search quality issue rather than a framework problem. Re-running later or adjusting the prompts can help.
CrewAI itself is not especially heavy in this repo, but browser tabs, editor helper processes, and OS speech services can cause memory pressure during demos or development.