python-samples

Every sample file follows this order:

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "python-samples" with this command: npx skills add microsoft/agent-framework/microsoft-agent-framework-python-samples

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

Check samples for syntax errors and missing imports

uv run poe samples-syntax

Lint samples

uv run poe samples-lint

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

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

python-code-quality

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

python-development

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

python-package-management

No summary provided by upstream source.

Repository SourceNeeds Review