Python: Add Durabletask samples and minor fixes#3157
Merged
larohra merged 5 commits intomicrosoft:feature-durabletask-pythonfrom Jan 14, 2026
Merged
Python: Add Durabletask samples and minor fixes#3157larohra merged 5 commits intomicrosoft:feature-durabletask-pythonfrom
larohra merged 5 commits intomicrosoft:feature-durabletask-pythonfrom
Conversation
larohra
commented
Jan 9, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds comprehensive samples for the durabletask package demonstrating advanced orchestration patterns including human-in-the-loop workflows, conditional branching, and concurrency. It also updates dependencies (durabletask 1.2.0, aiohttp 3.13.3, etc.) and refactors existing samples for better maintainability.
Key Changes:
- Added Sample 06: Multi-agent orchestration with conditional branching (spam detection + email assistant)
- Added Sample 07: Human-in-the-loop pattern with external events, timeouts, and iterative refinement
- Refactored Sample 05: Extracted helper functions for better code reuse
- Updated README with comprehensive sample catalog and improved setup instructions
- Updated dependencies to durabletask 1.2.0 and other minor version bumps
Reviewed changes
Copilot reviewed 34 out of 35 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| python/uv.lock | Updated dependencies including durabletask to 1.2.0, aiohttp to 3.13.3, and various other minor version updates |
| python/samples/getting_started/durabletask/README.md | Enhanced README with sample catalog categorization, PowerShell commands, and uv package manager instructions |
| python/samples/getting_started/durabletask/07_single_agent_orchestration_hitl/* | New HITL sample with WriterAgent demonstrating external events, timeouts, and feedback loops |
| python/samples/getting_started/durabletask/06_multi_agent_orchestration_conditionals/* | New conditional orchestration sample with spam detection and email assistant agents |
| python/samples/getting_started/durabletask/05_multi_agent_orchestration_concurrency/* | Refactored to extract helper functions (get_worker, setup_worker, get_client) for reusability |
python/samples/getting_started/durabletask/06_multi_agent_orchestration_conditionals/sample.py
Show resolved
Hide resolved
python/samples/getting_started/durabletask/06_multi_agent_orchestration_conditionals/sample.py
Show resolved
Hide resolved
python/samples/getting_started/durabletask/05_multi_agent_orchestration_concurrency/sample.py
Show resolved
Hide resolved
Member
Python Test Coverage Report •
Python Unit Test Overview
|
||||||||||||||||||||||||||||||
gavin-aguiar
approved these changes
Jan 14, 2026
python/packages/azurefunctions/agent_framework_azurefunctions/_orchestration.py
Outdated
Show resolved
Hide resolved
gavin-aguiar
approved these changes
Jan 14, 2026
3df9160
into
microsoft:feature-durabletask-python
17 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation and Context
This PR adds the remaining samples to the durabletask package.
It also addresses a bug where a new uuid was being created for orchestration replays causing thread disruption.
Description
This pull request introduces several improvements and refactors to the durable agent task execution system, focusing on better task completion handling, improved error propagation, and enhanced test coverage for edge cases. The changes also update dependencies and clarify sample documentation for easier onboarding and testing.
Core improvements to task execution and error handling:
DurableAgentTaskto inherit from bothCompositeTaskandCompletableTask, and updated its completion logic to use the newcomplete()andfail()methods for more robust and standardized task state management. This improves error propagation and prevents duplicate completion. [1] [2] [3] [4]entity_tasktoCompletableTask[Any]throughout the executor code to reflect the new task interface and ensure type safety. [1] [2]Testing enhancements and coverage:
DurableAgentTaskto include cases for malformed responses, invalid response formats, empty and multiple messages, and initial state checks. This ensures the task handles edge cases and errors gracefully.Dependency and configuration updates:
durabletaskanddurabletask-azuremanageddependencies to version1.2.0.dev10inpyproject.tomlfor compatibility with new features and bug fixes.RUF067to the list of ignored ruff lint rules to allow version detection in__init__.py.Sample and documentation improvements:
README.mdfor the single agent sample to clarify the combined and separate worker/client approaches, enhancing the onboarding experience for new users. [1] [2] [3]content_generation_hitl_orchestrationsample for cleaner output.Minor logging and utility enhancements:
AgentEntity.runto include the thread ID, aiding in debugging concurrent executions.generate_unique_id()to the executor for safer UUID generation within orchestrations.Contribution Checklist