Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:CrewAIInc CrewAI Couchbase Vector Search Tool

From Leeroopedia
Knowledge Sources
Domains Tools, Vector_Search, Couchbase
Last Updated 2026-02-11 00:00 GMT

Overview

Concrete tool for performing vector similarity searches in Couchbase databases provided by CrewAI.

Description

The CouchbaseFTSVectorSearchTool class extends BaseTool to perform vector similarity searches against Couchbase Full-Text Search (FTS) indexes. During initialization, it validates the Couchbase cluster connection, verifies that the specified bucket, scope, and collection exist, and checks that the vector search index is available. The tool accepts an embedding_function callable that converts query text to vectors, which is then used to create a VectorQuery against either scoped or cluster-level indexes via VectorSearch.from_vector_query. Results are returned as JSON containing matching document fields. The tool supports configurable embedding_key (default "embedding"), limit (default 3), and scoped_index (default True). If the couchbase package is not installed, it offers interactive installation via click confirmation and uv add.

Usage

Use this tool when CrewAI agents need semantic search capabilities over documents stored in Couchbase NoSQL database using vector embeddings, particularly for RAG applications requiring scalable vector storage and retrieval.

Code Reference

Source Location

  • Repository: CrewAI
  • File: lib/crewai-tools/src/crewai_tools/tools/couchbase_tool/couchbase_tool.py
  • Lines: 1-235

Signature

class CouchbaseFTSVectorSearchTool(BaseTool):
    name: str = "CouchbaseFTSVectorSearchTool"
    description: str = "A tool to search the Couchbase database for relevant information..."
    args_schema: type[BaseModel] = CouchbaseToolSchema
    cluster: Cluster
    collection_name: str
    scope_name: str
    bucket_name: str
    index_name: str
    embedding_key: str | None = "embedding"
    scoped_index: bool = True
    limit: int | None = 3
    embedding_function: Callable[[str], list[float]]

    def __init__(self, **kwargs): ...
    def _run(self, query: str) -> str: ...

Import

from crewai_tools import CouchbaseFTSVectorSearchTool

I/O Contract

Inputs

Name Type Required Description
cluster Cluster Yes Connected Couchbase Cluster instance (constructor)
bucket_name str Yes Name of the Couchbase bucket (constructor)
scope_name str Yes Name of the Couchbase scope (constructor)
collection_name str Yes Name of the Couchbase collection (constructor)
index_name str Yes Name of the FTS vector search index (constructor)
embedding_function Callable[[str], list[float]] Yes Function to convert text to embeddings (constructor)
query str Yes Search query string (runtime _run parameter)
embedding_key str or None No Field name storing vectors (default "embedding")
scoped_index bool No Whether the index is scoped (default True)
limit int or None No Maximum number of results (default 3)

Outputs

Name Type Description
_run() returns str JSON string containing matching document fields from vector search

Usage Examples

Basic Usage

from crewai_tools import CouchbaseFTSVectorSearchTool
from couchbase.cluster import Cluster
from couchbase.auth import PasswordAuthenticator

cluster = Cluster("couchbase://localhost",
                  authenticator=PasswordAuthenticator("user", "pass"))

tool = CouchbaseFTSVectorSearchTool(
    cluster=cluster,
    bucket_name="my_bucket",
    scope_name="my_scope",
    collection_name="my_collection",
    index_name="vector_index",
    embedding_function=my_embedding_fn
)
result = tool.run(query="machine learning techniques")

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment