Skip to content

Add career-coach scenario: Career Coach autopilot using Node.js SDK - #338

Open
Akshit-MSFT (Akshit0022) wants to merge 1 commit into
microsoft:mainfrom
Akshit0022:scenario/career-coach
Open

Add career-coach scenario: Career Coach autopilot using Node.js SDK#338
Akshit-MSFT (Akshit0022) wants to merge 1 commit into
microsoft:mainfrom
Akshit0022:scenario/career-coach

Conversation

@Akshit0022

@Akshit0022 Akshit-MSFT (Akshit0022) commented Aug 23, 2026

Copy link
Copy Markdown

Add career-coach scenario: Career Coach autopilot using Node.js SDK

What this adds

A scenario extension under scenarios/career-coach/ — a private AI Career Coach built on the Microsoft Agent 365 SDK + OpenAI Agents SDK that runs an employee's growth journey end-to-end inside Microsoft Teams: goal setting, skill-gap mapping, course recommendations, proactive post-course quizzes, milestone nudges, and a manager wrap-up email. Complements the Chief-of-Staff (#333) and Scrum-Master (#334) scenarios by covering the talent-development / employee-growth side of leader / squad workflows.

Capabilities

Each flow is a deterministic handler in src/handlers.ts, with focused LLM sub-calls in src/llm-tasks.ts:

  • Set goals — user names a target role → skill-path Adaptive Card with per-skill self-assessment dropdowns
  • Map skills — deterministic gap analysis against CompetencyFramework_v2 + course recommendations from LearningCatalog_v2 (planReview card)
  • Save plan — writes the living plan (goals, skills, course list) to the UserState list
  • Sync progress — diffs LearningPortalStatus against the plan and recomputes progress
  • Proactive quiz — a Microsoft Graph change-notification subscription fires when the portal marks a course complete → the agent DMs a 5-question quiz (3 MCQ graded in code, 2 short-answer graded by a focused LLM call)
  • 80% milestone — one-shot card surfacing the weakest topic areas aggregated across quiz attempts
  • 100% completion — manager email via Graph /me/sendMail + completion-summary card
  • 1:1 prep brief — STAR-format wins + talking points on demand

Full per-feature flows and the SharePoint schema: scenarios/career-coach/docs/design.md and AGENT-CODE-WALKTHROUGH.md.

Design principles

  1. Deterministic-first. The LLM is gated to only the paths that genuinely need language understanding (free-text role elicitation, quiz-question generation, short-answer grading, completion-email prose). Every card submit, data write, MCQ grade, milestone rule, and email dispatch is plain TypeScript.
  2. Card actions never double-fire. Every Action.Execute handler acks fast and is fire-and-forget by design; heavy work runs after the ack.
  3. Durable state in SharePoint. Five lists (CompetencyFramework_v2, LearningCatalog_v2, UserState, LearningPortalStatus, QuizResponses) survive restarts; a disk-backed store keeps proactive conversation refs across nodemon reloads.
  4. One path to Graph. Runtime uses agentic auth (a delegated Graph token per turn — /me is whoever is in the chat); setup scripts use MSAL device-code + delegated scopes. No application-permission client secret at runtime.
  5. Graceful degradation, never a crash. A365 lifecycle events are consumed by a top-priority route so onboarding never crashes the turn.
  6. Grounded, not hallucinated. All plan/progress state is read back from SharePoint before each write; the LLM never invents list IDs or progress.

What's included

scenarios/career-coach/
├─ README.md                    — Prereqs, install, SharePoint setup, dev tunnel, run, E2E walkthrough, troubleshooting
├─ AGENT-CODE-WALKTHROUGH.md    — Source-level deep dive
├─ docs/
│  └─ design.md                 — Architecture, per-feature flows, auth model, extension points
├─ src/                         — agent, cards, handlers, service layer, llm-tasks, graph-service, sharepoint tools
│  └─ scripts/
│     ├─ setup-sharepoint.ts    — Idempotent provisioning of all 5 lists via delegated Graph
│     ├─ seed-reference-data.ts — Competency framework + learning catalog from CSVs
│     ├─ mark-courses-complete.ts — Simulate portal completions (drives Feature 1)
│     ├─ reset-milestones.ts    — Re-arm the 80% / 100% cards
│     ├─ backup-and-reset-user.ts — Snapshot + clear a user's write-lists for a clean re-run
│     └─ clear-list.ts          — Empty a list
├─ SharePoint Data/             — Seed CSVs (19 competencies + 31 courses)
├─ manifest/                    — Teams app + agentic-user templates (placeholder GUIDs)
├─ images/thumbnail.png
├─ ToolingManifest.json         — WorkIQ MCP bindings (Mail, Calendar, SharePoint)
├─ package.json                 — Scripts: dev, build, test-tool, setup:sharepoint, seed:reference, mark:complete, reset:milestones, backup:user
├─ tsconfig.json
├─ .env.template                — Every env var with WHY comments
├─ .gitignore
└─ verify-userstate.ps1         — Debug helper to dump UserState via Graph

