Skip to content

Comments

Python: Automate sample validation#4193

Merged
TaoChenOSU merged 5 commits intomicrosoft:mainfrom
TaoChenOSU:taochen/python-automate-sample-validation
Feb 24, 2026
Merged

Python: Automate sample validation#4193
TaoChenOSU merged 5 commits intomicrosoft:mainfrom
TaoChenOSU:taochen/python-automate-sample-validation

Conversation

@TaoChenOSU
Copy link
Contributor

@TaoChenOSU TaoChenOSU commented Feb 23, 2026

Motivation and Context

Our samples are entry point for many customers, so we need to ensure that they run correctly. With changes coming in fast, we often forget to validate if our samples are affected by the changes. We need a way to catch regressions and fix them promptly.

Description

Add a GH workflow to run daily to ensure samples are working as expected.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

@TaoChenOSU TaoChenOSU self-assigned this Feb 23, 2026
@TaoChenOSU TaoChenOSU added the samples Issue relates to the samples label Feb 23, 2026
@markwallace-microsoft markwallace-microsoft added the documentation Improvements or additions to documentation label Feb 23, 2026
@github-actions github-actions bot changed the title Automate sample validation Python: Automate sample validation Feb 23, 2026
@markwallace-microsoft
Copy link
Member

markwallace-microsoft commented Feb 23, 2026

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
packages/orchestrations/agent_framework_orchestrations
   _handoff.py3875984%105–106, 108, 163–173, 175, 177, 179, 184, 281, 287, 319, 342, 364, 420, 445, 503, 535, 593–594, 626, 634, 638–639, 677–679, 684–686, 802, 805, 812, 817, 879, 884, 891, 901, 903, 922, 924, 1006–1007, 1039–1040, 1122, 1129, 1201–1202, 1204
TOTAL22149347484% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
4265 240 💤 0 ❌ 0 🔥 1m 14s ⏱️

@TaoChenOSU TaoChenOSU marked this pull request as ready for review February 23, 2026 20:09
Copilot AI review requested due to automatic review settings February 23, 2026 20:09
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an automated, workflow-driven system to validate Python samples on a daily cadence, aiming to catch regressions early and surface results as build artifacts.

Changes:

  • Introduces a new _sample_validation package that discovers runnable samples, orchestrates concurrent validation via a nested workflow, and generates a report.
  • Adds a scheduled GitHub Actions workflow to run sample validation per sample area (01-get-started, 02-agents, etc.) and upload reports as artifacts.
  • Includes a few related cleanups/fixes in existing samples and orchestration code.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
python/samples/_sample_validation/workflow.py Top-level workflow composition wiring discovery → nested workflow creation → execution → report.
python/samples/_sample_validation/run_dynamic_validation_workflow_executor.py Executes the nested workflow, streams progress events, and fans results back into the parent workflow.
python/samples/_sample_validation/report.py Builds/prints report summary and yields the final Report output.
python/samples/_sample_validation/models.py Defines config and result/report datamodels used across the validation pipeline.
python/samples/_sample_validation/discovery.py Discovers sample scripts (filters for files with if __name__ == "__main__" guards).
python/samples/_sample_validation/create_dynamic_workflow_executor.py Constructs nested coordinator/worker/collector workflow and runs Copilot agents per sample.
python/samples/_sample_validation/const.py Defines workflow event type constants.
python/samples/_sample_validation/main.py CLI entrypoint to run validation and optionally save report artifacts.
python/samples/_sample_validation/init.py Package exports and usage documentation.
python/samples/_sample_validation/README.md Architecture and usage documentation for the validation system.
python/samples/_run_all_samples.py Removes previous sample runner script in favor of the new validation system.
python/samples/02-agents/context_providers/redis/redis_conversation.py Removes an unused import.
python/samples/01-get-started/04_memory.py Ensures the sample context provider calls BaseContextProvider constructor with the expected source id.
python/packages/orchestrations/agent_framework_orchestrations/_handoff.py Updates the synthetic handoff tool signature/body and minor formatting.
.github/workflows/python-sample-validation.yml Adds scheduled/manual workflow to run sample validation across sample areas and upload reports.

@TaoChenOSU TaoChenOSU added this pull request to the merge queue Feb 24, 2026
Merged via the queue into microsoft:main with commit b7efaae Feb 24, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation python samples Issue relates to the samples

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants