m365-agents-py
Skill by lingxling
Guides developers building Python agents for Microsoft 365, Teams and Copilot Studio with the Microsoft Agents SDK. Covers aiohttp hosting, AgentApplication routing, streaming responses and MSAL-based authentication.
Install m365-agents-py
Built from the published package, never by AI.
git clone --depth 1 https://github.com/lingxling/awesome-skills-cn /tmp/awesome-skills-cn && mkdir -p ~/.claude/skills && cp -r /tmp/awesome-skills-cn/antigravity-awesome-skills/skills/m365-agents-py ~/.claude/skills/m365-agents-pyRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/lingxling/awesome-skills-cn /tmp/awesome-skills-cn && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/awesome-skills-cn/antigravity-awesome-skills/skills/m365-agents-py ~/.gemini/antigravity-cli/skills/m365-agents-pyAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Skills can run scripts on your machine. Some need an API key: check the README.
About
The m365-agents-py skill gives guidance for building Microsoft 365 agents in Python with the Microsoft Agents SDK. It targets agents for Teams, Microsoft 365 and Copilot Studio. The source shows aiohttp hosting with a /api/messages route, AgentApplication routing for messages, conversation updates and invoke activities, and streaming responses from Azure OpenAI. It also covers MSAL-based authentication and OAuth sign-in for Microsoft Graph.
The skill lists pip packages, a .env configuration layout and code samples for each part. It includes a Copilot Studio client sample that connects directly to the agent engine. The source notes that the import prefix changed from microsoft.agents to microsoft_agents. It is aimed at developers building enterprise agents on Microsoft 365.
Written from the project's SKILL.md and checked against it.
What it can do
- aiohttp hostingHosts the agent on an aiohttp server with a /api/messages route and JWT authorization middleware.
- AgentApplication routingRoutes incoming activities to handlers for messages, regex patterns, invokes and conversation updates.
- Streaming responsesStreams Azure OpenAI output into agent replies, with feedback and AI-generated labels.
- MSAL authenticationConfigures MSAL-based connection management from environment variables.
- OAuth sign-inProtects message routes with auth handlers and gets or signs out Microsoft Graph tokens.
- Copilot Studio clientShows how to start a conversation and ask questions directly to a Copilot Studio agent.
What you need
- Python with pip
- Client ID, client secret and tenant ID for the agent connection
- Azure OpenAI endpoint, API version and key for streaming (optional)
- Copilot Studio environment ID, schema name, tenant ID and app ID for the client (optional)
Try asking
- Set up an aiohttp agent that echoes messages back to the user in Teams.
- Add a /me route that calls Microsoft Graph after OAuth sign-in.
- Write a streaming handler that returns a poem from Azure OpenAI.
Good to know
- The source marks the import path change to microsoft_agents as a breaking change.
- The source says MemoryStorage is for development only and recommends BlobStorage or CosmosDB in production.
- The source asks users to verify current API signatures and package versions before implementation.
- The skill's metadata lists its risk level as critical.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: antigravity-awesome-skills/skills/m365-agents-py/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Alternatives to m365-agents-py
All alternatives →Runs a 7-stage workflow for auditing, cleaning up and reviewing GitHub repositories, plus competitor analysis. Written for developers who want a repo checked for secrets, junk files and documentation gaps.
Teaches an AI assistant to build, debug and explain Gradio web UIs and ML demos in Python. It covers the core API, components, event listeners, layouts and the MCP server option. Aimed at Python developers who work with Gradio.
Recommends menus, buttons, toolbars and disclosure controls for Apple platforms using Human Interface Guidelines conventions. Built for developers and designers making iOS, iPadOS, macOS or visionOS interfaces. Checks existing project design context before asking questions.
Creates production-ready FastAPI project structures with async patterns, dependency injection, and error handling. It is for developers starting new FastAPI applications or backend API projects.
Analyzes Android apps to find user workflows to expose as AppFunctions, so AI agents and system shortcuts can run them without opening the app UI. Generates Kotlin code and refines KDoc for Android developers.
Creates, edits, validates and runs Agent QA tests, suites and hooks through MCP or CLI. It keeps canonical IDs and schema contracts intact, for developers and QA teams using Agent QA.
Compare with openclaw-github-repo-commander, gradio or hig-components-menus
m365-agents-py: common questions
Which Python import path should I use?
The source says to use the microsoft_agents prefix with underscores, not microsoft.agents, because recent updates changed the structure.
Which storage should I use in production?
The source says MemoryStorage is only for development. It recommends BlobStorage or CosmosDB for production.
Does this skill cover Copilot Studio?
Yes. The source includes a Copilot Studio client sample that connects directly to the engine, along with environment variables for its settings.
How do I install m365-agents-py?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is m365-agents-py free?
The code is published under the MIT licence. The service it connects to may have its own pricing.
Is m365-agents-py safe to use?
It scores 72 of 100. Grades: maintenance B, licence A, quality B. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to m365-agents-py?
Similar skills: openclaw-github-repo-commander, gradio, hig-components-menus, fastapi-templates.
