[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6FDC845VXP5RTYRGF72SJYG":3,"skill-same:01M6FDC845VXP5RTYRGF72SJYG":47},{"skillNo":4,"name":5,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":20,"linkOnly":21,"markdownContent":22,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":29,"ownerHtmlUrl":30,"ownerBlogUrl":6,"ownerDescription":31,"updatedAt":32,"install":33,"resources":46},"01M6FDC845VXP5RTYRGF72SJYG","m365-agents-ts",null,"ComeOnOliver\u002Fskillshub","ComeOnOliver","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F43215937?v=4","01M6E5JNFECJAAVFE0W7SMWWD2","Haoran Shu","01M6E5JNNDQS7AJZDYFQ8TPZCK",67,"MIT","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fmicrosoft\u002Fskills\u002Fm365-agents-ts\u002FSKILL.md",[],[18,19],"m365 agents ts","m365","2026-11-10 10:12:30",false,"# Microsoft 365 Agents SDK (TypeScript)\n\nBuild enterprise agents for Microsoft 365, Teams, and Copilot Studio using the Microsoft 365 Agents SDK with Express hosting, AgentApplication routing, streaming responses, and Copilot Studio client integrations.\n\n## Before implementation\n- Use the microsoft-docs MCP to verify the latest API signatures for AgentApplication, startServer, and CopilotStudioClient.\n- Confirm package versions on npm before wiring up samples or templates.\n\n## Installation\n\n```bash\nnpm install @microsoft\u002Fagents-hosting @microsoft\u002Fagents-hosting-express @microsoft\u002Fagents-activity\nnpm install @microsoft\u002Fagents-copilotstudio-client\n```\n\n## Environment Variables\n\n```bash\nPORT=3978\nAZURE_RESOURCE_NAME=\u003Cazure-openai-resource>\nAZURE_API_KEY=\u003Cazure-openai-key>\nAZURE_OPENAI_DEPLOYMENT_NAME=gpt-4o-mini\n\nTENANT_ID=\u003Ctenant-id>\nCLIENT_ID=\u003Cclient-id>\nCLIENT_SECRET=\u003Cclient-secret>\n\nCOPILOT_ENVIRONMENT_ID=\u003Cenvironment-id>\nCOPILOT_SCHEMA_NAME=\u003Cschema-name>\nCOPILOT_CLIENT_ID=\u003Ccopilot-app-client-id>\nCOPILOT_BEARER_TOKEN=\u003Ccopilot-jwt>\n```\n\n## Core Workflow: Express-hosted AgentApplication\n\n```typescript\nimport { AgentApplication, TurnContext, TurnState } from \"@microsoft\u002Fagents-hosting\";\nimport { startServer } from \"@microsoft\u002Fagents-hosting-express\";\n\nconst agent = new AgentApplication\u003CTurnState>();\n\nagent.onConversationUpdate(\"membersAdded\", async (context: TurnContext) => {\n  await context.sendActivity(\"Welcome to the agent.\");\n});\n\nagent.onMessage(\"hello\", async (context: TurnContext) => {\n  await context.sendActivity(`Echo: ${context.activity.text}`);\n});\n\nstartServer(agent);\n```\n\n## Streaming responses with Azure OpenAI\n\n```typescript\nimport { azure } from \"@ai-sdk\u002Fazure\";\nimport { AgentApplication, TurnContext, TurnState } from \"@microsoft\u002Fagents-hosting\";\nimport { startServer } from \"@microsoft\u002Fagents-hosting-express\";\nimport { streamText } from \"ai\";\n\nconst agent = new AgentApplication\u003CTurnState>();\n\nagent.onMessage(\"poem\", async (context: TurnContext) => {\n  context.streamingResponse.setFeedbackLoop(true);\n  context.streamingResponse.setGeneratedByAILabel(true);\n  context.streamingResponse.setSensitivityLabel({\n    type: \"https:\u002F\u002Fschema.org\u002FMessage\",\n    \"@type\": \"CreativeWork\",\n    name: \"Internal\",\n  });\n\n  await context.streamingResponse.queueInformativeUpdate(\"starting a poem...\");\n\n  const { fullStream } = streamText({\n    model: azure(process.env.AZURE_OPENAI_DEPLOYMENT_NAME || \"gpt-4o-mini\"),\n    system: \"You are a creative assistant.\",\n    prompt: \"Write a poem about Apollo.\",\n  });\n\n  try {\n    for await (const part of fullStream) {\n      if (part.type === \"text-delta\" && part.text.length > 0) {\n        await context.streamingResponse.queueTextChunk(part.text);\n      }\n      if (part.type === \"error\") {\n        throw new Error(`Streaming error: ${part.error}`);\n      }\n    }\n  } finally {\n    await context.streamingResponse.endStream();\n  }\n});\n\nstartServer(agent);\n```\n\n## Invoke activity handling\n\n```typescript\nimport { Activity, ActivityTypes } from \"@microsoft\u002Fagents-activity\";\nimport { AgentApplication, TurnContext, TurnState } from \"@microsoft\u002Fagents-hosting\";\n\nconst agent = new AgentApplication\u003CTurnState>();\n\nagent.onActivity(\"invoke\", async (context: TurnContext) => {\n  const invokeResponse = Activity.fromObject({\n    type: ActivityTypes.InvokeResponse,\n    value: { status: 200 },\n  });\n\n  await context.sendActivity(invokeResponse);\n  await context.sendActivity(\"Thanks for submitting your feedback.\");\n});\n```\n\n## Copilot Studio client (Direct to Engine)\n\n```typescript\nimport { CopilotStudioClient } from \"@microsoft\u002Fagents-copilotstudio-client\";\n\nconst settings = {\n  environmentId: process.env.COPILOT_ENVIRONMENT_ID!,\n  schemaName: process.env.COPILOT_SCHEMA_NAME!,\n  clientId: process.env.COPILOT_CLIENT_ID!,\n};\n\nconst tokenProvider = async (): Promise\u003Cstring> => {\n  return process.env.COPILOT_BEARER_TOKEN!;\n};\n\nconst client = new CopilotStudioClient(settings, tokenProvider);\n\nconst conversation = await client.startConversationAsync();\nconst reply = await client.askQuestionAsync(\"Hello!\", conversation.id);\nconsole.log(reply);\n```\n\n## Copilot Studio WebChat integration\n\n```typescript\nimport { CopilotStudioWebChat } from \"@microsoft\u002Fagents-copilotstudio-client\";\n\nconst directLine = CopilotStudioWebChat.createConnection(client, {\n  showTyping: true,\n});\n\nwindow.WebChat.renderWebChat({\n  directLine,\n}, document.getElementById(\"webchat\")!);\n```\n\n## Best Practices\n\n1. Use AgentApplication for routing and keep handlers focused on one responsibility.\n2. Prefer streamingResponse for long-running completions and call endStream in finally blocks.\n3. Keep secrets out of source code; load tokens from environment variables or secure stores.\n4. Reuse CopilotStudioClient instances and cache tokens in your token provider.\n5. Validate invoke payloads before logging or persisting feedback.\n\n## Reference Files\n\n| File | Contents |\n| --- | --- |\n| [references\u002Facceptance-criteria.md](references\u002Facceptance-criteria.md) | Import paths, hosting pipeline, streaming, and Copilot Studio patterns |\n\n## Reference Links\n\n| Resource | URL |\n| --- | --- |\n| Microsoft 365 Agents SDK | https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fmicrosoft-365\u002Fagents-sdk\u002F |\n| JavaScript SDK overview | https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fjavascript\u002Fapi\u002Foverview\u002Fagents-overview?view=agents-sdk-js-latest |\n| @microsoft\u002Fagents-hosting-express | https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fjavascript\u002Fapi\u002F%40microsoft\u002Fagents-hosting-express?view=agents-sdk-js-latest |\n| @microsoft\u002Fagents-copilotstudio-client | https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fjavascript\u002Fapi\u002F%40microsoft\u002Fagents-copilotstudio-client?view=agents-sdk-js-latest |\n| Integrate with Copilot Studio | https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fmicrosoft-365\u002Fagents-sdk\u002Fintegrate-with-mcs |\n| GitHub samples | https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002FAgents\u002Ftree\u002Fmain\u002Fsamples\u002Fnodejs |\n",{},"main","def8531e65114c0fca8fb8551c1871ee0eed705c","skills\u002Fmicrosoft\u002Fskills\u002Fm365-agents-ts",24,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub","https:\u002F\u002Fskillshub.wtf","https:\u002F\u002Fgithub.com\u002FComeOnOliver","AI & Blockchain Engineer\r\n","2026-06-24 22:07:19",{"source":7,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add ComeOnOliver\u002Fskillshub --skill m365-agents-ts",{"tool":39,"command":40},"bunx","bunx skills add ComeOnOliver\u002Fskillshub --skill m365-agents-ts",{"tool":42,"command":43},"pnpm","pnpm dlx skills add ComeOnOliver\u002Fskillshub --skill m365-agents-ts","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fmicrosoft\u002Fskills\u002Fm365-agents-ts\u002FSKILL.md",true,[],[48,62,72,81,87,94],{"skillNo":49,"name":50,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":51,"categories":52,"keywords":58,"publishedAt":20},"01M6FKJN13GMG4KY57J3QD8GY5","model-hierarchy-skill","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzscole\u002Fmodel-hierarchy-skill\u002Fmodel-hierarchy-skill\u002FSKILL.md",[53],{"categoryNo":54,"categoryName":55,"taxonomyType":56,"taxonomyTypeDesc":57},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",[59,60,61],"model","model hierarchy","model hierarchy skill",{"skillNo":63,"name":64,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":65,"categories":66,"keywords":68,"publishedAt":20},"01M6FKJJJ6GCAMR4PPPRD12M5X","zoom-mcp","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-mcp\u002FSKILL.md",[67],{"categoryNo":54,"categoryName":55,"taxonomyType":56,"taxonomyTypeDesc":57},[69,70,71],"MCP","zoom","zoom mcp",{"skillNo":73,"name":74,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":20},"01M6FKJE3KYT3KPEZMEEHYKA6K","zoom-apps-sdk","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-apps-sdk\u002FSKILL.md",[],[78,79,80,70],"sdk","zoom apps sdk","apps",{"skillNo":82,"name":83,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":20},"01M6FKJ9EDH9Q5VWDF8HAJRSP0","windows","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwindows\u002FSKILL.md",[],[83],{"skillNo":88,"name":89,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":93,"publishedAt":20},"01M6FKJ666BEEFC3AE9GJ72Q93","whiteboard","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwhiteboard\u002FSKILL.md",[92],{"categoryNo":54,"categoryName":55,"taxonomyType":56,"taxonomyTypeDesc":57},[89],{"skillNo":95,"name":96,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":97,"categories":98,"keywords":99,"publishedAt":20},"01M6FKJ21WFCDGTJQ2Q91T9DVW","websockets","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwebsockets\u002FSKILL.md",[],[96]]