crewAIInc/crewAI · error · ValueError

No platform integration token found, please set the CREWAI_P

Error message

No platform integration token found, please set the CREWAI_PLATFORM_INTEGRATION_TOKEN environment variable

What it means

crewai_tools.tools.crewai_platform_tools.misc.get_platform_integration_token() reads the CREWAI_PLATFORM_INTEGRATION_TOKEN environment variable and raises this ValueError when it is unset or empty. The token authenticates calls from the CrewAI platform integration tools (e.g. JSONSearchTool-style platform tools) to the CrewAI Plus API at CREWAI_PLUS_URL (default https://app.crewai.com).

Source

Thrown at lib/crewai-tools/src/crewai_tools/tools/crewai_platform_tools/misc.py:14

import os


def get_platform_api_base_url() -> str:
    """Get the platform API base URL from environment or use default."""
    base_url = os.getenv("CREWAI_PLUS_URL", "https://app.crewai.com")
    return f"{base_url}/crewai_plus/api/v1/integrations"


def get_platform_integration_token() -> str:
    """Get the platform API base URL from environment or use default."""
    token = os.getenv("CREWAI_PLATFORM_INTEGRATION_TOKEN") or ""
    if not token:
        raise ValueError(
            "No platform integration token found, please set the CREWAI_PLATFORM_INTEGRATION_TOKEN environment variable"
        )
    return token  # TODO: Use context manager to get token

View on GitHub (pinned to 754d7323be)

Solutions

  1. Set the environment variable before running: export CREWAI_PLATFORM_INTEGRATION_TOKEN=<your token from CrewAI Platform settings>.
  2. If using dotenv, add CREWAI_PLATFORM_INTEGRATION_TOKEN=... to .env and ensure load_dotenv() runs before tool usage.
  3. In Docker/CI, inject it as a secret/environment variable (docker run -e, GitHub Actions secrets.env, etc.).
  4. Check for typos and trailing whitespace in the variable name and confirm it is not set to an empty value.

Example fix

# before
from crewai_tools.tools.crewai_platform_tools.misc import get_platform_integration_token
get_platform_integration_token()  # ValueError

# after
import os
os.environ["CREWAI_PLATFORM_INTEGRATION_TOKEN"] = os.environ["CREWAI_PLATFORM_INTEGRATION_TOKEN"] or "<token>"
get_platform_integration_token()
Defensive patterns

Strategy: validation

Validate before calling

import os

TOKEN = os.getenv("CREWAI_PLATFORM_INTEGRATION_TOKEN", "")
if not TOKEN:
    raise SystemExit(
        "Missing CREWAI_PLATFORM_INTEGRATION_TOKEN — set it in your environment/secret store."
    )

Try / catch

from crewai_tools.tools.crewai_platform_tools.misc import get_platform_integration_token

try:
    token = get_platform_integration_token()
except ValueError:
    # degrade gracefully: disable platform tools or prompt for setup
    token = None

Prevention

When it happens

Trigger: Calling get_platform_integration_token() (directly or via a platform tool's _run) in a shell, notebook, container, or agent process where CREWAI_PLATFORM_INTEGRATION_TOKEN is not exported or is set to an empty string.

Common situations: Token never added to .env / .bashrc; .env file present but not loaded by the runtime; CI/CD secrets not wired; variable name typo (e.g. CREWAI_INTEGRATION_TOKEN); token defined in one deployment but missing in another.

Related errors


AI-assisted analysis of crewAIInc/crewAI@754d7323be (2026-08-15). Data as JSON: /api/errors/ea0378c673f07cbf. Report an issue: GitHub.