
Python Samples
Keeps Agent Framework Python samples consistent with Microsoft’s file layout, PEP 723 deps, and lint commands when you add or edit demo scripts.
Install
npx skills add https://github.com/microsoft/agent-framework --skill python-samplesWhat is this skill?
- Mandatory sample file order: PEP 723 metadata, copyright, imports, docstring, helpers, main, asyncio entry point
- External deps via PEP 723 only—never pollute root pyproject.toml dev groups
- Documented uv/poe workflows: syntax, pyright, and lint scoped to samples (-S, -C flags)
- Expects per-sample-set README plus numbered section comments in code
- Targets uv run samples/... execution path for isolated script dependencies
Adoption & trust: 27 installs on skills.sh; 11.2k GitHub stars; 3/3 security scanners passed (skills.sh audits).
Recommended Skills
Lark Doclarksuite/cli
Lark Wikilarksuite/cli
Opensource Guide Coachxixu-me/skills
Readme I18nxixu-me/skills
Doc Coauthoringanthropics/skills
Obsidian Markdownkepano/obsidian-skills
Journey fit
Primary fit
Sample authoring is product documentation work that happens while building and shipping example code in the framework repo. Docs is the canonical shelf because the skill governs READMEs, docstrings, and over-documented sample structure—not runtime agent logic.
Common Questions / FAQ
Is Python Samples safe to install?
skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.
SKILL.md
READMESKILL.md - Python Samples
# Python Samples ## File Structure Every sample file follows this order: 1. PEP 723 inline script metadata (if external dependencies needed) 2. Copyright header: `# Copyright (c) Microsoft. All rights reserved.` 3. Required imports 4. Module docstring: `"""This sample demonstrates..."""` 5. Helper functions 6. Main function(s) demonstrating functionality 7. Entry point: `if __name__ == "__main__": asyncio.run(main())` ## External Dependencies Use [PEP 723](https://peps.python.org/pep-0723/) inline script metadata for external packages not in the dev environment: ```python # /// 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 ```bash # 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: 1. Include a README.md in each set of samples 2. Add a summary docstring under imports explaining the purpose and key components 3. Mark code sections with numbered comments: ```python # 1. Create the client instance. ... # 2. Create the agent with the client. ... ``` 4. Include expected output at the end of the file: ```python """ 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