
python-samples
✓ Official★ 11,900by microsoft · part of microsoft/agent-framework
Every sample file follows this order:
🔥🔥✓ VerifiedFreeQuick setup
🔒 Repo-maintenance skill. It exists to help maintain microsoft/agent-framework itself — it's only useful if you contribute code to that project.
This is the playbook your agent receives when the skill activates — you don't need to read it to use the skill, but it's here to audit before installing.
name: python-samples description: > Guidelines for creating and modifying sample code in the Agent Framework Python codebase. Use this when writing new samples or updating existing ones.
Python Samples
File Structure
Every sample file follows this order:
- PEP 723 inline script metadata (if external dependencies needed)
- Copyright header:
# Copyright (c) Microsoft. All rights reserved. - Required imports
- Module docstring:
"""This sample demonstrates...""" - Helper functions
- Main function(s) demonstrating functionality
- 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 -CDocumentation
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
Copy & paste — that's it
npx skills add https://github.com/microsoft/agent-framework --skill python-samplesRun this in your project — your agent picks the skill up automatically.
No common issues documented yet. If you hit a problem, the repository's GitHub Issues page is the best place to look.