-
Notifications
You must be signed in to change notification settings - Fork 38
feat: enable a365 sample runnable in ATK agents playground #236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
HuihuiWu-Microsoft
wants to merge
9
commits into
microsoft:main
Choose a base branch
from
HuihuiWu-Microsoft:huihui/enable-playground-in-atk
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
380a034
feat: enable a365 sample runnable in ATK agents playground
HuihuiWu-Microsoft 1fdb456
fix: remove service connection envs
HuihuiWu-Microsoft 36e8053
feat: enable claude nodejs sample running in atk playground
HuihuiWu-Microsoft a142b46
feat: add agents toolkit configurations for openai python sample
HuihuiWu-Microsoft e1cffdd
fix: update readme and configurations
HuihuiWu-Microsoft 6604b9d
feat: enable agent framework python sample to debug in atk playground
HuihuiWu-Microsoft 4dd2257
Merge branch 'main' into huihui/enable-playground-in-atk
HuihuiWu-Microsoft 641527a
Merge branch 'main' into huihui/enable-playground-in-atk
HuihuiWu-Microsoft 61b54cf
Merge branch 'main' into huihui/enable-playground-in-atk
ajmfehr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| # TeamsFx files | ||
| env/.env.*.user | ||
| env/.env.local | ||
| env/.env.sandbox | ||
| .localConfigs | ||
| .localConfigs.playground | ||
| .localConfigs | ||
| .notification.localstore.json | ||
| .notification.playgroundstore.json | ||
| appPackage/build | ||
HuihuiWu-Microsoft marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # dependencies | ||
| node_modules/ | ||
|
|
||
| # misc | ||
| .env | ||
| .deployment | ||
| .DS_Store | ||
|
|
||
| # build | ||
| dist/ | ||
|
|
||
| # Dev tool directories | ||
| /devTools/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "recommendations": [ | ||
| "TeamsDevApp.ms-teams-vscode-extension" | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| { | ||
| "version": "0.2.0", | ||
| "configurations": [ | ||
| { | ||
| "name": "Attach to Local Service", | ||
| "type": "node", | ||
| "request": "attach", | ||
| "port": 9239, | ||
| "restart": true, | ||
| "presentation": { | ||
| "group": "all", | ||
| "hidden": true | ||
| }, | ||
| "internalConsoleOptions": "neverOpen" | ||
| } | ||
| ], | ||
| "compounds": [ | ||
| { | ||
| "name": "Debug in Microsoft 365 Agents Playground", | ||
| "configurations": [ | ||
| "Attach to Local Service" | ||
| ], | ||
| "preLaunchTask": "Start App in Microsoft 365 Agents Playground", | ||
| "presentation": { | ||
| "group": "1-playground", | ||
| "order": 1 | ||
| }, | ||
| "stopAll": true | ||
| } | ||
| ] | ||
| } |
77 changes: 77 additions & 0 deletions
77
nodejs/langchain/sample-agent/.vscode/scripts/refresh-bearer-token.ps1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| $ErrorActionPreference = 'Stop' | ||
|
|
||
| $workspace = Get-Location | ||
| $playgroundEnvPath = Join-Path $workspace 'env/.env.playground' | ||
| $playgroundUserEnvPath = Join-Path $workspace 'env/.env.playground.user' | ||
|
|
||
| $a365Command = Get-Command a365 -ErrorAction SilentlyContinue | ||
| if (-not $a365Command) { | ||
| throw "a365 CLI is not installed or not on PATH. Install with: dotnet tool install --global Microsoft.Agents.A365.DevTools.Cli" | ||
| } | ||
|
|
||
| if (-not (Test-Path $playgroundEnvPath)) { | ||
| throw "Missing env file: $playgroundEnvPath" | ||
| } | ||
|
|
||
| $appIdLine = Get-Content $playgroundEnvPath | Where-Object { $_ -match '^\s*CLIENT_APP_ID\s*=\s*.+$' } | Select-Object -First 1 | ||
| if (-not $appIdLine) { | ||
| throw "CLIENT_APP_ID is required in env/.env.playground" | ||
| } | ||
|
|
||
| $appId = ($appIdLine -split '=', 2)[1].Trim() | ||
| if ([string]::IsNullOrWhiteSpace($appId)) { | ||
| throw "CLIENT_APP_ID in env/.env.playground is empty" | ||
| } | ||
|
|
||
| Write-Host "Running a365 develop add-permissions for app id $appId" | ||
| & a365 develop add-permissions --app-id $appId | ||
| if ($LASTEXITCODE -ne 0) { | ||
| throw "a365 develop add-permissions failed" | ||
| } | ||
|
|
||
| Write-Host "Getting bearer token via a365..." | ||
| Write-Host "This may complete silently using cached credentials, or it may require interactive Windows sign-in (WAM)." | ||
| Write-Host "If interactive sign-in is required and no prompt appears, check the taskbar for a hidden sign-in window and bring it to front." | ||
| Write-Host "Running a365 develop get-token for app id $appId" | ||
| $tokenOutput = & a365 develop get-token --app-id $appId --output raw | ||
| if ($LASTEXITCODE -ne 0) { | ||
| throw "a365 develop get-token failed" | ||
| } | ||
|
|
||
| $rawOutput = [string]::Join("`n", $tokenOutput) | ||
| $rawOutput = $rawOutput -replace "`r", '' | ||
|
|
||
| $bearerToken = $null | ||
| $jwtRegex = '(?<token>[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+)' | ||
| $jwtMatches = [regex]::Matches($rawOutput, $jwtRegex) | ||
| if ($jwtMatches.Count -gt 0) { | ||
| $bearerToken = ($jwtMatches | ForEach-Object { $_.Groups['token'].Value } | Sort-Object Length -Descending | Select-Object -First 1).Trim() | ||
| } | ||
|
|
||
| if ([string]::IsNullOrWhiteSpace($bearerToken)) { | ||
| throw "Unable to extract a bearer token from a365 develop get-token output" | ||
| } | ||
|
|
||
| $userEnvLines = @() | ||
| if (Test-Path $playgroundUserEnvPath) { | ||
| $userEnvLines = Get-Content $playgroundUserEnvPath | ||
| } | ||
|
|
||
| $updated = $false | ||
| for ($i = 0; $i -lt $userEnvLines.Count; $i++) { | ||
| if ($userEnvLines[$i] -match '^\s*SECRET_BEARER_TOKEN\s*=') { | ||
| $userEnvLines[$i] = "SECRET_BEARER_TOKEN=$bearerToken" | ||
| $updated = $true | ||
| break | ||
| } | ||
| } | ||
|
|
||
| if (-not $updated) { | ||
| if ($userEnvLines.Count -gt 0 -and -not [string]::IsNullOrWhiteSpace($userEnvLines[$userEnvLines.Count - 1])) { | ||
| $userEnvLines += '' | ||
| } | ||
| $userEnvLines += "SECRET_BEARER_TOKEN=$bearerToken" | ||
| } | ||
|
|
||
| Set-Content -Path $playgroundUserEnvPath -Value $userEnvLines -Encoding UTF8 | ||
| Write-Host 'SECRET_BEARER_TOKEN has been updated in env/.env.playground.user' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,121 @@ | ||
| { | ||
| "version": "2.0.0", | ||
| "tasks": [ | ||
| { | ||
| "label": "Start App in Microsoft 365 Agents Playground", | ||
| "dependsOn": [ | ||
| "Validate prerequisites (Microsoft 365 Agents Playground)", | ||
| "Refresh bearer token (Microsoft 365 Agents Playground)", | ||
| "Deploy (Microsoft 365 Agents Playground)", | ||
| "Start application (Microsoft 365 Agents Playground)", | ||
| "Start Microsoft 365 Agents Playground" | ||
| ], | ||
| "dependsOrder": "sequence" | ||
| }, | ||
| { | ||
| // Check all required prerequisites. | ||
| // See https://aka.ms/teamsfx-tasks/check-prerequisites to know the details and how to customize the args. | ||
| "label": "Validate prerequisites (Microsoft 365 Agents Playground)", | ||
| "type": "teamsfx", | ||
| "command": "debug-check-prerequisites", | ||
| "args": { | ||
| "prerequisites": [ | ||
| "nodejs", // Validate if Node.js is installed. | ||
| "portOccupancy" // Validate available ports to ensure those debug ones are not occupied. | ||
| ], | ||
| "portOccupancy": [ | ||
| 3978, // app service port | ||
| 9239, // app inspector port for Node.js debugger | ||
| 56150 // Microsoft 365 Agents Playground port | ||
| ] | ||
| } | ||
| }, | ||
| { | ||
| "label": "Refresh bearer token (Microsoft 365 Agents Playground)", | ||
| "type": "shell", | ||
| "command": "powershell", | ||
| "args": [ | ||
| "-NoProfile", | ||
| "-ExecutionPolicy", | ||
| "Bypass", | ||
| "-File", | ||
| "${workspaceFolder}/.vscode/scripts/refresh-bearer-token.ps1" | ||
| ], | ||
HuihuiWu-Microsoft marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| "options": { | ||
| "cwd": "${workspaceFolder}" | ||
| } | ||
| }, | ||
| { | ||
| // Build project. | ||
| // See https://aka.ms/teamsfx-tasks/deploy to know the details and how to customize the args. | ||
| "label": "Deploy (Microsoft 365 Agents Playground)", | ||
| "dependsOrder": "sequence", | ||
| "type": "teamsfx", | ||
| "command": "deploy", | ||
| "args": { | ||
| "env": "playground" | ||
| } | ||
| }, | ||
| { | ||
| "label": "Start application (Microsoft 365 Agents Playground)", | ||
| "type": "shell", | ||
| "command": "npm run dev:teamsfx:playground", | ||
| "isBackground": true, | ||
| "options": { | ||
| "cwd": "${workspaceFolder}", | ||
| }, | ||
HuihuiWu-Microsoft marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| "problemMatcher": { | ||
| "pattern": [ | ||
| { | ||
| "regexp": "^.*$", | ||
| "file": 0, | ||
| "location": 1, | ||
| "message": 2 | ||
| } | ||
| ], | ||
| "background": { | ||
| "activeOnStart": true, | ||
| "beginsPattern": "[nodemon] starting", | ||
| "endsPattern": "Server listening on|Bot/ME service listening at|[nodemon] app crashed" | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| "label": "Start Microsoft 365 Agents Playground", | ||
| "type": "shell", | ||
| "command": "npm run dev:teamsfx:launch-playground", | ||
| "isBackground": true, | ||
| "options": { | ||
| "env": { | ||
| "PATH": "${workspaceFolder}/devTools/playground/node_modules/.bin;${env:PATH}" | ||
| } | ||
| }, | ||
HuihuiWu-Microsoft marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| "windows": { | ||
| "options": { | ||
| "env": { | ||
| "PATH": "${workspaceFolder}/devTools/playground/node_modules/.bin;${env:PATH}" | ||
| } | ||
| } | ||
| }, | ||
| "problemMatcher": { | ||
| "pattern": [ | ||
| { | ||
| "regexp": "^.*$", | ||
| "file": 0, | ||
| "location": 1, | ||
| "message": 2 | ||
| } | ||
| ], | ||
| "background": { | ||
| "activeOnStart": true, | ||
| "beginsPattern": ".*", | ||
| "endsPattern": "Listening on" | ||
| } | ||
| }, | ||
| "presentation": { | ||
| "panel": "dedicated", | ||
| "reveal": "silent" | ||
| } | ||
| } | ||
| ] | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| # This file includes environment variables that can be committed to git. It's gitignored by default because it represents your local development environment. | ||
|
|
||
HuihuiWu-Microsoft marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # Built-in environment variables | ||
| TEAMSFX_ENV=playground | ||
|
|
||
| # Environment variables used by Microsoft 365 Agents Playground | ||
| TEAMSAPPTESTER_PORT=56150 | ||
| TEAMSFX_NOTIFICATION_STORE_FILENAME=.notification.testtoolstore.json | ||
|
|
||
HuihuiWu-Microsoft marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # Custom app registration needed for bearer token | ||
| CLIENT_APP_ID= | ||
|
|
||
| # Use Agentic Authentication rather than OBO | ||
| USE_AGENTIC_AUTH=false | ||
|
|
||
| # Set service connection as default | ||
| connectionsMap__0__serviceUrl=* | ||
| connectionsMap__0__connection=service_connection | ||
|
|
||
| # AgenticAuthentication Options | ||
| agentic_type=agentic | ||
| agentic_altBlueprintConnectionName=service_connection | ||
| agentic_scopes=ea9ffc3e-8a23-4a7d-836d-234d7c7565c1/.default # Prod Agentic scope | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # LLM Configuration (choose one option) | ||
|
|
||
| # Option 1: Azure OpenAI (preferred for enterprise) | ||
| SECRET_AZURE_OPENAI_API_KEY= | ||
| AZURE_OPENAI_ENDPOINT= | ||
| AZURE_OPENAI_DEPLOYMENT_NAME= | ||
|
|
||
HuihuiWu-Microsoft marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # Option 2: OpenAI (if Azure OpenAI not configured) | ||
| # SECRET_OPENAI_API_KEY= | ||
| # OPENAI_MODEL=gpt-4o | ||
|
|
||
| SECRET_BEARER_TOKEN= | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| # yaml-language-server: $schema=https://aka.ms/m365-agents-toolkits/v1.11/yaml.schema.json | ||
| # Visit https://aka.ms/teamsfx-v5.0-guide for details on this file | ||
| # Visit https://aka.ms/teamsfx-actions for details on actions | ||
| version: v1.11 | ||
|
|
||
| environmentFolderPath: ./env | ||
|
|
||
| deploy: | ||
| # Install development tool(s) | ||
| - uses: devTool/install | ||
| with: | ||
| testTool: | ||
| version: ~0.2.7 | ||
| symlinkDir: ./devTools/playground | ||
|
|
||
| # Run npm command | ||
| - uses: cli/runNpmCommand | ||
| with: | ||
| args: install | ||
|
|
||
| - uses: file/createOrUpdateEnvironmentFile | ||
| with: | ||
| target: ./.localConfigs.playground | ||
| envs: | ||
| NODE_ENV: local | ||
| PORT: 3978 | ||
| TEAMSFX_NOTIFICATION_STORE_FILENAME: ${{TEAMSFX_NOTIFICATION_STORE_FILENAME}} | ||
| AZURE_OPENAI_API_KEY: ${{SECRET_AZURE_OPENAI_API_KEY}} | ||
| AZURE_OPENAI_ENDPOINT: ${{AZURE_OPENAI_ENDPOINT}} | ||
| AZURE_OPENAI_DEPLOYMENT: ${{AZURE_OPENAI_DEPLOYMENT_NAME}} | ||
| # OPENAI_API_KEY: ${{SECRET_OPENAI_API_KEY}} | ||
| BEARER_TOKEN: ${{SECRET_BEARER_TOKEN}} | ||
| USE_AGENTIC_AUTH: ${{USE_AGENTIC_AUTH}} | ||
| connectionsMap__0__serviceUrl: ${{connectionsMap__0__serviceUrl}} | ||
| connectionsMap__0__connection: ${{connectionsMap__0__connection}} | ||
| agentic_type: ${{agentic_type}} | ||
| agentic_altBlueprintConnectionName: ${{agentic_altBlueprintConnectionName}} | ||
| agentic_scopes: ${{agentic_scopes}} | ||
| connections__service_connection__settings__clientId: "" | ||
| connections__service_connection__settings__clientSecret: "" | ||
| connections__service_connection__settings__tenantId: "" |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.