Uh oh!
There was an error while loading. Please reload this page.
Python: Add Durabletask samples and minor fixes - #3157
Conversation
Uh oh!
There was an error while loading. Please reload this page.
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 |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Python Test Coverage Report •
Python Unit Test Overview
| ||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
3df9160
into
microsoft:feature-durabletask-pythonUh oh!
There was an error while loading. Please reload this page.
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