Local testing

The conversational path (goal setting, skill ratings, gap analysis, 1:1 prep) runs locally against the Agents Playground: npm install, npm run dev, npm run test-tool. The full data-backed loop (save plan, proactive quiz, milestones, manager email) requires:

  • Azure OpenAI or OpenAI API key (gpt-4o recommended)
  • A SharePoint site the developer can write to (delegated Graph, no admin consent) — five lists are created by npm run setup:sharepoint
  • A public dev-tunnel URL for the Graph change-notification webhook (Feature 1)

Auth model — delegated / agentic only

Runtime Graph calls use the agent's agentic auth (a delegated token minted per turn by the A365 platform). Setup/seed scripts use MSAL device-code + delegated scopes (Sites.ReadWrite.All, User.Read.All, Mail.Send, Mail.ReadWrite, Chat.ReadWrite) with a single interactive sign-in. No application-permission client credentials and no admin consent are required to run the sample.

Verification

  • Set up on a fresh M365 dev tenant with a provisioned SharePoint site; all features exercised end-to-end in Teams (dev tunnel) and in the Agents Playground.
  • Secret scan clean — no tenant IDs, no client secrets, no PATs, no persona bleed. All placeholders are 00000000-…, contoso.sharepoint.com, <your-test-user-object-id> etc.
  • All source has MIT copyright headers.
  • npx tsc --noEmit compiles clean.
  • CLA signed.

Placement — why scenarios/

Placed at the repo root under scenarios/career-coach/ rather than under a language tier (e.g. nodejs/openai/) because a career-coach workflow doesn't map cleanly to a single SDK — it composes the Agent 365 SDK, OpenAI Agents SDK, WorkIQ MCP tooling, SharePoint, and Microsoft Graph. This mirrors how the Chief-of-Staff (#333) and Scrum-Master (#334) samples are placed. Happy to relocate to nodejs/openai/scenarios/career-coach/ if reviewers prefer a language-tier scoping.

Not included / future work

  • App-only Graph for mail. Feature 4 currently sends via delegated /me/sendMail; an app-only Mail.Send + Sites.Selected path is documented in docs/design.md as the production swap-in.
  • Production Key Vault-backed MSAL cache. Local dev uses a file cache (.mstoken-cache.json, gitignored).
  • E2E test suite under tests/e2e/. Recommend a follow-up PR once initial review lands.

Commits

  1. 97838c0 — initial import of the career-coach scenario (39 files)

Related

Adds scenarios/career-coach — an Agent 365 AI Teammate that helps employees set a target role, maps skill gaps, recommends courses, quizzes them proactively via Graph change notifications, and drafts the manager wrap-up email. Hybrid pro-code: deterministic TypeScript for all card submits/writes/business rules; focused LLM sub-calls for conversation, quiz generation, grading, and email prose. SharePoint Lists for state, Microsoft Graph (delegated/agentic) for triggers + mail, WorkIQ MCP tooling. Placeholder GUIDs; no secrets or tenant-specific values.
@Akshit0022
Akshit-MSFT (Akshit0022) marked this pull request as ready for review August 23, 2026 21:58
@Akshit0022
Akshit-MSFT (Akshit0022) requested a review from a team as a code owner August 23, 2026 21:58
Copilot AI lite review requested due to automatic review settings August 23, 2026 21:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new Career Coach scenario under scenarios/career-coach/, expanding the repo’s scenario samples with a Node.js/TypeScript Agent 365 agent that uses SharePoint Lists + Microsoft Graph for durable plan/progress state and proactive flows.

Changes:

  • Introduces a full Career Coach agent implementation (LLM path + deterministic handlers) with SharePoint-backed state, quizzes, milestones, and completion email flow.
  • Adds SharePoint provisioning/seed/reset scripts plus reference CSV datasets for competency framework and learning catalog.
  • Adds scenario documentation and Teams manifest/assets for sideloading/testing.

Reviewed changes

