Microsoft 365 agents toolkit

From OfficeDev/microsoft-365-agents-toolkit · View interactive version

Microsoft 365 agents toolkit is an AI agent skill from the GitHub repository OfficeDev/microsoft-365-agents-toolkit. Builds, tests, and deploys Microsoft 365 apps and agents for Teams and Copilot. Delegates all Declarative Agent workflows to the WIQD plugin except TypeSpec DA projects, which use ATK. Uses ATK for Custom Engine Agents, Teams bots, tabs, message extensions, Agents Playground, and Teams runtime testi

How to use this skill

Skill file

Microsoft 365 Agents Toolkit Skill

Delegate every Declarative Agent workflow to the wiqd plugin except TypeSpec DA projects. Use ATK for TypeSpec DAs, non-DA Teams apps, code-based agents, and runtime testing.

Declarative Agent Routing

Treat a request or project as a DA when the user explicitly says Declarative Agent, appPackage/declarativeAgent.json exists, or appPackage/manifest.json contains copilotAgents.declarativeAgents. The presence of m365agents.yml does not override these markers.

Existing DA pre-delegation gate: Before invoking any skill for an existing DA lifecycle request, inspect m365agents.yml, m365agents.local.yml, tspconfig.yaml, and .tsp sources for the TypeSpec markers below. If any marker is present, use ATK and never invoke WIQD. Invoke WIQD only after this inspection rules out a TypeSpec DA.

Route a DA to ATK only when the request explicitly identifies the declarative-agent-typespec capability or the project contains a TypeSpec DA marker: a typeSpec/compile lifecycle action, a tspconfig.yaml entry for @microsoft/typespec-m365-copilot, or a .tsp source importing @microsoft/typespec-m365-copilot. Invoke the wiqd plugin for every other DA, including DAs that need a new Azure-hosted API backend, contain backend source or deployment actions, attach existing OpenAPI or remote MCP services, or use Copilot Connector capabilities. The presence of src/functions, package.json, m365agents.yml, infrastructure files, a DA action, or an API plugin does not select ATK.

Once a DA is routed to WIQD, confirm that the wiqd skill is available in the current Copilot session. If it is missing, follow the installation preflight in toolkit/declarative-agent-lifecycle.md; do not assume that the plugin is already installed or fall back to ATK.

When the skill is available, invoke it and let that plugin own the complete workflow, including coordination with Azure and Entra skills for new backends, discovery, prerequisites, authentication, EULA handling, command selection, file-based fallback, validation, and error recovery. Do not run wiqd commands directly or duplicate WIQD operational guidance in this skill.

Answer read-only DA schema, manifest, capability, example, and project-structure questions from local references without invoking the WIQD plugin.

AI Behavior Guidelines

  1. Testing Strategy: Test Declarative Agents in Microsoft 365 Copilot. For code-based agents and Teams apps, recommend Agents Playground first (faster, no M365 needed) and use the Teams workflow only if the user explicitly requests it.
  1. Environment Variables: NEVER hardcode secrets or make up placeholder values. Always ask users for real values.
  1. Error Handling: Read error messages carefully. Check env/.env.local, .localConfigs, and atk auth list. Common pitfalls:
  1. Long-Running Commands — WAIT for completion:
  1. Local Service Startup — Hangs terminal (expected):
  1. Monitor App Logs: Periodically check background terminal output for runtime errors. If the app crashes, read the error, fix the root cause, and restart.
  1. Telemetry Tagging: Before running any atk CLI commands, set the session environment variable so all CLI invocations are tagged as skill-initiated:

```bash

export ATK_CLI_SKILL=true

```

Run this once at the start of the session. All subsequent atk commands in the same terminal will inherit it.

ATK CLI Setup

atk --version  # Must be > 1.1.5-beta

If ATK is not found or version is too old:

npm i -g @microsoft/m365agentstoolkit-cli@beta

CLI Global Options

| Option | Meaning | Recommendation |

| ------ | ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

| -i | Interactive mode | Always use -i false in automation to avoid hanging |

| -f | Project folder | Default to be current directory, used when specifying a custom folder. When scaffolding a new project, this is the parent folder where the project folder will be created under. |

| -h | Command help | Use atk <command> -h for quick syntax checks |

Sub-Skills

| Sub-Skill | When to Use | Reference |

| -------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- |

| create-project | Scaffold new project from template, choose template, atk new | create-project/create-project.md |

| test-playground | Test locally with Agents Playground, agentsplayground, quick testing | test-playground/test-playground.md |

| test-teams | Run on Teams, devtunnel, sideload, Teams testing, test in Copilot | test-teams/test-teams.md |

| provision-deploy | Provision Azure resources, deploy to cloud, atk provision, atk deploy | provision-deploy/provision-deploy.md |

| troubleshoot | Fix errors, 401, port conflicts, YAML errors, stale bots | troubleshoot/troubleshoot.md |

| slack-to-teams | Migrate Slack bot to Teams, cross-platform bridging, Block Kit to Adaptive Cards | slack-to-teams/SKILL.md |

MANDATORY: Before executing any workflow, read the corresponding sub-skill document.

Shared References

Workflow Chains

Match user intent to the smallest valid workflow.

| User Intent | Workflow (read in order) |

| ---------------------------------------------------------------------------------------------- | ------------------------------------------------------------------- |

| Build any non-TypeSpec DA, including one that needs a new backend | create-project (WIQD plugin) → test-teams (M365 Copilot) |

| Build a TypeSpec DA | create-project (ATK) → follow generated ATK lifecycle |

| Build a code-based agent or Teams app from scratch | create-project → test-playground |

| Test existing project locally | test-playground (recommended) or test-teams |

| Deploy to Azure | provision-deploy |

| Fix broken bot | troubleshoot → re-test |

| Migrate Slack bot to Teams | slack-to-teams |

MANDATORY: Before executing any slack-to-teams workflow, read slack-to-teams/SKILL.md first. The sub-skill contains a routed expert system with 100+ micro-expert files for cross-platform bot development.

ATK Project Context Resolution

Resolve config values only when missing. If a value is already known in the session, reuse it.

Step 1: Detect ATK Project

Check the Declarative Agent markers above first. If none match and m365agents*.yml exists in the current folder, treat it as an ATK project and parse configuration.

Step 2: Resolve Common Configuration

Resolve variables referenced in m365agents*.yml. Common variables:

AZURE_OPENAI_API_KEY

AZURE_OPENAI_ENDPOINT

AZURE_OPENAI_DEPLOYMENT_NAME

Step 3: Collect Missing Values

If required values are missing, ask the user for only the missing ones.

Refer to manifest-and-yaml.md for full config-file details.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.