Skip to content

Conversation

@EwanTauran
Copy link

@EwanTauran EwanTauran commented Dec 2, 2025

Add Airweave Search Tools

Summary

Adds two new tools for unified semantic search across 50+ connected data sources (Stripe, GitHub, Notion, Slack, etc.) via Airweave:

  • AirweaveSearchTool - Basic semantic search
  • AirweaveAdvancedSearchTool - Advanced search with source filtering, AI reranking, and score thresholds

Quick Start

from crewai import Agent, Task, Crew
from crewai_tools import AirweaveSearchTool, AirweaveAdvancedSearchTool

# Basic search across all sources
search_tool = AirweaveSearchTool(collection_id="my-collection-id")

# Advanced search with filtering
advanced_tool = AirweaveAdvancedSearchTool(collection_id="my-collection-id")

agent = Agent(
    role="Data Analyst",
    goal="Find information from connected data sources",
    tools=[search_tool, advanced_tool]
)

task = Task(
    description="Find failed payments from Stripe in the last week",
    agent=agent
)

crew = Crew(agents=[agent], tasks=[task])
result = crew.kickoff()

Key Features

  • ✅ Unified search across 50+ data sources (Stripe, GitHub, Salesforce, Zendesk, Slack, Notion, etc.)
  • ✅ Semantic search with natural language understanding
  • ✅ Hybrid search (neural + keyword matching)
  • ✅ AI-generated answers via response_type="completion"
  • ✅ Source filtering and AI reranking (Advanced tool)
  • ✅ Full async support
  • ✅ Interactive package installation

Installation

pip install 'crewai-tools[airweave]'
export AIRWEAVE_API_KEY="your_api_key"  # Get from https://app.airweave.ai

Parameters

AirweaveSearchTool

Parameter Default Description
query Required Search query
limit 10 Max results (1-100)
response_type "raw" "raw" or "completion"
recency_bias 0.0 Recent result weight (0.0-1.0)

AirweaveAdvancedSearchTool (Additional)

Parameter Default Description
source_filter None Filter by source (e.g., "Stripe")
score_threshold None Min similarity score (0.0-1.0)
recency_bias 0.3 Recent result weight
enable_reranking True AI reranking for better relevance
search_method "hybrid" "hybrid", "neural", or "keyword"

Testing

  • 18 tests, 100% passing
  • Zero linting errors
  • ✅ Full coverage of core functionality
pytest tests/tools/airweave_tool_test.py -v

Implementation Details

  • Follows all CrewAI tool patterns (BaseTool, EnvVar, interactive installation)
  • Module-level imports with availability flags (like Tavily, Linkup)
  • Both sync and async clients initialized in __init__()
  • Mirrors Airweave Python SDK methods (search() and search_advanced())
  • Comprehensive README with examples and troubleshooting

Files Added

  • lib/crewai-tools/src/crewai_tools/tools/airweave_tool/ (4 files, ~1,033 lines)
  • lib/crewai-tools/tests/tools/airweave_tool_test.py (18 tests)
  • Updated exports and dependencies

Migration Note

Originally developed as PR #483 in the archived crewAI-tools repo. Migrated to main CrewAI repo with enhancements:

  • Interactive installation prompts
  • Improved async error messages
  • Enhanced test mocking patterns

Checklist

  • Tests passing (18/18)
  • Documentation included
  • No linting errors
  • Follows CrewAI patterns
  • Backward compatible

Note

Introduce AirweaveSearchTool and AirweaveAdvancedSearchTool for unified search across connected data sources, with docs, tests, and an airweave optional dependency.

  • Tools:
    • Add AirweaveSearchTool for basic search and AI completion via response_type.
    • Add AirweaveAdvancedSearchTool with source_filter, recency_bias, score_threshold, reranking, and selectable search methods.
  • Packaging/Exports:
    • Add airweave extra and dependency airweave-sdk>=0.1.0 in lib/crewai-tools/pyproject.toml.
    • Export new tools in crewai_tools/__init__.py and create tools/airweave_tool/__init__.py.
  • Docs & Tests:
    • Add tools/airweave_tool/README.md with setup, parameters, examples, and troubleshooting.
    • Add tests/tools/airweave_tool_test.py covering init, raw/completion modes, filtering, error handling, and async paths.

Written by Cursor Bugbot for commit a3e3e4f. This will update automatically on new commits. Configure here.

Addresses #4014

- Introduced AirweaveAdvancedSearchTool and AirweaveSearchTool to the project.
- Updated pyproject.toml to include airweave-sdk dependency for enhanced functionality.
…ed error handling

- Added module-level import checks for AirweaveSDK and AsyncAirweaveSDK with an interactive installation prompt if missing.
- Updated error messages for better user guidance when no results or relevant results are found.
- Refactored client initialization to streamline both synchronous and asynchronous client setup.
- Improved overall robustness of AirweaveAdvancedSearchTool and AirweaveSearchTool.
- Added airweave-sdk dependency to enhance functionality in Airweave tools.
- Refactored imports in AirweaveAdvancedSearchTool and AirweaveSearchTool to avoid scope issues during testing.
- Updated tests to ensure proper initialization and error handling for Airweave tools.
- Improved handling of source filters and search methods in the Airweave tools.
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is being reviewed by Cursor Bugbot

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

…e management

- Improved import handling in AirweaveAdvancedSearchTool and AirweaveSearchTool to ensure proper module-level variable updates after installation.
- Updated namespace references to maintain functionality and avoid scope issues during execution.
- Enhanced error handling for airweave-sdk installation failures.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant