feat: Add Node.js/TypeScript Semantic Kernel sample agent - #281
feat: Add Node.js/TypeScript Semantic Kernel sample agent#281Akshit-MSFT (Akshit0022) wants to merge 5 commits into
Conversation
Adds a new Node.js/TypeScript sample under nodejs/semantic-kernel/sample-agent/ demonstrating the Microsoft Agent 365 SDK with OpenAI function calling (Semantic Kernel-style patterns). Features: - Dual LLM support (Azure OpenAI / OpenAI) - MCP tool integration with @openai/agents SSE transport - Full A365 observability (InvokeAgent, Inference, ExecuteTool scopes) - Agentic authentication with token exchange - Notification handling (email, Word comments) - Conversation continuity with per-conversation chat history - Install/uninstall event handling - Express 5 server with CloudAdapter
There was a problem hiding this comment.
Pull request overview
Adds a new Node.js/TypeScript “Semantic Kernel-style” sample agent under nodejs/semantic-kernel/sample-agent/, mirroring the existing .NET/Python semantic-kernel samples and the existing Node.js OpenAI/Claude samples. The sample demonstrates OpenAI Chat Completions tool-calling (local plugins + MCP tools), Agent 365 notifications, and A365 observability wiring.
Changes:
- Introduces a new Express-based agent host with
/api/messagesand JWT auth middleware. - Implements a Semantic Kernel-style function-calling loop (local plugins) plus MCP tool registration/execution.
- Adds full sample documentation, manifests, env template, and basic token caching for observability export.
Reviewed changes
Copilot reviewed 14 out of 16 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| nodejs/semantic-kernel/sample-agent/tsconfig.json | TypeScript build configuration for the sample |
| nodejs/semantic-kernel/sample-agent/package.json | Sample dependencies and scripts |
| nodejs/semantic-kernel/sample-agent/src/index.ts | Express server entry point and routing/auth middleware |
| nodejs/semantic-kernel/sample-agent/src/agent.ts | AgentApplication implementation (messages, notifications, install/uninstall, observability token preload) |
| nodejs/semantic-kernel/sample-agent/src/client.ts | Core “Semantic Kernel-style” client with tool loop + MCP integration + observability scope |
| nodejs/semantic-kernel/sample-agent/src/openai-config.ts | OpenAI/Azure OpenAI client selection and @openai/agents Azure configuration |
| nodejs/semantic-kernel/sample-agent/src/plugins.ts | Local plugin tools (terms & conditions accept/reject flow) |
| nodejs/semantic-kernel/sample-agent/src/token-cache.ts | In-memory token cache + custom observability token resolver |
| nodejs/semantic-kernel/sample-agent/ToolingManifest.json | MCP server manifest fallback for tooling discovery |
| nodejs/semantic-kernel/sample-agent/.env.template | Environment variable template for auth, tooling, and LLM config |
| nodejs/semantic-kernel/sample-agent/.gitignore | Ignores build output and secret/config files |
| nodejs/semantic-kernel/sample-agent/appManifest/manifest.json | Teams/M365 app manifest for the sample |
| nodejs/semantic-kernel/sample-agent/appManifest/color.png | Teams app icon (color) |
| nodejs/semantic-kernel/sample-agent/appManifest/outline.png | Teams app icon (outline) |
| nodejs/semantic-kernel/sample-agent/docs/design.md | Architecture/design notes for the sample |
| nodejs/semantic-kernel/sample-agent/README.md | End-to-end sample documentation (setup, run, troubleshooting) |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@microsoft-github-policy-service agree company="Microsoft" |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
HI Grant Harris (@gwharris7), can you please review this and approve? |
|
Hi Grant Harris (@gwharris7), kindly review this and take appropriate action. |
|
Grant Harris (@gwharris7) - Please review and provide your approvals. |
Adds a new Node.js/TypeScript sample demonstrating how to build a production-ready Microsoft 365 agent using OpenAI function calling (Semantic Kernel-style patterns) with the Microsoft Agent 365 SDK.
This is the Node.js/TypeScript counterpart to the existing .NET Semantic Kernel sample (
dotnet/semantic-kernel/) and the Python Semantic Kernel sample (python/semantic-kernel/).What's included
New directory:
nodejs/semantic-kernel/sample-agent/src/index.ts/api/messagesendpoint and auth middlewaresrc/agent.tsAgentApplicationwith message routing, notifications, install/uninstall handlingsrc/client.tsSemanticKernelClientwith OpenAI Chat Completions function-calling loop, MCP tool integration, and A365 observability scopessrc/openai-config.tssrc/plugins.tssrc/token-cache.tsToolingManifest.json.env.templatepackage.jsontsconfig.jsonappManifest/manifest.jsonappManifest/color.pngappManifest/outline.pngdocs/design.mdREADME.md.gitignoreFeatures
AZURE_OPENAI_API_KEY/OPENAI_API_KEY)ToolingManifest.jsonfallback; uses@openai/agentsfor MCP server connections with SSE transportUSE_AGENTIC_AUTH=false(bearer token fallback)InvokeAgentScope→InferenceScope→ExecuteToolScopewithBaggageScopecontext propagation@microsoft/agents-a365-notificationsChatHistorymaintained across turnsCloudAdapter, compatible with Agents Playground, matching the pattern used by other Node.js samplesDependencies
openai^4.77.0@openai/agents^0.1.11express^5.1.0@microsoft/agents-hosting^1.2.2@microsoft/agents-activity^1.2.2@microsoft/agents-a365-observability^0.1.0-preview.125@microsoft/agents-a365-tooling-extensions-openai^0.1.0-preview.125@microsoft/agents-a365-notifications^0.1.0-preview.125@microsoft/agents-a365-runtime^0.1.0-preview.125Full list in
package.json.Testing
USE_AGENTIC_AUTH=falsewith bearer token)mcp_MailTools)gpt-4oRelated samples
This follows the same architecture and conventions as:
nodejs/claude/sample-agent/nodejs/openai/sample-agent/dotnet/semantic-kernel/sample-agent/(the .NET equivalent)python/semantic-kernel/sample-agent/(the Python equivalent)