-
Notifications
You must be signed in to change notification settings - Fork 1k
Python: Add Durabletask samples and minor fixes #3157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feature-durabletask-python
Are you sure you want to change the base?
Python: Add Durabletask samples and minor fixes #3157
Conversation
| "agent-framework-core", | ||
| "durabletask>=1.1.0", | ||
| "durabletask-azuremanaged>=1.1.0" | ||
| "durabletask>=1.2.0.dev10", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This version contains the fix for allowing Exceptions inside the CompletableTask. Unfortunately, the 1.2.0.dev10 has fixes after 1.2.0 but since 1.2.0 is considered the greater one, the resolution breaks. The durable team will release a new one 1.3.0 next week which will fix the resolution correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
| run_client( | ||
| client, | ||
| email_id="email-001", | ||
| email_content="Hello! I wanted to reach out about our upcoming project meeting scheduled for next week." | ||
| ) |
Copilot
AI
Jan 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keyword argument 'email_id' is not a supported parameter name of function run_client.
Keyword argument 'email_id' is not a supported parameter name of function run_client.
Keyword argument 'email_id' is not a supported parameter name of function run_client.
Keyword argument 'email_id' is not a supported parameter name of function run_client.
Keyword argument 'email_content' is not a supported parameter name of function run_client.
Keyword argument 'email_content' is not a supported parameter name of function run_client.
Keyword argument 'email_content' is not a supported parameter name of function run_client.
Keyword argument 'email_content' is not a supported parameter name of function run_client.
| run_client( | ||
| client, | ||
| email_id="email-002", | ||
| email_content="URGENT! You've won $1,000,000! Click here now to claim your prize! Limited time offer! Don't miss out!" | ||
| ) |
Copilot
AI
Jan 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keyword argument 'email_id' is not a supported parameter name of function run_client.
Keyword argument 'email_id' is not a supported parameter name of function run_client.
Keyword argument 'email_id' is not a supported parameter name of function run_client.
Keyword argument 'email_id' is not a supported parameter name of function run_client.
Keyword argument 'email_content' is not a supported parameter name of function run_client.
Keyword argument 'email_content' is not a supported parameter name of function run_client.
Keyword argument 'email_content' is not a supported parameter name of function run_client.
Keyword argument 'email_content' is not a supported parameter name of function run_client.
| # Run the client to start the orchestration | ||
| asyncio.run(run_client(endpoint, taskhub_name, credential, prompt)) | ||
|
|
||
| run_client(client, prompt) |
Copilot
AI
Jan 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Call to function run_client with too many arguments; should be no more than 1.
Call to function run_client with too many arguments; should be no more than 1.
Call to function run_client with too many arguments; should be no more than 1.
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