Copilot reviewed 36 out of 39 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
scenarios/career-coach/.env.template Environment variable template for OpenAI/Azure OpenAI, A365 identity/auth, SharePoint, and webhook settings
scenarios/career-coach/.gitignore Scenario-local ignore rules for build artifacts, caches, state, and logs
scenarios/career-coach/AGENT-CODE-WALKTHROUGH.md Walkthrough documentation for the scenario code
scenarios/career-coach/README.md End-to-end setup and testing instructions for the scenario
scenarios/career-coach/ToolingManifest.json MCP server manifest for tooling integration
scenarios/career-coach/package.json Node/TS dependencies and scripts for dev/build and SharePoint helpers
scenarios/career-coach/tsconfig.json TypeScript compiler configuration
scenarios/career-coach/verify-userstate.ps1 PowerShell helper to inspect UserState list contents via Graph
scenarios/career-coach/SharePoint Data/CompetencyFramework_v2.csv Seed data: role → competency framework
scenarios/career-coach/SharePoint Data/LearningCatalog_v2.csv Seed data: course catalog mapped to competencies
scenarios/career-coach/docs/design.md Design/architecture documentation for the scenario
scenarios/career-coach/images/thumbnail.png Scenario thumbnail asset
scenarios/career-coach/manifest/manifest.json Teams app manifest (placeholder IDs)
scenarios/career-coach/manifest/agenticUserTemplateManifest.json Agentic user template manifest
scenarios/career-coach/manifest/color.png Teams icon asset
scenarios/career-coach/manifest/outline.png Teams icon asset
scenarios/career-coach/src/index.ts Express host: health check, /api/messages, proactive /api/portal-event, startup wiring
scenarios/career-coach/src/agent.ts AgentApplication wiring, lifecycle routing guard, message + notification handlers, adaptive card action handlers
scenarios/career-coach/src/client.ts OpenAI Agents client wrapper, system prompt, SharePoint function-tools integration, observability scopes
scenarios/career-coach/src/cards.ts Adaptive Card rendering utilities and payload helpers
scenarios/career-coach/src/career-coach-types.ts Shared data model types + SharePoint configuration constants
scenarios/career-coach/src/career-coach-service.ts Deterministic service layer: SharePoint CRUD, progress logic, grading logic, milestone aggregation
scenarios/career-coach/src/handlers.ts Deterministic handlers for card submits, progress sync, quiz flows, milestones, and completion email
scenarios/career-coach/src/llm-tasks.ts Focused LLM subcalls for quiz generation, short-answer grading, and completion email prose
scenarios/career-coach/src/openai-config.ts OpenAI vs Azure OpenAI client configuration
scenarios/career-coach/src/graph-service.ts Graph client setup (MSAL device-code for scripts + agentic token exchange for runtime), subscriptions, mail helpers
scenarios/career-coach/src/sharepoint-tools.ts Graph-backed SharePoint tools exposed as OpenAI function tools (site/list ID resilience, column mapping)
scenarios/career-coach/src/sharepoint-column-map.ts SharePoint display-name ↔ internal-name mapping and defensive field coercions
scenarios/career-coach/src/subscription-manager.ts Create/renew Graph list change-notification subscription with local persisted state
scenarios/career-coach/src/proactive-refs.ts Disk-backed mapping of AAD object IDs to proactive conversation IDs
scenarios/career-coach/src/file-storage.ts Disk-backed Storage implementation for Proactive subsystem restart resilience
scenarios/career-coach/src/quiz-cache.ts In-memory cache of generated quiz questions/answer keys for deterministic grading
scenarios/career-coach/src/token-cache.ts Custom in-memory token cache + token resolver for observability exporter
scenarios/career-coach/src/scripts/setup-sharepoint.ts Script: idempotent provisioning of SharePoint lists + columns
scenarios/career-coach/src/scripts/seed-reference-data.ts Script: seed reference lists from CSVs
scenarios/career-coach/src/scripts/mark-courses-complete.ts Script: simulate portal completions by inserting LearningPortalStatus rows
scenarios/career-coach/src/scripts/reset-milestones.ts Script: reset milestone guards for re-demos
scenarios/career-coach/src/scripts/backup-and-reset-user.ts Script: snapshot + delete a user’s rows across write-lists
scenarios/career-coach/src/scripts/clear-list.ts Script: delete all rows from a specified list

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +1 to +5
// ------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// ------------------------------------------------------------------------------


scopes: getObservabilityAuthenticationScope()
});

console.log(`Preloaded Observability token for agentId=${agentId}, tenantId=${tenantId} token=${aauToken?.token?.substring(0, 10)}...`);
Comment on lines +16 to +23
},
{
"mcpServerName": "mcp_SharePointRemoteServer",
"mcpServerUniqueName": "mcp_SharePointRemoteServer",
"url": "https://agent365.svc.cloud.microsoft/agents/servers/mcp_SharePointRemoteServer",
"scope": "Tools.ListInvoke.All",
"audience": "292cff14-c0e8-4116-9e3b-99934ae05766"
}
Comment on lines +1 to +4
// Career Coach data types
// These types define the structure of data in SharePoint Lists
// accessed via the SharePoint MCP Server

},
"devDependencies": {
"@microsoft/m365agentsplayground": "^0.2.18",
"@types/express": "^4.17.21",
Comment on lines +1 to +5
# OpenAI Sample Agent Design (Node.js/TypeScript)

## Overview

This sample demonstrates an agent built using the official OpenAI Agents SDK for Node.js. It showcases TypeScript patterns, MCP server integration, notification handling, and Microsoft Agent 365 observability.
Comment on lines +15 to +26
## File Structure and Organization

```
sample-agent/
├── src/
│ ├── agent.ts # Main agent implementation (~60 lines)
│ ├── client.ts # OpenAI client wrapper with observability
│ └── index.ts # Express server entry point
├── ToolingManifest.json # MCP tools definition
├── package.json # Dependencies and scripts
└── .env # Configuration (not committed)
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants