{"record":{"id":"d2d6d605be771153","repo":"langchain-ai/deepagents","slug":"deepagents-requires-langchain-openrouter-openrou","errorCode":null,"errorMessage":"deepagents requires langchain-openrouter>={OPENROUTER_MIN_VERSION}, but {installed} is installed. Run: pip install 'langchain-openrouter>={OPENROUTER_MIN_VERSION}'","messagePattern":"deepagents requires langchain-openrouter>=(.+?), but (.+?) is installed\\. Run: pip install 'langchain-openrouter>=(.+?)'","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"libs/deepagents/deepagents/profiles/provider/_openrouter.py","lineNumber":119,"sourceCode":"        return\n    try:\n        is_old = Version(installed) < Version(OPENROUTER_MIN_VERSION)\n    except InvalidVersion:\n        # Non-PEP-440 version (dev build, fork, etc.) — skip the check but\n        # leave a breadcrumb so an unexpected downstream failure is traceable.\n        logger.warning(\n            \"Skipping langchain-openrouter version check: installed version %r is not PEP 440. Minimum required is %s.\",\n            installed,\n            OPENROUTER_MIN_VERSION,\n        )\n        return\n    if is_old:\n        msg = (\n            f\"deepagents requires langchain-openrouter>={OPENROUTER_MIN_VERSION}, \"\n            f\"but {installed} is installed. \"\n            f\"Run: pip install 'langchain-openrouter>={OPENROUTER_MIN_VERSION}'\"\n        )\n        raise ImportError(msg)\n\n\ndef register() -> None:\n    \"\"\"Register the built-in OpenRouter provider profile.\"\"\"\n    _register_provider_profile_impl(\n        \"openrouter\",\n        ProviderProfile(\n            pre_init=lambda _spec: check_openrouter_version(),\n            init_kwargs_factory=_openrouter_attribution_kwargs,\n        ),\n    )\n","sourceCodeStart":101,"sourceCodeEnd":131,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/deepagents/deepagents/profiles/provider/_openrouter.py#L101-L131","documentation":"The built-in OpenRouter provider profile requires a minimum version of `langchain-openrouter` to guarantee compatible APIs. The installed version is older than `OPENROUTER_MIN_VERSION`, so the provider check raises ImportError with the exact upgrade command.","triggerScenarios":"Registering/using the built-in OpenRouter provider profile (`register()` in `_openrouter.py`) with `pip show langchain-openrouter` reporting a version below the minimum.","commonSituations":"Stale virtualenv after upgrading deepagents; pinned requirements locking an old langchain-openrouter; environment where deepagents was upgraded but its provider deps were not.","solutions":["Run `pip install 'langchain-openrouter>=<OPENROUTER_MIN_VERSION>'` as printed in the error","Update requirements/pyproject pin for langchain-openrouter to the minimum version and re-install","If pinned elsewhere (e.g. uv lock, constraints file), regenerate the lock with the upgraded version"],"exampleFix":"# before\nlangchain-openrouter==0.1.0\n# after\nlangchain-openrouter>=0.2.0","handlingStrategy":"validation","validationCode":"from importlib.metadata import version\nfrom packaging.version import Version\ninstalled = version(\"langchain-openrouter\")\nif Version(installed) < Version(OPENROUTER_MIN_VERSION):\n    raise SystemExit(f\"upgrade: pip install 'langchain-openrouter>={OPENROUTER_MIN_VERSION}'\")","typeGuard":null,"tryCatchPattern":"try:\n    register_openrouter_profile()\nexcept ImportError as e:\n    if \"langchain-openrouter\" in str(e):\n        subprocess.run([sys.executable, \"-m\", \"pip\", \"install\", \"-U\", \"langchain-openrouter\"], check=True)\n        register_openrouter_profile()\n    else:\n        raise","preventionTips":["Pin `langchain-openrouter>=<min>` in requirements/pyproject","Re-run `pip sync`/`uv sync` after upgrading deepagents","Check installed provider versions in CI before running OpenRouter integrations"],"tags":["dependency","version","openrouter","import"],"backgroundTag":"dependency-version-mismatch","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}