Skip to content

fix: add missing langchain instrumentor dependency to import flow#836

Merged
jariy17 merged 1 commit intoaws:mainfrom
jariy17:fix/import-langchain-instrumentor-dep
Apr 14, 2026
Merged

fix: add missing langchain instrumentor dependency to import flow#836
jariy17 merged 1 commit intoaws:mainfrom
jariy17:fix/import-langchain-instrumentor-dep

Conversation

@jariy17
Copy link
Copy Markdown
Collaborator

@jariy17 jariy17 commented Apr 14, 2026

Summary

Two related fixes for opentelemetry-instrumentation-langchain dependency management:

  1. Import flow bug (ModuleNotFoundError): LangGraphTranslator generates LangchainInstrumentor().instrument() in imported agents' main.py, but pyproject-generator.ts never declared the dependency in LANGGRAPH_DEPS. When setupPythonProject() runs uv install, the package is missing, and the imported agent crashes at runtime with ModuleNotFoundError: No module named 'opentelemetry.instrumentation.langchain'.

  2. Template version pin: feat: add auto-instrumentation to langchain agent template #835 added opentelemetry-instrumentation-langchain to both LangChain template pyproject.toml files without a version constraint. Every other third-party dep in these files uses >= X.Y.Z. This pins it to >= 0.59.0 for consistency.

Files changed

  • src/cli/operations/agent/import/pyproject-generator.ts — add opentelemetry-instrumentation-langchain>=0.59.0 to LANGGRAPH_DEPS
  • src/cli/operations/agent/import/__tests__/translator.test.ts — add assertion that the dependency is present in generated LangGraph pyproject
  • src/assets/python/a2a/langchain_langgraph/base/pyproject.toml — pin >= 0.59.0
  • src/assets/python/http/langchain_langgraph/base/pyproject.toml — pin >= 0.59.0
  • src/assets/__tests__/__snapshots__/assets.snapshot.test.ts.snap — updated snapshots

Related Issue

Pre-existing bug in the import flow, discovered during review of #835.

Type of Change

  • Bug fix

Test plan

  • npx vitest run src/cli/operations/agent/import/__tests__/translator.test.ts — all 10 tests pass (including new assertion)
  • npx vitest run src/assets/__tests__/assets.snapshot.test.ts — all 90 snapshot tests pass
  • npm run build — compiles cleanly
  • Pre-commit hooks pass (eslint, prettier, secretlint, typecheck)

@jariy17 jariy17 requested a review from a team April 14, 2026 17:44
@github-actions github-actions bot added the size/xs PR size: XS label Apr 14, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Package Tarball

aws-agentcore-0.8.0.tgz

How to install

npm install https://github.com/aws/agentcore-cli/releases/download/pr-836-tarball/aws-agentcore-0.8.0.tgz

@jariy17 jariy17 force-pushed the fix/import-langchain-instrumentor-dep branch from 02721fb to efca79b Compare April 14, 2026 17:46
@github-actions github-actions bot added size/xs PR size: XS and removed size/xs PR size: XS labels Apr 14, 2026
The LangGraph translator generates LangchainInstrumentor().instrument()
in imported agents' main.py, but pyproject-generator.ts did not include
opentelemetry-instrumentation-langchain in LANGGRAPH_DEPS. This causes
imported LangGraph agents to crash at runtime with ModuleNotFoundError.
@jariy17 jariy17 force-pushed the fix/import-langchain-instrumentor-dep branch from efca79b to 09e318a Compare April 14, 2026 17:53
@github-actions github-actions bot added size/xs PR size: XS and removed size/xs PR size: XS labels Apr 14, 2026
@jariy17 jariy17 merged commit 921a05f into aws:main Apr 14, 2026
22 checks passed
@jariy17 jariy17 deleted the fix/import-langchain-instrumentor-dep branch April 14, 2026 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/xs PR size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants