crewAIInc/crewAI · error · ImportError
contextual-client package is required. Install it with: pip
Error message
contextual-client package is required. Install it with: pip install contextual-client
What it means
Error "contextual-client package is required. Install it with: pip install contextual-client" thrown in crewAIInc/crewAI.
Source
Thrown at lib/crewai-tools/src/crewai_tools/tools/contextualai_query_tool/contextual_query_tool.py:41
description: str = (
"Use this tool to query a Contextual AI RAG agent with access to your documents"
)
args_schema: type[BaseModel] = ContextualAIQuerySchema
api_key: str
contextual_client: Any = None
package_dependencies: list[str] = Field(
default_factory=lambda: ["contextual-client"]
)
def __init__(self, **kwargs: Any) -> None:
super().__init__(**kwargs)
try:
from contextual import ContextualAI
self.contextual_client = ContextualAI(api_key=self.api_key)
except ImportError as e:
raise ImportError(
"contextual-client package is required. Install it with: pip install contextual-client"
) from e
def _check_documents_ready(self, datastore_id: str) -> bool:
"""Synchronous check if all documents are ready."""
url = f"https://api.contextual.ai/v1/datastores/{datastore_id}/documents"
headers = {"Authorization": f"Bearer {self.api_key}"}
response = requests.get(url, headers=headers, timeout=30)
if response.status_code == 200:
data = response.json()
documents = data.get("documents", [])
return not any(
doc.get("status") in ("processing", "pending") for doc in documents
)
return True
async def _wait_for_documents_async(
self, datastore_id: str, max_attempts: int = 20, interval: float = 30.0View on GitHub (pinned to 754d7323be)
Solutions
- Install the package with `pip install contextual-client`.
When it happens
Trigger: Thrown at lib/crewai-tools/src/crewai_tools/tools/contextualai_query_tool/contextual_query_tool.py:41 when the library encounters an invalid state.
Common situations: Occurs when the contextual-client package is not installed. Install it with: pip install contextual-client.
AI-assisted analysis of crewAIInc/crewAI@754d7323be (2026-08-15).
Data as JSON: /api/errors/69195edbb38c984b.
Report an issue: GitHub.