Add Python LangChain local OTLP mode - #87
Conversation
🦋 Changeset detectedLatest commit: b66884d The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Capy auto-review is paused for this organization because the monthly auto-review limit has been reached. Increase the limit or turn it off in billing settings to resume automatic reviews. |
|
Added an explicit changeset note in b66884d for the Python LangChain local OTLP mode, following the changeset-bot guidance. Since this PR only touches the Python package/docs/tests and not a JS workspace package, the changeset keeps the version frontmatter empty while documenting the change. |
Summary
Part of #20.
This adds a scoped local-development path for the Python LangChain integration:
In local mode, the SDK no longer requires
TCC_API_KEY. It configures the LangChain OpenTelemetry exporter against a local OTLP HTTP endpoint instead:http://localhost:4318/v1/tracestcc_url=...TCC_LOCAL_OTLP_ENDPOINTThis does not attempt to solve the full local UI/collector story in one PR, but it removes the current cloud-auth hard stop for Python LangChain/LangGraph local development and makes it possible to run against a local collector/proxy without patching env vars or passing a fake API key.
Changes
local: bool = Falsetoinstrument_langchain(...)create_otlp_exporter(...)to omit theAuthorizationheader when no API key is providedTCC_LOCAL_OTLP_ENDPOINT/ default local OTLP endpoint resolutionpackages/python/README.mdValidation
/tmp/codex-observatory-venv/bin/python -m pytest packages/python/tests/test_langchain_local.py->4 passedpython -m ruff check packages/python/contextcompany/config.py packages/python/contextcompany/langchain/base.py packages/python/contextcompany/langchain/__init__.py packages/python/tests/test_langchain_local.pypython -m ruff format --check packages/python/contextcompany/config.py packages/python/contextcompany/langchain/base.py packages/python/contextcompany/langchain/__init__.py packages/python/tests/test_langchain_local.pygit diff --check