CrewAI Vault: Bridging the Gap Between AI Autonomy and Human Trust
The project is designed to solve two critical challenges in the modern AI workflow:
-
Redundant Token Consumption: Users often ask AI identical or highly similar questions. Without a shared memory, these queries are processed from scratch every time, leading to unnecessary token costs and wasted computational resources. 🌟Solution: Before consuming tokens for a new AI generation, CrewAI Vault intercepts the query to search for existing, high-similarity records within your team's specialized database. This allows you to determine if a validated answer already exists that meets your specific needs.
-
The "Expertise Gap" & Verification: AI is frequently used to solve problems beyond a user's own domain knowledge. In these cases, the user lacks the expertise to verify if the AI’s response is accurate or hallucinated.🌟Solution (with a scenario example): Imagine you are facing a critical C++ issue but aren't an expert in the language. If the Vault reveals a stored solution that has been upvoted by one or more C++ specialists you trust, you can implement the code with a level of confidence that a raw AI generation simply cannot provide.
🛠️ Project Structure server/: FastAPI backend handling Supabase persistence and Google Embedding logic.
sdk/: The core library including the VaultClient, VaultSession, and Framework Tools.
examples/: End-to-end demonstrations of the research workflow.
🚀 Getting Started
- Prerequisites Python 3.10 or higher.
A Supabase project (with the Vector extension enabled).
Google AI API Key (for Gemini embeddings).
- Installation We recommend using uv for lightning-fast dependency management:
Bash git clone https://github.com/yourusername/crewai-vault.git cd crewai-vault uv sync 3. Database Initialization Go to your Supabase SQL Editor and execute the script found in server/schema.sql. This will:
Enable the vector extension.
Create vault_records and vault_votes tables.
Deploy the match_vault_records RPC function for consensus-aware search.
- Configuration Create a .env file in the root directory:
SUPABASE_URL=your_supabase_url SUPABASE_KEY=your_supabase_anon_key GOOGLE_API_KEY=your_gemini_api_key VAULT_API_URL=http://localhost:8000 (or production URL) 5. Running the System
Start the Backend Open a terminal and launch the FastAPI server:
uv run python server/main.pyRun the Interactive Research Workflow In a new terminal, execute the example script to start the hybrid research process:
uv run python -m examples.run_research🚀 Usage Example: A Real-world Scenario Below is a demonstration of the Human-in-the-Loop workflow. In this scenario, the user searches for cloud migration strategies and validates the results based on team expertise.
(a) Interactive CLI Interface When you run the research task, the Vault first intercepts the query to find existing verified consensus
=== 📚 Vault Search Results (1/1) ===
[1] (Sim: 0.8045 | 👍1 👎0) Strategy for migrating from local Data Centers to AWS Serverless Architecture
[2] (Sim: 0.7976 | 👍5 👎0) Step-by-step strategy for migrating from On-Premise Data Centers to AWS Serverless Architecture
[ID] Preview | [N/P] Paginate | [A] Trigger Agent | [Q] Exit:
2
📄 Preview file generated: vault_0501_2046_Stepbystep_stra.md
(b) Knowledge Preview & Verification The system generates a local Markdown file (vault_*.md) for you to review the content and its "Expertise Metadata":
The bottom of the Markdown file will include a list of users who upvoted the answer.
| Timestamp | Voter | Status |
|---|---|---|
| 2026-01-23 12:21:18 | expert1@mail.com | Verified ✅ |
| 2026-02-20 12:26:41 | expert2@mail.com | Verified ✅ |
| 2026-03-01 12:27:12 | friend1@mail.com | Verified ✅ |
| 2026-04-17 12:27:44 | you-know-who@mail.com | Verified ✅ |
| 2026-05-01 12:29:27 | student@mail.com | Verified ✅ |
📦 SDK Usage Integration with CrewAI Python from sdk.client import VaultClient from sdk.tools.crewai_v import VaultSearchTool from crewai import Agent
client = VaultClient(api_url="http://localhost:8000") vault_tool = VaultSearchTool(client=client)
researcher = Agent( role="Technology Analyst", goal="Analyze industry trends using historical consensus", tools=[vault_tool], backstory="You prioritize verified team knowledge from the Vault." ) 📊 Consensus Logic Our search algorithm uses a multi-factor sorting approach:
Similarity: Higher semantic match scores.
Upvote Count: Verified knowledge gets promoted.
Downvote Count: Disputed or outdated knowledge is penalized.
🤝 Contributing Contributions are welcome! Whether it's adding support for new Vector DBs, improving the CLI UI, or adding new framework integrations.
Fork the Project.
Create your Feature Branch (git checkout -b feature/AmazingFeature).
Commit your Changes (git commit -m 'Add some AmazingFeature').
Push to the Branch (git push origin feature/AmazingFeature).
Open a Pull Request.
📄 License Distributed under the MIT License. See LICENSE for more information.
🌟 More about CrewAI Vault Most RAG (Retrieval-Augmented Generation) systems suffer from "Noise" and "Trust" issues. CrewAI Vault solves this by introducing:
Canonical Indexing: Uses a fixed 768-dimension "standard ruler" (Gemini-001) so all agents share the same coordinate space regardless of their internal models.
Consensus-Based Ranking: Results are not just sorted by similarity, but also by community feedback (Upvotes/Downvotes).
Human-in-the-Loop (HITL): A built-in interactive session allows humans to audit, vote, and improve knowledge before an agent takes over.
Modular SDK: Easily pluggable into CrewAI and LangChain with one line of code.
CrewAI Vault transforms AI from a solitary black box into a collaborative, verified, and cost-effective knowledge ecosystem.