Full example — see the CrewAI cookbook for the complete runnable demo with travel data, interactive chat, and all 8 Moss tools (search, add/delete/get docs, create/delete/get/list indexes).
Why use Moss with CrewAI?
CrewAI assigns roles and tools to each agent in a crew. Moss fits naturally as a per-agent tool: each specialist gets its ownMossSearchTool pointing at a domain-specific index, so retrieval is both fast and scoped. Sub-10ms queries mean Moss never introduces noticeable latency into the crew’s task execution.
Required tools
- Moss account with project credentials
- Google Gemini API key (or swap in any CrewAI-compatible LLM)
- Python 3.11+
Integration guide
Create MossSearchTool
MossSearchTool extends crewai.tools.BaseTool. The index is loaded lazily on first use — just pass the MossClient and the index name.Set up domain-isolated indexes
Each specialist agent gets its own Moss index. This keeps retrieval scoped — a query for “budget hotels” only hits the stays index, not destinations or activities.
Build the crew
Each specialist agent receives a
MossSearchTool bound to its domain index. The planner agent synthesizes their findings without needing direct search access.How it works
moss_search calls within the crew execution hit the in-memory path for consistent sub-10ms retrieval.