Skip to content

fix: update Python samples for agent-framework-durabletask 1.0.0b260212 breaking changes#30

Open
clsweeting wants to merge 1 commit intoAzure-Samples:mainfrom
chassweeting:fix/python-sdk-breaking-changes
Open

fix: update Python samples for agent-framework-durabletask 1.0.0b260212 breaking changes#30
clsweeting wants to merge 1 commit intoAzure-Samples:mainfrom
chassweeting:fix/python-sdk-breaking-changes

Conversation

@clsweeting
Copy link
Copy Markdown

fix: update Python samples for agent-framework-durabletask 1.0.0b260212 breaking changes

Three breaking changes in the agent-framework SDK were causing all Python samples and quickstarts to fail at runtime:

  1. get_new_thread() removed -- replaced with create_session(), and the 'thread' keyword argument in agent.run() renamed to 'session'.

  2. try_parse_value(Model) removed -- replaced with the .value property on AgentResponse, which returns the parsed model directly.

  3. @tool decorator now required -- tool functions passed to agents must be decorated with @tool from agent_framework for the SDK to discover them.

Also bumps agent-framework-durabletask version pin from >=0.0.2b260126 to >=1.0.0b260212 in all requirements.txt files.

Tested end-to-end with the container-apps travel planner sample against the DTS emulator -- all 3 agents, human approval, and booking complete successfully.

Purpose

Updates all Python samples and quickstarts to work with agent-framework-durabletask >= 1.0.0b260212, which introduced several breaking API changes from 0.0.2b260126.

Breaking Changes Fixed

1. Session API renameget_new_thread() renamed to create_session(), thread= parameter renamed to session=

# Before
thread = client.get_new_thread()
response = client.run_agent(agent, thread=thread, ...)

# After
session = client.create_session()
response = client.run_agent(agent, session=session, ...)

2. Result value accesstry_parse_value() removed, results accessed via .value property

# Before
result = response.try_parse_value()

# After
result = response.value
if isinstance(result, str):
    import json
    result = json.loads(result)

3. Tool decorator requirement — Tools now require the @tool decorator

from agent_framework import tool

@tool
def my_tool(param: str) -> str:
    ...

Files Changed (17 files)

Quickstart requirements.txt (10 files) — all updated from >=0.0.2b260126 to >=1.0.0b260212

Quickstart function_app.py (4 files)04_chat_with_history, 05_fan_out, 06_human_in_the_loop, 07_resumable

Travel Planner samples (3 files)worker.py, currency_converter.py, function_app.py

Does this introduce a breaking change?

[ ] Yes
[x] No

Pull Request Type

[x] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Documentation content changes
[ ] Other... Please describe:

How to Test

  • Get the code
git clone https://github.com/chassweeting/durable-task-extension-for-agent-framework.git
cd durable-task-extension-for-agent-framework
git checkout fix/python-sdk-breaking-changes
  • Test the code (container-apps travel planner example)
# Start DTS emulator and Azurite
docker run -d -p 8080:8080 mcr.microsoft.com/dts/dts-emulator:latest
docker run -d -p 10000:10000 -p 10001:10001 -p 10002:10002 mcr.microsoft.com/azure-storage/azurite

# Set up the sample
cd samples/python/azure-container-apps/agentic-travel-planner/api
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt

# Configure .env
cp .env.sample .env
# Edit .env with your Azure OpenAI endpoint, API key, and deployment name

# Start the worker and API
python worker.py &
python app.py &

# Test: start an orchestration
curl -X POST http://localhost:8000/trips \
  -H "Content-Type: application/json" \
  -d '{"destination": "Barcelona", "start_date": "2025-07-01", "end_date": "2025-07-05", "budget": 2000, "currency": "USD", "interests": ["architecture", "food"]}'

# Poll status (use instance_id from response)
curl http://localhost:8000/trips/<instance_id>

# Approve when status shows waiting for approval
curl -X POST http://localhost:8000/trips/<instance_id>/approve

What to Check

  • All quickstarts install without dependency errors (pip install -r requirements.txt)
  • Travel planner sample completes full workflow: orchestration start → agent processing → human approval → booking confirmed
  • No references to removed APIs (get_new_thread, try_parse_value) remain in Python files

Other Information

The agent-framework-durabletask package released 1.0.0b260212 with breaking changes that prevent all existing Python samples from running. This PR brings every Python sample and quickstart up to date with the new API surface.

…12 breaking changes

Three breaking changes in the agent-framework SDK were causing all Python
samples and quickstarts to fail at runtime:

1. get_new_thread() removed -- replaced with create_session(), and the
   'thread' keyword argument in agent.run() renamed to 'session'.

2. try_parse_value(Model) removed -- replaced with the .value property
   on AgentResponse, which returns the parsed model directly.

3. @tool decorator now required -- tool functions passed to agents must
   be decorated with @tool from agent_framework for the SDK to
   discover them.

Also bumps agent-framework-durabletask version pin from >=0.0.2b260126
to >=1.0.0b260212 in all requirements.txt files.

Tested end-to-end with the container-apps travel planner sample against
the DTS emulator -- all 3 agents, human approval, and booking complete
successfully.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant