Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions nodejs/copilot-studio/sample-agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 0 additions & 1 deletion nodejs/copilot-studio/sample-agent/src/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ export class MyAgent extends AgentApplication<TurnState> {
new BaggageBuilder(),
turnContext
).sessionDescription('Copilot Studio integration session')
.correlationId(`corr-${Date.now()}`)
.build();

// Preload/refresh exporter token
Expand Down
13 changes: 6 additions & 7 deletions nodejs/copilot-studio/sample-agent/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -124,6 +124,10 @@ class McsClient implements Client {
* @returns The agent's response text.
*/
async invokeInferenceScope(prompt: string): Promise<string> {
const request: Request = {
conversationId: this.conversationId || `conv-${Date.now()}`,
};

const inferenceDetails: InferenceDetails = {
operationName: InferenceOperationType.CHAT,
model: 'copilot-studio-agent',
Expand All @@ -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 () => {
Expand All @@ -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) {
Expand Down
Loading