Entry point: if __name__ == "__main__": asyncio.run(main())
External Dependencies
Use PEP 723 inline script metadata for
external packages not in the dev environment:
# /// script
# requires-python = ">=3.10"
# dependencies = [
# "some-external-package",
# ]
# ///
# Run with: uv run samples/path/to/script.py
# Copyright (c) Microsoft. All rights reserved.
Do not add sample-only dependencies to the root pyproject.toml dev group.
Syntax Checking
# Format + lint samples
uv run poe syntax -S
# Check samples for syntax errors and missing imports
uv run poe pyright -S
# Lint samples only
uv run poe syntax -S -C
Documentation
Samples should be over-documented:
Include a README.md in each set of samples
Add a summary docstring under imports explaining the purpose and key components
Mark code sections with numbered comments:
# 1. Create the client instance.
...
# 2. Create the agent with the client.
...
Include expected output at the end of the file:
"""
Sample output:
User:> Why is the sky blue?
Assistant:> The sky is blue due to Rayleigh scattering...
"""
Guidelines
Incremental complexity — start simple, build up (step1, step2, ...)
Getting started naming: step<number>_<name>.py
When modifying samples, update associated README files
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: microsoft-agent-framework-python-samples3description: Python Samples4---56# Python Samples78## File Structure910Every sample file follows this order:11121. PEP 723 inline script metadata (if external dependencies needed)132. Copyright header: `# Copyright (c) Microsoft. All rights reserved.`143. Required imports154. Module docstring: `"""This sample demonstrates..."""`165. Helper functions176. Main function(s) demonstrating functionality187. Entry point: `if __name__ == "__main__": asyncio.run(main())`1920## External Dependencies2122Use [PEP 723](https://peps.python.org/pep-0723/) inline script metadata for23external packages not in the dev environment:2425```python26# /// script27# requires-python = ">=3.10"28# dependencies = [29# "some-external-package",30# ]31# ///32# Run with: uv run samples/path/to/script.py3334# Copyright (c) Microsoft. All rights reserved.35```3637Do **not** add sample-only dependencies to the root `pyproject.toml` dev group.3839## Syntax Checking4041```bash42# Format + lint samples43uv run poe syntax -S4445# Check samples for syntax errors and missing imports46uv run poe pyright -S4748# Lint samples only49uv run poe syntax -S -C50```5152## Documentation5354Samples should be over-documented:55561. Include a README.md in each set of samples572. Add a summary docstring under imports explaining the purpose and key components583. Mark code sections with numbered comments:59 ```python60 # 1. Create the client instance.61 ...62 # 2. Create the agent with the client.63 ...64 ```654. Include expected output at the end of the file:66 ```python67 """68 Sample output:69 User:> Why is the sky blue?70 Assistant:> The sky is blue due to Rayleigh scattering...71 """72 ```7374## Guidelines7576- **Incremental complexity** — start simple, build up (step1, step2, ...)77- **Getting started naming**: `step<number>_<name>.py`78- When modifying samples, update associated README files7980---81> Converted and distributed by [TomeVault](https://tomevault.io/claim/microsoft) — claim your Tome and manage your conversions.82<!-- tomevault:4.0:skill_md:2026-04-11 -->
Run npx skillmds@latest add tomevault-io/microsoft-agent-framework-python-samples in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Python Samples It is listed under AI & ML on SkillMD.
This skill has not completed SkillMD's automated safety review yet. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
tomevault-io (@tomevault-io) published this skill. Their other Agent Skills are listed on their SkillMD profile.