Skip to content

Fix: Observability API signature update and Azure AI Foundry endpoint compatibility#262

Open
Yogeshp-MSFT wants to merge 1 commit intomicrosoft:mainfrom
Yogeshp-MSFT:new-main
Open

Fix: Observability API signature update and Azure AI Foundry endpoint compatibility#262
Yogeshp-MSFT wants to merge 1 commit intomicrosoft:mainfrom
Yogeshp-MSFT:new-main

Conversation

@Yogeshp-MSFT
Copy link
Copy Markdown

Summary

Two fixes in src/client.ts to address a TypeScript compilation error and a runtime 400 error when using Azure AI Foundry endpoints.


Change 1 — InferenceScope API signature update

The @microsoft/agents-a365-observability package changed the InferenceScope.start() signature in a breaking way.

Before: InferenceScope.start(inferenceDetails, agentDetails, tenantDetails)
After: InferenceScope.start(request, inferenceDetails, agentDetails)

  • Line 20 — Replaced TenantDetails import with Request
  • Line 207 — Introduced a new Request object to carry conversationId (previously incorrectly placed on AgentDetails)
  • Line 215 — Removed conversationId from AgentDetails
  • Line 218 — Moved tenantId into AgentDetails.tenantId, removing the separate tenantDetails variable
  • Line 223 — Updated InferenceScope.start() call to the new parameter order

Fixes TS errors TS2353 (conversationId not in AgentDetails) and TS2559 (InferenceDetails incompatible with Request).


Change 2 — Azure AI Foundry endpoint support (Lines 59–86)

Azure AI Foundry endpoints (*.services.ai.azure.com/.../openai/v1/...) are OpenAI-compatible and do not accept the ?api-version= query parameter that AzureChatOpenAI unconditionally appends, causing HTTP 400 errors.

  • Lines 62–79 — Added a Foundry detection branch: if the endpoint URL contains /v1, use ChatOpenAI with a normalised baseURL (trimmed to .../v1), apiKey set in configuration (required when using a custom baseURL), and an api-key header as required by Azure
  • Lines 81–86 — Standard *.openai.azure.com endpoints continue to use AzureChatOpenAI unchanged

@Yogeshp-MSFT Yogeshp-MSFT requested a review from a team as a code owner April 1, 2026 09:18
Copilot AI review requested due to automatic review settings April 1, 2026 09:18
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

Updates the sample agent to align with a breaking observability API signature change and to support Azure AI Foundry OpenAI-compatible endpoints that reject api-version query parameters.

Changes:

  • Updated InferenceScope.start() usage to the new (request, inferenceDetails, agentDetails) signature and moved conversationId into a new Request object.
  • Added detection/handling for Azure AI Foundry /v1 endpoints by routing through ChatOpenAI with a normalized baseURL and Azure-required api-key header.
  • Ignored generated Agent 365 config files that may contain secrets.

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated 3 comments.

File Description
nodejs/langchain/sample-agent/src/client.ts Updates observability scope invocation and adds Azure AI Foundry endpoint compatibility handling.
.gitignore Prevents committing generated Agent 365 config files that may contain secrets.

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.

2 participants