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_create_agent_tool/contextual_create_agent_tool.py:40

    description: str = (
        "Create a new Contextual AI RAG agent with documents and datastore"
    )
    args_schema: type[BaseModel] = ContextualAICreateAgentSchema

    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 _run(
        self,
        agent_name: str,
        agent_description: str,
        datastore_name: str,
        document_paths: list[str],
    ) -> str:
        """Create a complete RAG pipeline with documents."""
        resolved_paths = [validate_file_path(doc_path) for doc_path in document_paths]
        try:
            import os

            datastore = self.contextual_client.datastores.create(name=datastore_name)
            datastore_id = datastore.id

View on GitHub (pinned to 754d7323be)

Solutions

  1. Install the package with `pip install contextual-client`.

When it happens

Trigger: Thrown at lib/crewai-tools/src/crewai_tools/tools/contextualai_create_agent_tool/contextual_create_agent_tool.py:40 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/d3a4b0998ab068f3. Report an issue: GitHub.