Skip to main content
Use Moss with CrewAI to give each agent in your crew access to a dedicated semantic search index. Domain isolation keeps retrieval focused — your destinations agent only sees destination guides, your stays agent only sees accommodations — so the planner agent receives clean, relevant context to synthesize from.
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 own MossSearchTool 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

1

Installation

2

Environment setup

.env
3

Create MossSearchTool

MossSearchTool extends crewai.tools.BaseTool. The index is loaded lazily on first use — just pass the MossClient and the index name.
4

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.
5

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.
6

Run a query

Each specialist runs a search task in parallel. The planner task uses their results as context to produce the final itinerary.

How it works

User question fans out to destinations, stays, and activities specialists, each searches its own Moss index, then the travel planner synthesizes an actionable itinerary.User question fans out to destinations, stays, and activities specialists, each searches its own Moss index, then the travel planner synthesizes an actionable itinerary.
Each index is loaded into local memory once. All subsequent moss_search calls within the crew execution hit the in-memory path for consistent sub-10ms retrieval.