Skip to content

Conversation

@larohra
Copy link
Contributor

@larohra larohra commented Jan 9, 2026

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:

  • Refactored DurableAgentTask to inherit from both CompositeTask and CompletableTask, and updated its completion logic to use the new complete() and fail() methods for more robust and standardized task state management. This improves error propagation and prevents duplicate completion. [1] [2] [3] [4]
  • Changed the type of entity_task to CompletableTask[Any] throughout the executor code to reflect the new task interface and ensure type safety. [1] [2]

Testing enhancements and coverage:

  • Added new pytest fixtures to configure mock entity tasks for both successful and failed scenarios, simplifying test setup and increasing reliability. [1] [2]
  • Expanded test coverage for DurableAgentTask to 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:

  • Updated durabletask and durabletask-azuremanaged dependencies to version 1.2.0.dev10 in pyproject.toml for compatibility with new features and bug fixes.
  • Added RUF067 to the list of ignored ruff lint rules to allow version detection in __init__.py.

Sample and documentation improvements:

  • Improved the README.md for the single agent sample to clarify the combined and separate worker/client approaches, enhancing the onboarding experience for new users. [1] [2] [3]
  • Removed an unnecessary debug log in the content_generation_hitl_orchestration sample for cleaner output.

Minor logging and utility enhancements:

  • Enhanced logging in AgentEntity.run to include the thread ID, aiding in debugging concurrent executions.
  • Added a utility method generate_unique_id() to the executor for safer UUID generation within orchestrations.

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.

Copilot AI review requested due to automatic review settings January 9, 2026 21:04
@markwallace-microsoft markwallace-microsoft added documentation Improvements or additions to documentation python labels Jan 9, 2026
"agent-framework-core",
"durabletask>=1.1.0",
"durabletask-azuremanaged>=1.1.0"
"durabletask>=1.2.0.dev10",
Copy link
Contributor Author

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.

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

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

Comment on lines +56 to +60
run_client(
client,
email_id="email-001",
email_content="Hello! I wanted to reach out about our upcoming project meeting scheduled for next week."
)
Copy link

Copilot AI Jan 9, 2026

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.

Copilot uses AI. Check for mistakes.
Comment on lines +65 to +69
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!"
)
Copy link

Copilot AI Jan 9, 2026

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.

Copilot uses AI. Check for mistakes.
# Run the client to start the orchestration
asyncio.run(run_client(endpoint, taskhub_name, credential, prompt))

run_client(client, prompt)
Copy link

Copilot AI Jan 9, 2026

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.

Copilot uses AI. Check for mistakes.
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants