{"id":"4eab1354-a76a-49a8-b791-fdc6a49aec95","shortId":"UykFWA","kind":"skill","title":"m365-agents-ts","tagline":"Microsoft 365 Agents SDK for TypeScript/Node.js.","description":"# 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/agents-hosting @microsoft/agents-hosting-express @microsoft/agents-activity\nnpm install @microsoft/agents-copilotstudio-client\n```\n\n## Environment Variables\n\n```bash\nPORT=3978\nAZURE_RESOURCE_NAME=<azure-openai-resource>\nAZURE_API_KEY=<azure-openai-key>\nAZURE_OPENAI_DEPLOYMENT_NAME=gpt-4o-mini\n\nTENANT_ID=<tenant-id>\nCLIENT_ID=<client-id>\nCLIENT_SECRET=<client-secret>\n\nCOPILOT_ENVIRONMENT_ID=<environment-id>\nCOPILOT_SCHEMA_NAME=<schema-name>\nCOPILOT_CLIENT_ID=<copilot-app-client-id>\nCOPILOT_BEARER_TOKEN=<copilot-jwt>\n```\n\n## Core Workflow: Express-hosted AgentApplication\n\n```typescript\nimport { AgentApplication, TurnContext, TurnState } from \"@microsoft/agents-hosting\";\nimport { startServer } from \"@microsoft/agents-hosting-express\";\n\nconst agent = new AgentApplication<TurnState>();\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/azure\";\nimport { AgentApplication, TurnContext, TurnState } from \"@microsoft/agents-hosting\";\nimport { startServer } from \"@microsoft/agents-hosting-express\";\nimport { streamText } from \"ai\";\n\nconst agent = new AgentApplication<TurnState>();\n\nagent.onMessage(\"poem\", async (context: TurnContext) => {\n  context.streamingResponse.setFeedbackLoop(true);\n  context.streamingResponse.setGeneratedByAILabel(true);\n  context.streamingResponse.setSensitivityLabel({\n    type: \"https://schema.org/Message\",\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/agents-activity\";\nimport { AgentApplication, TurnContext, TurnState } from \"@microsoft/agents-hosting\";\n\nconst agent = new AgentApplication<TurnState>();\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/agents-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<string> => {\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/agents-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/acceptance-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://learn.microsoft.com/en-us/microsoft-365/agents-sdk/ |\n| JavaScript SDK overview | https://learn.microsoft.com/en-us/javascript/api/overview/agents-overview?view=agents-sdk-js-latest |\n| @microsoft/agents-hosting-express | https://learn.microsoft.com/en-us/javascript/api/%40microsoft/agents-hosting-express?view=agents-sdk-js-latest |\n| @microsoft/agents-copilotstudio-client | https://learn.microsoft.com/en-us/javascript/api/%40microsoft/agents-copilotstudio-client?view=agents-sdk-js-latest |\n| Integrate with Copilot Studio | https://learn.microsoft.com/en-us/microsoft-365/agents-sdk/integrate-with-mcs |\n| GitHub samples | https://github.com/microsoft/Agents/tree/main/samples/nodejs |\n\n## When to Use\nThis skill is applicable to execute the workflow or actions described in the overview.\n\n## Limitations\n- Use this skill only when the task clearly matches the scope described above.\n- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.\n- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.","tags":["m365","agents","antigravity","awesome","skills","sickn33","agent-skills","agentic-skills","ai-agent-skills","ai-agents","ai-coding","ai-workflows"],"capabilities":["skill","source-sickn33","skill-m365-agents-ts","topic-agent-skills","topic-agentic-skills","topic-ai-agent-skills","topic-ai-agents","topic-ai-coding","topic-ai-workflows","topic-antigravity","topic-antigravity-skills","topic-claude-code","topic-claude-code-skills","topic-codex-cli","topic-codex-skills"],"categories":["antigravity-awesome-skills"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/sickn33/antigravity-awesome-skills/m365-agents-ts","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add sickn33/antigravity-awesome-skills","source_repo":"https://github.com/sickn33/antigravity-awesome-skills","install_from":"skills.sh"}},"qualityScore":"0.700","qualityRationale":"deterministic score 0.70 from registry signals: · indexed on github topic:agent-skills · 34726 github stars · SKILL.md body (6,253 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-04-23T12:51:11.686Z","embedding":null,"createdAt":"2026-04-18T21:40:15.047Z","updatedAt":"2026-04-23T12:51:11.686Z","lastSeenAt":"2026-04-23T12:51:11.686Z","tsv":"'/azure':176 '/en-us/javascript/api/%40microsoft/agents-copilotstudio-client?view=agents-sdk-js-latest':487 '/en-us/javascript/api/%40microsoft/agents-hosting-express?view=agents-sdk-js-latest':483 '/en-us/javascript/api/overview/agents-overview?view=agents-sdk-js-latest':479 '/en-us/microsoft-365/agents-sdk/':473 '/en-us/microsoft-365/agents-sdk/integrate-with-mcs':494 '/message':208 '/microsoft/agents/tree/main/samples/nodejs':499 '0':256 '1':388 '2':400 '200':305 '3':414 '365':6,12,21,29,468 '3978':88 '4':429 '4o':101,229 '5':440 'action':512 'activ':275,279 'activity.fromobject':300 'activitytyp':280 'activitytypes.invokeresponse':302 'agent':3,7,13,18,30,139,152,163,192,273,290,469 'agent.onactivity':293 'agent.onconversationupdate':142 'agent.onmessage':153,195 'agentappl':35,59,126,129,141,178,194,284,292,390 'ai':174,190 'ai-sdk':173 'api':56,93 'apollo':242 'applic':506 'ask':550 'assist':236 'async':144,155,197,295,343 'await':147,158,213,245,257,270,306,309,357,361 'azur':89,92,95,167,171,222 'bash':75,86 'bearer':119,347 'best':386 'block':413 'boundari':558 'build':16 'cach':434 'call':409 'clarif':552 'clear':525 'client':42,105,107,116,318,339,350,379 'client.askquestionasync':362 'client.startconversationasync':358 'clientid':337 'code':420 'complet':407 'confirm':63 'console.log':365 'const':138,191,218,246,289,298,327,341,349,355,359,376 'content':452 'context':145,156,198,296 'context.activity.text':161 'context.sendactivity':148,159,307,310 'context.streamingresponse.endstream':271 'context.streamingresponse.queueinformativeupdate':214 'context.streamingresponse.queuetextchunk':258 'context.streamingresponse.setfeedbackloop':200 'context.streamingresponse.setgeneratedbyailabel':202 'context.streamingresponse.setsensitivitylabel':204 'convers':356 'conversation.id':364 'copilot':24,40,109,112,115,118,316,367,460,490 'copilotstudiocli':62,324,352,431 'copilotstudiowebchat':373 'copilotstudiowebchat.createconnection':378 'core':121 'creativ':235 'creativework':210 'criteria':561 'delta':254 'deploy':97,225 'describ':513,529 'direct':319 'directlin':377,383 'doc':50 'document.getelementbyid':384 'echo':160 'endstream':410 'engin':321 'enterpris':17 'environ':84,110,331,424,541 'environment-specif':540 'environmentid':329 'error':262,265,267 'execut':508 'expert':546 'express':33,124 'express-host':123 'feedback':315,448 'file':450,451 'final':269,412 'focus':396 'fullstream':219,249 'github':495 'github.com':498 'github.com/microsoft/agents/tree/main/samples/nodejs':497 'gpt':100,228 'gpt-4o-mini':99,227 'handl':276 'handler':395 'hello':154,363 'host':34,125,456 'id':104,106,111,117,332,340 'implement':45 'import':128,134,170,177,183,187,278,283,323,372,454 'input':555 'instal':74,77,82 'instanc':432 'integr':43,370,488 'intern':212 'invok':274,294,442 'invokerespons':299,308 'javascript':474 'keep':394,415 'key':94 'latest':55 'learn.microsoft.com':472,478,482,486,493 'learn.microsoft.com/en-us/javascript/api/%40microsoft/agents-copilotstudio-client?view=agents-sdk-js-latest':485 'learn.microsoft.com/en-us/javascript/api/%40microsoft/agents-hosting-express?view=agents-sdk-js-latest':481 'learn.microsoft.com/en-us/javascript/api/overview/agents-overview?view=agents-sdk-js-latest':477 'learn.microsoft.com/en-us/microsoft-365/agents-sdk/':471 'learn.microsoft.com/en-us/microsoft-365/agents-sdk/integrate-with-mcs':492 'limit':517 'link':464 'load':421 'log':445 'long':405 'long-run':404 'm365':2 'm365-agents-ts':1 'match':526 'mcp':51 'membersad':143 'microsoft':5,11,20,28,49,467 'microsoft-doc':48 'microsoft/agents-activity':80,282 'microsoft/agents-copilotstudio-client':83,326,375,484 'microsoft/agents-hosting':78,133,182,288 'microsoft/agents-hosting-express':79,137,186,480 'mini':102,230 'miss':563 'model':221 'name':91,98,114,211,226,336 'new':140,193,264,291,351 'npm':67,76,81 'one':398 'openai':96,168,224 'output':535 'overview':476,516 'packag':64 'part':247 'part.error':268 'part.text':259 'part.text.length':255 'part.type':251,261 'path':455 'pattern':462 'payload':443 'permiss':556 'persist':447 'pipelin':457 'poem':196,217,240 'port':87 'practic':387 'prefer':401 'process.env.azure':223 'process.env.copilot':330,334,338,346 'promis':344 'prompt':237 'provid':439 'refer':449,463 'references/acceptance-criteria.md':453 'repli':360,366 'requir':554 'resourc':90,465 'respons':38,165,399 'return':345 'reus':430 'review':547 'rout':36,392 'run':406 'safeti':557 'sampl':71,496 'schema':113,335 'schema.org':207 'schema.org/message':206 'schemanam':333 'scope':528 'sdk':8,14,31,175,470,475 'secret':108,416 'secur':427 'set':328,353 'showtyp':380 'signatur':57 'skill':504,520 'skill-m365-agents-ts' 'sourc':419 'source-sickn33' 'specif':542 'start':215 'startserv':60,135,162,184,272 'status':304 'stop':548 'store':428 'stream':37,164,266,458 'streamingrespons':402 'streamtext':188,220 'studio':25,41,317,368,461,491 'submit':313 'substitut':538 'success':560 'system':231 'task':524 'team':22 'templat':73 'tenant':103 'test':544 'text':253 'text-delta':252 'thank':311 'throw':263 'token':120,348,422,435,438 'tokenprovid':342,354 'topic-agent-skills' 'topic-agentic-skills' 'topic-ai-agent-skills' 'topic-ai-agents' 'topic-ai-coding' 'topic-ai-workflows' 'topic-antigravity' 'topic-antigravity-skills' 'topic-claude-code' 'topic-claude-code-skills' 'topic-codex-cli' 'topic-codex-skills' 'treat':533 'tri':243 'true':201,203,381 'ts':4 'turncontext':130,146,157,179,199,285,297 'turnstat':131,180,286 'type':205,209,301 'typescript':15,127,169,277,322,371 'typescript/node.js':10 'url':466 'use':26,46,389,502,518 'valid':441,543 'valu':303 'variabl':85,425 'verifi':53 'version':65 'webchat':369,385 'welcom':149 'window.webchat.renderwebchat':382 'wire':69 'workflow':122,510 'write':238","prices":[{"id":"cd7dda46-a627-48c6-b9eb-6a8bcfa50a5c","listingId":"4eab1354-a76a-49a8-b791-fdc6a49aec95","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"sickn33","category":"antigravity-awesome-skills","install_from":"skills.sh"},"createdAt":"2026-04-18T21:40:15.047Z"}],"sources":[{"listingId":"4eab1354-a76a-49a8-b791-fdc6a49aec95","source":"github","sourceId":"sickn33/antigravity-awesome-skills/m365-agents-ts","sourceUrl":"https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/m365-agents-ts","isPrimary":false,"firstSeenAt":"2026-04-18T21:40:15.047Z","lastSeenAt":"2026-04-23T12:51:11.686Z"}],"details":{"listingId":"4eab1354-a76a-49a8-b791-fdc6a49aec95","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"sickn33","slug":"m365-agents-ts","github":{"repo":"sickn33/antigravity-awesome-skills","stars":34726,"topics":["agent-skills","agentic-skills","ai-agent-skills","ai-agents","ai-coding","ai-workflows","antigravity","antigravity-skills","claude-code","claude-code-skills","codex-cli","codex-skills","cursor","cursor-skills","developer-tools","gemini-cli","gemini-skills","kiro","mcp","skill-library"],"license":"mit","html_url":"https://github.com/sickn33/antigravity-awesome-skills","pushed_at":"2026-04-23T06:41:03Z","description":"Installable GitHub library of 1,400+ agentic skills for Claude Code, Cursor, Codex CLI, Gemini CLI, Antigravity, and more. Includes installer CLI, bundles, workflows, and official/community skill collections.","skill_md_sha":"90a601e8cdf5c7d21571b97caf6288ab476818e3","skill_md_path":"skills/m365-agents-ts/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/m365-agents-ts"},"layout":"multi","source":"github","category":"antigravity-awesome-skills","frontmatter":{"name":"m365-agents-ts","description":"Microsoft 365 Agents SDK for TypeScript/Node.js."},"skills_sh_url":"https://skills.sh/sickn33/antigravity-awesome-skills/m365-agents-ts"},"updatedAt":"2026-04-23T12:51:11.686Z"}}