Skip to content

Remove log noise for openai/langchain, add lazy load for langchain and fix Activity return type#98

Merged
hectorhdzg merged 3 commits into
microsoft:mainfrom
hectorhdzg:hectorhdzg/lanchainlazy
May 1, 2026
Merged

Remove log noise for openai/langchain, add lazy load for langchain and fix Activity return type#98
hectorhdzg merged 3 commits into
microsoft:mainfrom
hectorhdzg:hectorhdzg/lanchainlazy

Conversation

@hectorhdzg
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings May 1, 2026 16:32
Co-authored-by: Copilot <copilot@github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to reduce GenAI instrumentation log noise (OpenAI Agents / LangChain), make LangChain tracer loading lazy to avoid optional dependency issues, and align hosting ActivityLike typing for getAgenticInstanceId.

Changes:

  • Downgrade “optional dependency missing” initialization/reset logs for OpenAI Agents and LangChain instrumentations from warn to debug.
  • Lazy-load the LangChain tracer implementation to avoid eager runtime imports of @langchain/core transitive deps.
  • Update ActivityLike.getAgenticInstanceId to allow undefined, and adjust related unit tests.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/genai/instrumentations/langchain/langchainTraceInstrumentor.ts Switches LangChain tracer import to lazy loading and updates handler injection to accept a tracer constructor.
src/distro/distro.ts Reduces log severity/noise when optional GenAI packages aren’t installed; adds explanatory comments.
src/a365/hosting/types.ts Updates ActivityLike.getAgenticInstanceId return type to string | undefined.
test/internal/unit/genai/langchain/langchainTraceInstrumentor.test.ts Updates tests for the new addTracerToHandlers signature.
test/internal/unit/a365/hosting/outputLoggingMiddleware.test.ts Adjusts type narrowing in test setup for the updated ActivityLike signature.
test/internal/unit/a365/hosting/baggageMiddleware.test.ts Adjusts type narrowing in test setup for the updated ActivityLike signature.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test/internal/unit/genai/langchain/langchainTraceInstrumentor.test.ts Outdated
Comment thread src/genai/instrumentations/langchain/langchainTraceInstrumentor.ts
Comment thread src/genai/instrumentations/langchain/langchainTraceInstrumentor.ts
Comment thread src/genai/instrumentations/langchain/langchainTraceInstrumentor.ts
Comment thread src/distro/distro.ts
Comment thread src/distro/distro.ts
@hectorhdzg hectorhdzg merged commit ae61ba0 into microsoft:main May 1, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants