How to Build AI Agents in Microsoft 365: 3 Ways Compared
By Mirko Peters · · Updated
How to build AI agents in Microsoft 365: Agent Builder, Copilot Studio or pro code with Foundry and the Agents SDK, compared by cost, hosting and governance.
How to build AI agents in Microsoft 365 comes down to three paths: Agent Builder (no code), Copilot Studio (low code) and a pro-code route with Microsoft Foundry, the Microsoft 365 Agents SDK and the Agents Toolkit. The detailed choice between the first two is in Copilot Agent Builder vs Copilot Studio.
Key points
- A chatbot answers inside a conversation. An agent combines knowledge with actions, triggers and workflows that change things in other systems.
- Agent Builder configures declarative agents in plain language. It runs on Copilot's model and orchestrator and cannot author actions against external services.
- Copilot Studio is the low-code studio for connectors, workflows, topics, external channels and separate environments. Its harness affects capabilities and billing.
- Pro code uses Foundry, the Agents SDK and Agents Toolkit for your own model and orchestration; the Toolkit also builds declarative agents with API plugins.
- Declarative agents inherit Microsoft 365 compliance and security. With custom engine agents, compliance, hosting and cost become your job.
- Start with the simplest path that meets the scenario. An Agent Builder agent can be copied to Copilot Studio later as a separate snapshot, not a synchronized upgrade.
AI agent vs chatbot
A chatbot waits for a question and answers inside the conversation. Microsoft Learn describes agents as specialized assistants with two building blocks: knowledge (instructions and data sources) and actions (actions, triggers and workflows that automate business processes). If the idea only needs answers from documents, it's a grounded Q&A assistant, which is the cheapest case.
Declarative vs custom engine agents
Pick the agent type before the tool. Learn defines two:
- Declarative agents use Copilot's orchestrator and foundation models. No additional hosting is required, and they inherit Microsoft 365 compliance, Responsible AI and security standards. They rely on user-initiated interactions.
- Custom engine agents bring their own orchestration and AI models. They can trigger actions without direct user input. They need hosting outside Microsoft 365, typically on Azure at extra cost, and compliance and security are on you.
My rule of thumb: every step from declarative to custom engine moves work from Microsoft to your team. Take that step only for a requirement you can name.
Path 1: Agent Builder (no code)
Agent Builder lives inside Microsoft 365 Copilot on the web and in the Teams desktop and web clients, not on mobile. You describe the agent in natural language, add knowledge such as SharePoint content and Copilot connectors, test it and share it. The result is a declarative agent.
Learn states the limits: Agent Builder cannot author actions that integrate external services, Customer Managed Keys aren't supported, and its agents can't be used in Teams group or 1:1 chats.
Path 2: Copilot Studio (low code)
Copilot Studio is a separate web app at copilotstudio.microsoft.com. You get prebuilt and custom connectors, topics (designed conversation paths), agent flows and analytics. Agents can reach employees and customers across Teams, Microsoft Copilot, websites, mobile apps and other channels. Some agents can get their own account to work proactively on tasks.
Copilot Studio uses three harnesses: the Microsoft Copilot harness for reasoning-heavy, multi-step work, the Customer Conversation harness for customer service over voice and chat, and the standard harness for rule-based, structured conversations. The harness affects capabilities and billing.
Billing runs on Copilot Credits, which replaced messages on September 1, 2025. You pay through prepaid packs, pay-as-you-go via an Azure subscription, or a one-year prepurchase plan. For agents on the standard harness there's an exception: for Microsoft 365 Copilot license holders, classic answers, generative answers and Graph grounding in Copilot Chat, Teams or SharePoint aren't charged when the agent runs with the user's identity.
Path 3: Foundry, Agents SDK and Agents Toolkit (pro code)
- Microsoft Foundry Agent Service is a managed platform for building, deploying and scaling agents. It offers prompt agents, voice-based prompt agents and hosted agents built with Agent Framework, LangGraph, the OpenAI or Anthropic agent SDKs or your own code. You pick models from the Foundry catalog, add tools such as web search, file search, code interpreter, OpenAPI and MCP servers, and each agent can get a dedicated Microsoft Entra identity. Direct publishing to Microsoft 365 Copilot and Teams handles the bot registration without a separate Azure Bot Service resource and uses a generated Entra application.
- Microsoft 365 Agents SDK is the plumbing between a channel and your logic. It supports C#, JavaScript and Python, and it's AI-agnostic: you plug in the model and orchestration you want. Learn names Teams, Microsoft Copilot, a company website, Slack and Facebook Messenger as channels.
- Microsoft 365 Agents Toolkit is a free Visual Studio Code extension with templates for scaffolding, debugging and deployment. It also builds declarative agents with API plugin actions in pro code.
Foundry bills per call for inference and tools, hosted agents add container compute, and voice agents add speech and telephony charges. See the Foundry portal walkthrough.
How to build AI agents in Microsoft 365: comparison
| Area | Agent Builder | Copilot Studio | Foundry + Agents SDK + Toolkit |
|---|---|---|---|
| Who builds | Business users, no code | Makers and IT, low code | Developers, pro code |
| Agent type | Declarative | Declarative or custom engine | Mostly custom engine (Toolkit also builds declarative) |
| Model and orchestration | Copilot's | Managed by the selected harness | Your choice |
| Hosting | None needed | Managed SaaS | Foundry-managed or your own Azure hosting |
| Licensing and billing | Depends on tenant licenses | Copilot Credits, harness-dependent | Azure consumption: inference, tools, compute |
| Knowledge | Microsoft 365 content, Copilot connectors, web | Connected knowledge sources and connectors | Any source you wire up, e.g. file search |
| Actions | No external-service actions | Connectors, tools, workflows | Functions, OpenAPI, MCP, your code |
| Governance | Microsoft 365 agent controls, data-source permissions | Power Platform environment and connector controls plus Microsoft 365 controls | Entra identity, RBAC, network isolation, your own compliance |
| Publishing | Share in the org, org catalog | Teams, Microsoft Copilot, websites, mobile and more | Microsoft 365 Copilot, Teams; other channels via the SDK |
Decision guide
Answer in order and stop at the first yes:
- Do you need your own model, your own orchestration or multi-agent logic in code? Go pro code. Plan hosting and compliance first.
- Do you need an external channel, actions against external systems, workflows or separate dev, test and production environments? Use Copilot Studio and choose the harness first. Copilot Studio ALM covers the environment part.
- Do instructions plus Microsoft 365 knowledge cover the scenario? Use Agent Builder.
My recommendation: prototype in Agent Builder even if you expect to need more. You learn quickly whether the knowledge is good enough, and you can copy the agent to Copilot Studio later. The copy is a separate snapshot, and some knowledge sources and capabilities need reconfiguration.
Common pitfalls
- Picking the Copilot Studio harness after the design.
- Treating license checks as one question. Learn says to confirm maker access separately from end-user access and consumption.
- Ignoring identity. An agent with its own account or Entra identity needs an owner and a permissions review.
- Expecting Agent Builder's SharePoint auto-sharing to reach everyone. It works only with specific security groups.
Related
Sources
- Agents for Microsoft 365 Copilot overview (Microsoft Learn)
- Custom engine agents overview (Microsoft Learn)
- Agent Builder overview (Microsoft Learn)
- Choose between Agent Builder and Copilot Studio (Microsoft Learn)
- What is Copilot Studio? (Microsoft Learn)
- Standard harness licensing: Copilot Studio (Microsoft Learn)
- What is Microsoft Foundry Agent Service? (Microsoft Learn)
- Microsoft 365 Agents SDK overview (Microsoft Learn)
- Microsoft 365 Agents Toolkit overview (Microsoft Learn)
- Build API plugins with a new API (Microsoft Learn)
- Publish agents to Microsoft Copilot and Microsoft Teams (Microsoft Learn)
FAQ
What are the three ways to build AI agents in Microsoft 365?
Agent Builder inside Microsoft 365 Copilot for no-code declarative agents, Copilot Studio for low-code agents with connectors and workflows, and a pro-code route with Microsoft Foundry, the Microsoft 365 Agents SDK and the Microsoft 365 Agents Toolkit, mainly for custom engine agents.
What is the difference between an AI agent and a chatbot?
A chatbot reacts to questions within one conversation. Microsoft Learn describes agents as specialized assistants built from knowledge plus actions, triggers and workflows that automate business processes. Custom engine agents can also act proactively without direct user input.
Do declarative agents need their own hosting?
No. Declarative agents use Copilot's orchestrator and foundation models, so no additional hosting is required. Custom engine agents need hosting outside Microsoft 365, typically on Azure, at additional cost.
How is Copilot Studio billed?
In Copilot Credits, through prepaid packs, pay-as-you-go via an Azure subscription, or a prepurchase plan. On the standard harness, for Microsoft 365 Copilot license holders, classic answers, generative answers and Graph grounding in Copilot Chat, Teams or SharePoint aren't charged when the agent runs with the user's identity.
Which languages does the Microsoft 365 Agents SDK support?
C# on .NET 8.0, JavaScript on Node.js 18 and later, and Python 3.9 to 3.11. The SDK is AI-agnostic: you plug in the AI services and orchestration libraries you prefer.