Fix: Observability API signature update and Azure AI Foundry endpoint compatibility(Langchain Nodejs) - #262
Conversation
… inference request structure
There was a problem hiding this comment.
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 movedconversationIdinto a newRequestobject. - Added detection/handling for Azure AI Foundry
/v1endpoints by routing throughChatOpenAIwith a normalizedbaseURLand Azure-requiredapi-keyheader. - 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. |
|
hi Grant Harris (@gwharris7) can you review this pr? |
|
Hi @microsoft/agent365-approvers Grant Harris (@gwharris7) , could you review this PR for merging? |
|
Hi @microsoft/agent365-approvers Grant Harris (@gwharris7) , could you review this PR for merging? |
|
Hi ajmfehr @microsoft/agent365-approvers, could you please review this pr? |
Observability: enable the A365 exporter (enableObservabilityExporter), add a root invoke_agent scope via a shared runTraced() helper covering both the message and email-notification paths, and extract buildAgentDetails/resolveChannelName into src/observability.ts. Agent identity is now resolved from the runtime agenticAppId with the blueprint id carried separately for MAC roll-up; turns without a real identity run untraced instead of emitting spans under a synthetic id the exporter cannot authenticate.
Dependencies: pin the Agent 365 SDKs to 1.1.0-preview.7 - 1.0.0 parsed the tooling gateway response as a bare array, but the gateway returns { mcpServers: [...] }, so MCP discovery failed with 'rawServers.map is not a function' whenever NODE_ENV!=development. Add axios explicitly (required by agents-a365-tooling but not declared by it) and pin typescript ~5.9.3 (ts-node 10.x cannot load the ESM-only TypeScript 7 that npm otherwise hoists).
Also updates ToolingManifest.json to the per-server Mail audience, documents the exporter and debug-logging env vars in .env.example, and ignores local test artifacts.
|
Hi Walter Luna (@walterluna) please review this pr. |
There was a problem hiding this comment.
Not sure if this should be merged? Seems like a leftover from https://github.com/microsoft/agent365-skills/blob/main/.github/copilot-instructions.md
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 —
InferenceScopeAPI signature updateThe
@microsoft/agents-a365-observabilitypackage changed theInferenceScope.start()signature in a breaking way.Before:
InferenceScope.start(inferenceDetails, agentDetails, tenantDetails)After:
InferenceScope.start(request, inferenceDetails, agentDetails)TenantDetailsimport withRequestRequestobject to carryconversationId(previously incorrectly placed onAgentDetails)conversationIdfromAgentDetailstenantIdintoAgentDetails.tenantId, removing the separatetenantDetailsvariableInferenceScope.start()call to the new parameter orderFixes TS errors
TS2353(conversationIdnot inAgentDetails) andTS2559(InferenceDetailsincompatible withRequest).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 thatAzureChatOpenAIunconditionally appends, causing HTTP 400 errors./v1, useChatOpenAIwith a normalisedbaseURL(trimmed to.../v1),apiKeyset inconfiguration(required when using a custombaseURL), and anapi-keyheader as required by Azure*.openai.azure.comendpoints continue to useAzureChatOpenAIunchanged