feat: enable a365 sample runnable in ATK agents playground#236
feat: enable a365 sample runnable in ATK agents playground#236HuihuiWu-Microsoft wants to merge 6 commits intomicrosoft:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the Node.js LangChain sample agent to support debugging/running directly in Microsoft 365 Agents Playground via TeamsFx tooling, adding the required configuration, VS Code tasks, and environment templates.
Changes:
- Add TeamsFx/M365 Agents Playground project YAMLs and VS Code debug/task wiring for one-key launch.
- Introduce Playground-specific environment files and a PowerShell helper to refresh bearer tokens via the A365 CLI.
- Update
package.jsonscripts/dev workflow to support TeamsFx-based Playground launch.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| nodejs/langchain/sample-agent/README.md | Updates prerequisites and adds step-by-step Playground debugging instructions. |
| nodejs/langchain/sample-agent/package.json | Adjusts dev script for inspector + adds TeamsFx/Playground helper scripts and env-cmd. |
| nodejs/langchain/sample-agent/m365agents.yml | Adds base TeamsFx/M365 Agents Toolkit YAML configuration. |
| nodejs/langchain/sample-agent/m365agents.playground.yml | Adds Playground deployment steps and env file materialization. |
| nodejs/langchain/sample-agent/env/.env.playground.user | Adds user-specific secret placeholders for Playground. |
| nodejs/langchain/sample-agent/env/.env.playground | Adds committed Playground env settings (ports, app id, agentic auth settings). |
| nodejs/langchain/sample-agent/.vscode/tasks.json | Adds TeamsFx deploy + local start + Playground start tasks and token refresh step. |
| nodejs/langchain/sample-agent/.vscode/scripts/refresh-bearer-token.ps1 | Adds script to acquire/update bearer token via a365 develop get-token. |
| nodejs/langchain/sample-agent/.vscode/launch.json | Adds attach config + compound launch for Playground debugging. |
| nodejs/langchain/sample-agent/.vscode/extensions.json | Recommends Teams Toolkit extension. |
| nodejs/langchain/sample-agent/.gitignore | Adds ignore rules for TeamsFx local files/dev tools. |
| "options": { | ||
| "cwd": "${workspaceFolder}", | ||
| }, |
There was a problem hiding this comment.
tasks.json is not valid JSON because there is a trailing comma after the cwd property in the options object. VS Code will fail to load tasks from this file until the trailing comma is removed.
| "label": "Refresh bearer token (Microsoft 365 Agents Playground)", | ||
| "type": "shell", | ||
| "command": "powershell", | ||
| "args": [ | ||
| "-NoProfile", | ||
| "-ExecutionPolicy", | ||
| "Bypass", | ||
| "-File", | ||
| "${workspaceFolder}/.vscode/scripts/refresh-bearer-token.ps1" | ||
| ], |
There was a problem hiding this comment.
This task hard-codes powershell as the command, which will fail on macOS/Linux by default. Consider using pwsh (PowerShell 7) with OS-specific overrides, or gating this task to Windows and documenting an alternative token refresh path for non-Windows devs.
| "options": { | ||
| "env": { | ||
| "PATH": "${workspaceFolder}/devTools/playground/node_modules/.bin;${env:PATH}" | ||
| } | ||
| }, |
There was a problem hiding this comment.
PATH is being concatenated using ;, which is Windows-specific. Because this options.env block applies to all platforms, it will break PATH resolution on macOS/Linux (they use :). Use OS-specific windows/linux/osx overrides (or a platform-agnostic approach) so the task works cross-platform.
| # Option 1: Azure OpenAI (preferred for enterprise) | ||
| SECRET_AZURE_OPENAI_API_KEY= | ||
| AZURE_OPENAI_ENDPOINT= | ||
| AZURE_OPENAI_DEPLOYMENT_NAME= | ||
|
|
There was a problem hiding this comment.
This file is tracked in git but is named like a user-secret env file (.env.*.user) and contains secret placeholders (SECRET_*). Since the repo’s .gitignore is set up to ignore env/.env.*.user, it’s safer to keep this untracked and instead commit a template (e.g., env/.env.playground.user.example) to reduce the risk of accidentally committing real tokens later.
| # This file includes environment variables that can be committed to git. It's gitignored by default because it represents your local development environment. | ||
|
|
There was a problem hiding this comment.
The header comment says this env file is "gitignored by default", but the repo’s .gitignore does not ignore env/.env.playground (and this PR is committing it). Either update the comment to reflect that it’s committed as a template, or update .gitignore if it should remain local-only.
| # Environment variables used by Microsoft 365 Agents Playground | ||
| TEAMSAPPTESTER_PORT=56150 | ||
| TEAMSFX_NOTIFICATION_STORE_FILENAME=.notification.testtoolstore.json | ||
|
|
There was a problem hiding this comment.
TEAMSFX_NOTIFICATION_STORE_FILENAME is set to .notification.testtoolstore.json, but .gitignore only ignores .notification.localstore.json / .notification.playgroundstore.json. This likely creates an unignored local state file that could be accidentally committed. Either change the filename to match an ignored pattern or add this filename to .gitignore.
| .localConfigs | ||
| .localConfigs.playground | ||
| .localConfigs |
There was a problem hiding this comment.
.gitignore has a duplicate .localConfigs entry. Consider removing the duplicate to keep the ignore list clean and avoid confusion when updating it later.
| .notification.localstore.json | ||
| .notification.playgroundstore.json | ||
| appPackage/build |
There was a problem hiding this comment.
.env.playground sets TEAMSFX_NOTIFICATION_STORE_FILENAME to .notification.testtoolstore.json, but this filename is not ignored here (only .notification.localstore.json / .notification.playgroundstore.json are). Add .notification.testtoolstore.json (or a wildcard pattern) to prevent accidentally committing local notification store state.
| > - [Microsoft 365 Agents Toolkit Visual Studio Code Extension](https://aka.ms/teams-toolkit) latest version | ||
| > - Prepare your own Azure/openAI API credentials | ||
| > - Azure CLI signed in with `az login` |
There was a problem hiding this comment.
Spelling/capitalization: "Azure/openAI" should be "Azure/OpenAI" to match standard product naming used elsewhere in the repo.
| ## Prerequisites | ||
| > | ||
| > To run the template in your local dev machine, you will need: | ||
| > | ||
| > - [Node.js](https://nodejs.org/), supported versions: 18.x or higher |
There was a problem hiding this comment.
The prerequisites list is formatted as a blockquote (>), which is inconsistent with other Node.js sample READMEs (e.g., nodejs/openai/sample-agent/README.md and nodejs/claude/sample-agent/README.md use a normal bullet list). Consider removing the blockquote markers so the section renders consistently across samples.
No description provided.