Fix: Observability SDK API compatibility + Azure App Service deployment#267
Open
Yogeshp-MSFT wants to merge 2 commits intomicrosoft:mainfrom
Open
Fix: Observability SDK API compatibility + Azure App Service deployment#267Yogeshp-MSFT wants to merge 2 commits intomicrosoft:mainfrom
Yogeshp-MSFT wants to merge 2 commits intomicrosoft:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the Perplexity Node.js sample agent to match the latest @microsoft/agents-a365-observability APIs, prevent a production crash related to missing tenantId, and ensure Azure App Service deployments can build TypeScript successfully.
Changes:
- Updated
InferenceScope.startandInvokeAgentScope.startcalls to align with the new Observability SDK signatures and types. - Adjusted baggage/user fields to match renamed/removed
BaggageBuilderAPIs and ensuredagentDetails.tenantIdis populated. - Moved
typescriptand relevant@types/*packages intodependenciesto avoid Oryx build failures whenNODE_ENV=production.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| nodejs/perplexity/sample-agent/src/agent.ts | Aligns observability scope creation with updated SDK APIs and ensures required tenantId is present to prevent runtime crashes. |
| nodejs/perplexity/sample-agent/package.json | Ensures Azure App Service/Oryx can run tsc by installing TypeScript and type packages during production installs. |
c6afd82 to
36e3325
Compare
36e3325 to
c545bb6
Compare
Author
|
HI @gwharris7 can you review this pr? |
Remove unnecessary newline before the JSDoc comment.
526fb75 to
512b2df
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes TypeScript compilation errors caused by a breaking API change in
@microsoft/agents-a365-observability, resolves a runtime crash in production due to missingtenantId, and fixes Azure App Service deployment failures.src/agent.ts1.
InferenceScope.start— updated to new API signature (line ~116)InferenceScope.start(inferenceDetails, agentDetails, tenantDetails)— first arg wasInferenceDetailsInferenceScope.start({ content: userInput }, inferenceDetails, agentDetails)— first arg is now aRequestobjectresponseIdfield frominferenceDetails(no longer part ofInferenceDetailstype)2.
queryModelfunction signature — removedtenantDetailsparam (line ~100)queryModel(userInput, agentDetails, tenantDetails, client, systemPrompt)queryModel(userInput, agentDetails, client, systemPrompt)TenantDetailsis no longer passed toInferenceScope.start, so it was removed from the function3.
BaggageBuilderchain — removed non-existent methods (line ~232).correlationId(activityId)— method does not exist onBaggageBuilder.callerId(userId)→.userId(userId)— method was renamed in the SDK.callerName(userName)→.userName(userName)— method was renamed in the SDK4.
InvokeAgentScope.start— updated to new API signature (line ~336)InvokeAgentScope.start(invokeDetails, tenantDetails, undefined, callerDetails)— old 4-arg signatureInvokeAgentScope.start(request, invokeScopeDetails, agentDetails, callerDetails)where:request:{ content, sessionId, conversationId }invokeScopeDetails:{ endpoint: invokeDetails.endpoint }callerDetails:{ userDetails: { userId, userName, tenantId } }— uses newCallerDetailswrapper type5.
agentDetails— added missingtenantIdfield (line ~247)agentDetailsobject had notenantIdtenantId: tenantIdadded toagentDetailsInvokeAgentScope.startthrew at runtime in production (observability enabled), causing the agent to reply "Sorry, something went wrong with the observability context." for every message. Worked locally only becauseENABLE_A365_OBSERVABILITY=falsein.envsilently bypassed validation.package.json
6. Moved
typescript,@types/express,@types/nodefromdevDependencies→dependenciesnpm installwithNODE_ENV=production, which skipsdevDependencies. Withouttypescriptand the@typespackages,tscfails during the Oryx build step, causingDeployment Failed.