From 43628a6aa090d3d207097717626e3e3e93246370 Mon Sep 17 00:00:00 2001 From: prajapatiy9826 Date: Wed, 8 Apr 2026 17:06:17 +0530 Subject: [PATCH 1/2] fix: update dependencies to latest preview versions and refactor request handling in McsClient --- nodejs/copilot-studio/sample-agent/package.json | 8 ++++---- nodejs/copilot-studio/sample-agent/src/agent.ts | 1 - nodejs/copilot-studio/sample-agent/src/client.ts | 13 ++++++------- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/nodejs/copilot-studio/sample-agent/package.json b/nodejs/copilot-studio/sample-agent/package.json index fccd235c..93759099 100644 --- a/nodejs/copilot-studio/sample-agent/package.json +++ b/nodejs/copilot-studio/sample-agent/package.json @@ -19,10 +19,10 @@ ], "license": "MIT", "dependencies": { - "@microsoft/agents-a365-notifications": "^0.1.0-preview.30", - "@microsoft/agents-a365-observability": "^0.1.0-preview.30", - "@microsoft/agents-a365-observability-hosting": "^0.1.0-preview.64", - "@microsoft/agents-a365-runtime": "^0.1.0-preview.30", + "@microsoft/agents-a365-notifications": "^0.1.0-preview.125", + "@microsoft/agents-a365-observability": "^0.1.0-preview.125", + "@microsoft/agents-a365-observability-hosting": "^0.1.0-preview.125", + "@microsoft/agents-a365-runtime": "^0.1.0-preview.125", "@microsoft/agents-activity": "^1.2.2", "@microsoft/agents-copilotstudio-client": "^1.2.2", "@microsoft/agents-hosting": "^1.2.2", diff --git a/nodejs/copilot-studio/sample-agent/src/agent.ts b/nodejs/copilot-studio/sample-agent/src/agent.ts index 3c7c046f..aed00bde 100644 --- a/nodejs/copilot-studio/sample-agent/src/agent.ts +++ b/nodejs/copilot-studio/sample-agent/src/agent.ts @@ -88,7 +88,6 @@ export class MyAgent extends AgentApplication { new BaggageBuilder(), turnContext ).sessionDescription('Copilot Studio integration session') - .correlationId(`corr-${Date.now()}`) .build(); // Preload/refresh exporter token diff --git a/nodejs/copilot-studio/sample-agent/src/client.ts b/nodejs/copilot-studio/sample-agent/src/client.ts index 3b1942a7..40f36365 100644 --- a/nodejs/copilot-studio/sample-agent/src/client.ts +++ b/nodejs/copilot-studio/sample-agent/src/client.ts @@ -12,8 +12,8 @@ import { Builder, InferenceOperationType, AgentDetails, - TenantDetails, InferenceDetails, + Request, Agent365ExporterOptions, } from '@microsoft/agents-a365-observability'; import { AgenticTokenCacheInstance } from '@microsoft/agents-a365-observability-hosting'; @@ -124,6 +124,10 @@ class McsClient implements Client { * @returns The agent's response text. */ async invokeInferenceScope(prompt: string): Promise { + const request: Request = { + conversationId: this.conversationId || `conv-${Date.now()}`, + }; + const inferenceDetails: InferenceDetails = { operationName: InferenceOperationType.CHAT, model: 'copilot-studio-agent', @@ -132,15 +136,11 @@ class McsClient implements Client { const agentDetails: AgentDetails = { agentId: 'copilot-studio-sample-agent', agentName: 'Copilot Studio Sample Agent', - conversationId: this.conversationId || `conv-${Date.now()}`, - }; - - const tenantDetails: TenantDetails = { tenantId: process.env.tenantId || 'unknown-tenant', }; let response = ''; - const scope = InferenceScope.start(inferenceDetails, agentDetails, tenantDetails); + const scope = InferenceScope.start(request, inferenceDetails, agentDetails); try { await scope.withActiveSpanAsync(async () => { @@ -149,7 +149,6 @@ class McsClient implements Client { // Record the inference telemetry scope.recordInputMessages([prompt]); scope.recordOutputMessages([response]); - scope.recordResponseId(`resp-${Date.now()}`); scope.recordFinishReasons(['stop']); }); } catch (error) { From cc8de0e82367ac9a9b40abe50d04378be0f2061e Mon Sep 17 00:00:00 2001 From: Yogeshp-MSFT Date: Fri, 24 Apr 2026 14:51:07 +0530 Subject: [PATCH 2/2] Improved formatting --- nodejs/copilot-studio/sample-agent/src/client.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/nodejs/copilot-studio/sample-agent/src/client.ts b/nodejs/copilot-studio/sample-agent/src/client.ts index 40f36365..de9b77f6 100644 --- a/nodejs/copilot-studio/sample-agent/src/client.ts +++ b/nodejs/copilot-studio/sample-agent/src/client.ts @@ -196,6 +196,5 @@ export async function getClient( // Create the Copilot Studio client with the token const copilotClient = new CopilotStudioClient(settings, tokenResult.token); - return new McsClient(copilotClient); }