diff --git a/nodejs/devin/sample-agent/README.md b/nodejs/devin/sample-agent/README.md index 3e49431f..9481caf3 100644 --- a/nodejs/devin/sample-agent/README.md +++ b/nodejs/devin/sample-agent/README.md @@ -13,7 +13,7 @@ For comprehensive documentation and guidance on building agents with the Microso ## Prerequisites -- Node.js 18.x or higher +- Node.js 24.x or higher - Microsoft Agent 365 SDK - Devin API credentials @@ -21,6 +21,10 @@ For comprehensive documentation and guidance on building agents with the Microso To set up and test this agent, refer to the [Configure Agent Testing](https://learn.microsoft.com/en-us/microsoft-agent-365/developer/testing?tabs=nodejs) guide for complete instructions. +## Deploying the Agent + +Refer to the [Deploy and publish agents](https://learn.microsoft.com/en-us/microsoft-agent-365/developer/publish-deploy-agent?tabs=nodejs) guide for complete instructions. + ## Support For issues, questions, or feedback: diff --git a/nodejs/devin/sample-agent/manifest/agenticUserTemplateManifest.json b/nodejs/devin/sample-agent/manifest/agenticUserTemplateManifest.json new file mode 100644 index 00000000..3c32f09d --- /dev/null +++ b/nodejs/devin/sample-agent/manifest/agenticUserTemplateManifest.json @@ -0,0 +1,6 @@ +{ + "id": "66f7a59f-d970-47a7-b178-4994374441c3", + "schemaVersion": "0.1.0-preview", + "agentIdentityBlueprintId": "95587a14-6731-46c4-ab67-3daf4eafd0f8", + "communicationProtocol": "activityProtocol" +} \ No newline at end of file diff --git a/nodejs/devin/sample-agent/manifest/color.png b/nodejs/devin/sample-agent/manifest/color.png new file mode 100644 index 00000000..760f6d54 Binary files /dev/null and b/nodejs/devin/sample-agent/manifest/color.png differ diff --git a/nodejs/devin/sample-agent/manifest/manifest.json b/nodejs/devin/sample-agent/manifest/manifest.json new file mode 100644 index 00000000..250ba85e --- /dev/null +++ b/nodejs/devin/sample-agent/manifest/manifest.json @@ -0,0 +1,32 @@ +{ + "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json", + "id": "80939348-93ed-4478-9e24-a585b859c9a0", + "name": { + "short": "Devin Sample Agent", + "full": "Devin Sample Agent" + }, + "description": { + "short": "Devin is the AI software engineer.", + "full": "Devin is an AI coding agent and software engineer that helps developers build better software faster." + }, + "icons": { + "outline": "outline.png", + "color": "color.png" + }, + "accentColor": "#07687d", + "version": "1.0.0", + "manifestVersion": "devPreview", + "developer": { + "name": "Agent Developer", + "mpnId": "", + "websiteUrl": "https://go.microsoft.com/fwlink/?LinkId=518021", + "privacyUrl": "https://go.microsoft.com/fwlink/?LinkId=518021", + "termsOfUseUrl": "https://shares.datatransfer.microsoft.com/assets/Microsoft_Terms_of_Use.html" + }, + "agenticUserTemplates": [ + { + "id": "66f7a59f-d970-47a7-b178-4994374441c3", + "file": "agenticUserTemplateManifest.json" + } + ] +} \ No newline at end of file diff --git a/nodejs/devin/sample-agent/manifest/outline.png b/nodejs/devin/sample-agent/manifest/outline.png new file mode 100644 index 00000000..8962a030 Binary files /dev/null and b/nodejs/devin/sample-agent/manifest/outline.png differ diff --git a/nodejs/devin/sample-agent/src/agent.ts b/nodejs/devin/sample-agent/src/agent.ts index 1874f2e2..7e9ee982 100644 --- a/nodejs/devin/sample-agent/src/agent.ts +++ b/nodejs/devin/sample-agent/src/agent.ts @@ -16,7 +16,6 @@ import { Activity, ActivityTypes } from "@microsoft/agents-activity"; import { AgentApplication, AgentApplicationOptions, - DefaultConversationState, MemoryStorage, TurnContext, TurnState, @@ -25,13 +24,9 @@ import { Stream } from "stream"; import { v4 as uuidv4 } from "uuid"; import { devinClient } from "./devin-client"; import tokenCache from "./token-cache"; +import { ApplicationTurnState } from "./types/agent.types"; import { getAgentDetails, getTenantDetails } from "./utils"; -interface ConversationState extends DefaultConversationState { - count: number; -} -type ApplicationTurnState = TurnState; - export class A365Agent extends AgentApplication { isApplicationInstalled: boolean = false; agentName = "Devin Agent"; @@ -46,7 +41,7 @@ export class A365Agent extends AgentApplication { // Initialize Observability SDK const observabilitySDK = ObservabilityManager.configure((builder) => builder - .withService("claude-travel-agent", "1.0.0") + .withService("devin-sample-agent", "1.0.0") .withTokenResolver(async (agentId, tenantId) => { // Token resolver for authentication with Agent 365 observability console.log( @@ -174,6 +169,7 @@ export class A365Agent extends AgentApplication { agentDetails, tenantDetails ); + inferenceScope.recordInputMessages([userMessage]); let totalResponseLength = 0; const responseStream = new Stream() @@ -193,8 +189,6 @@ export class A365Agent extends AgentApplication { inferenceScope.recordFinishReasons(["stop"]); }); - inferenceScope.recordInputMessages([userMessage]); - await devinClient.invokeAgent(userMessage, responseStream); } catch (error) { invokeAgentScope.recordOutputMessages([`LLM error: ${error}`]); diff --git a/nodejs/devin/sample-agent/src/types/agent.types.ts b/nodejs/devin/sample-agent/src/types/agent.types.ts new file mode 100644 index 00000000..2d1bfc0d --- /dev/null +++ b/nodejs/devin/sample-agent/src/types/agent.types.ts @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DefaultConversationState, TurnState } from "@microsoft/agents-hosting"; + +interface ConversationState extends DefaultConversationState { + count: number; +} + +export type ApplicationTurnState = TurnState;