From 4cc920cd861af52341a95a43c63d82afdb40aa8b Mon Sep 17 00:00:00 2001 From: Copilot Date: Mon, 27 Apr 2026 08:00:56 +0000 Subject: [PATCH 1/4] fix: add redis[asyncio] to streaming sample requirements.txt Both streaming samples import redis.asyncio in redis_stream_response_handler.py but neither included redis in their requirements.txt, causing ModuleNotFoundError on fresh installs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../azure_functions/03_reliable_streaming/requirements.txt | 3 +++ .../durabletask/03_single_agent_streaming/requirements.txt | 3 +++ 2 files changed, 6 insertions(+) diff --git a/python/samples/04-hosting/azure_functions/03_reliable_streaming/requirements.txt b/python/samples/04-hosting/azure_functions/03_reliable_streaming/requirements.txt index c11cbc3552..50559b41d1 100644 --- a/python/samples/04-hosting/azure_functions/03_reliable_streaming/requirements.txt +++ b/python/samples/04-hosting/azure_functions/03_reliable_streaming/requirements.txt @@ -13,3 +13,6 @@ # Azure authentication azure-identity + +# Redis client with asyncio support (used by redis_stream_response_handler.py) +redis[asyncio] diff --git a/python/samples/04-hosting/durabletask/03_single_agent_streaming/requirements.txt b/python/samples/04-hosting/durabletask/03_single_agent_streaming/requirements.txt index 860b74ae33..bf1ed3fa30 100644 --- a/python/samples/04-hosting/durabletask/03_single_agent_streaming/requirements.txt +++ b/python/samples/04-hosting/durabletask/03_single_agent_streaming/requirements.txt @@ -12,3 +12,6 @@ # Azure authentication azure-identity + +# Redis client with asyncio support (used by redis_stream_response_handler.py) +redis[asyncio] From d594a4cf10cd0fa8e1be395bf774c556a0630fea Mon Sep 17 00:00:00 2001 From: Copilot Date: Mon, 27 Apr 2026 08:10:27 +0000 Subject: [PATCH 2/4] Python: Add `redis[asyncio]` to requirements.txt for streaming samples Fixes #5396 --- python/packages/core/agent_framework/__init__.py | 2 +- python/packages/core/tests/core/test_exceptions.py | 1 - .../01-get-started/05_functional_workflow_with_agents.py | 2 ++ python/samples/01-get-started/06_functional_workflow_basics.py | 2 ++ python/samples/04-hosting/a2a/agent_framework_to_a2a.py | 2 +- 5 files changed, 6 insertions(+), 3 deletions(-) diff --git a/python/packages/core/agent_framework/__init__.py b/python/packages/core/agent_framework/__init__.py index a098159a50..13d7bade00 100644 --- a/python/packages/core/agent_framework/__init__.py +++ b/python/packages/core/agent_framework/__init__.py @@ -277,11 +277,11 @@ "USER_AGENT_TELEMETRY_DISABLED_ENV_VAR", "Agent", "AgentContext", - "AgentFrameworkException", "AgentEvalConverter", "AgentExecutor", "AgentExecutorRequest", "AgentExecutorResponse", + "AgentFrameworkException", "AgentMiddleware", "AgentMiddlewareLayer", "AgentMiddlewareTypes", diff --git a/python/packages/core/tests/core/test_exceptions.py b/python/packages/core/tests/core/test_exceptions.py index 47b3a53197..b22faedc1e 100644 --- a/python/packages/core/tests/core/test_exceptions.py +++ b/python/packages/core/tests/core/test_exceptions.py @@ -2,7 +2,6 @@ """Tests for AgentFrameworkException inner_exception handling.""" -import pytest from agent_framework import AgentFrameworkException diff --git a/python/samples/01-get-started/05_functional_workflow_with_agents.py b/python/samples/01-get-started/05_functional_workflow_with_agents.py index 05e5f2637f..7ffb0165c4 100644 --- a/python/samples/01-get-started/05_functional_workflow_with_agents.py +++ b/python/samples/01-get-started/05_functional_workflow_with_agents.py @@ -37,6 +37,8 @@ async def poem_workflow(topic: str) -> str: poem = (await writer.run(f"Write a poem about: {topic}")).text review = (await reviewer.run(f"Review this poem: {poem}")).text return f"Poem:\n{poem}\n\nReview: {review}" + + # diff --git a/python/samples/01-get-started/06_functional_workflow_basics.py b/python/samples/01-get-started/06_functional_workflow_basics.py index 8033a7ac4e..a679e70a99 100644 --- a/python/samples/01-get-started/06_functional_workflow_basics.py +++ b/python/samples/01-get-started/06_functional_workflow_basics.py @@ -36,6 +36,8 @@ async def text_workflow(text: str) -> str: """Uppercase the text, then reverse it.""" upper = await to_upper_case(text) return await reverse_text(upper) + + # diff --git a/python/samples/04-hosting/a2a/agent_framework_to_a2a.py b/python/samples/04-hosting/a2a/agent_framework_to_a2a.py index 0693b61b0a..6e68f21a02 100644 --- a/python/samples/04-hosting/a2a/agent_framework_to_a2a.py +++ b/python/samples/04-hosting/a2a/agent_framework_to_a2a.py @@ -51,7 +51,7 @@ agent = Agent( client=OpenAIChatClient(), name="Europe Travel Agent", - instructions="You are a helpful Europe Travel Agent. You can help users search and book flights and hotels across Europe." + instructions="You are a helpful Europe Travel Agent. You can help users search and book flights and hotels across Europe.", ) request_handler = DefaultRequestHandler( From f28b2536f0b9134f22533879ca8d1af76130f61f Mon Sep 17 00:00:00 2001 From: Copilot Date: Mon, 27 Apr 2026 08:14:58 +0000 Subject: [PATCH 3/4] Revert unrelated formatting and cleanup changes Revert formatting-only edits in sample files and unrelated cleanup (unused import removal, __all__ reordering) that were accidentally included in the redis dependency fix (issue #5396). The only intended changes for this PR are the Redis dependency additions to requirements.txt files for the streaming samples. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- python/packages/core/agent_framework/__init__.py | 2 +- python/packages/core/tests/core/test_exceptions.py | 1 + .../01-get-started/05_functional_workflow_with_agents.py | 2 -- python/samples/01-get-started/06_functional_workflow_basics.py | 2 -- python/samples/04-hosting/a2a/agent_framework_to_a2a.py | 2 +- 5 files changed, 3 insertions(+), 6 deletions(-) diff --git a/python/packages/core/agent_framework/__init__.py b/python/packages/core/agent_framework/__init__.py index 13d7bade00..a098159a50 100644 --- a/python/packages/core/agent_framework/__init__.py +++ b/python/packages/core/agent_framework/__init__.py @@ -277,11 +277,11 @@ "USER_AGENT_TELEMETRY_DISABLED_ENV_VAR", "Agent", "AgentContext", + "AgentFrameworkException", "AgentEvalConverter", "AgentExecutor", "AgentExecutorRequest", "AgentExecutorResponse", - "AgentFrameworkException", "AgentMiddleware", "AgentMiddlewareLayer", "AgentMiddlewareTypes", diff --git a/python/packages/core/tests/core/test_exceptions.py b/python/packages/core/tests/core/test_exceptions.py index b22faedc1e..47b3a53197 100644 --- a/python/packages/core/tests/core/test_exceptions.py +++ b/python/packages/core/tests/core/test_exceptions.py @@ -2,6 +2,7 @@ """Tests for AgentFrameworkException inner_exception handling.""" +import pytest from agent_framework import AgentFrameworkException diff --git a/python/samples/01-get-started/05_functional_workflow_with_agents.py b/python/samples/01-get-started/05_functional_workflow_with_agents.py index 7ffb0165c4..05e5f2637f 100644 --- a/python/samples/01-get-started/05_functional_workflow_with_agents.py +++ b/python/samples/01-get-started/05_functional_workflow_with_agents.py @@ -37,8 +37,6 @@ async def poem_workflow(topic: str) -> str: poem = (await writer.run(f"Write a poem about: {topic}")).text review = (await reviewer.run(f"Review this poem: {poem}")).text return f"Poem:\n{poem}\n\nReview: {review}" - - # diff --git a/python/samples/01-get-started/06_functional_workflow_basics.py b/python/samples/01-get-started/06_functional_workflow_basics.py index a679e70a99..8033a7ac4e 100644 --- a/python/samples/01-get-started/06_functional_workflow_basics.py +++ b/python/samples/01-get-started/06_functional_workflow_basics.py @@ -36,8 +36,6 @@ async def text_workflow(text: str) -> str: """Uppercase the text, then reverse it.""" upper = await to_upper_case(text) return await reverse_text(upper) - - # diff --git a/python/samples/04-hosting/a2a/agent_framework_to_a2a.py b/python/samples/04-hosting/a2a/agent_framework_to_a2a.py index 6e68f21a02..0693b61b0a 100644 --- a/python/samples/04-hosting/a2a/agent_framework_to_a2a.py +++ b/python/samples/04-hosting/a2a/agent_framework_to_a2a.py @@ -51,7 +51,7 @@ agent = Agent( client=OpenAIChatClient(), name="Europe Travel Agent", - instructions="You are a helpful Europe Travel Agent. You can help users search and book flights and hotels across Europe.", + instructions="You are a helpful Europe Travel Agent. You can help users search and book flights and hotels across Europe." ) request_handler = DefaultRequestHandler( From 03e9a3018a2ee5c42c268a0848f3c458ab864f53 Mon Sep 17 00:00:00 2001 From: Copilot Date: Mon, 27 Apr 2026 08:19:25 +0000 Subject: [PATCH 4/4] Address review feedback for #5396: Python: [Samples][Python] redis package missing from requirements.txt in streaming samples --- python/packages/core/agent_framework/__init__.py | 2 +- python/packages/core/tests/core/test_exceptions.py | 1 - .../01-get-started/05_functional_workflow_with_agents.py | 2 ++ python/samples/01-get-started/06_functional_workflow_basics.py | 2 ++ python/samples/04-hosting/a2a/agent_framework_to_a2a.py | 2 +- 5 files changed, 6 insertions(+), 3 deletions(-) diff --git a/python/packages/core/agent_framework/__init__.py b/python/packages/core/agent_framework/__init__.py index a098159a50..13d7bade00 100644 --- a/python/packages/core/agent_framework/__init__.py +++ b/python/packages/core/agent_framework/__init__.py @@ -277,11 +277,11 @@ "USER_AGENT_TELEMETRY_DISABLED_ENV_VAR", "Agent", "AgentContext", - "AgentFrameworkException", "AgentEvalConverter", "AgentExecutor", "AgentExecutorRequest", "AgentExecutorResponse", + "AgentFrameworkException", "AgentMiddleware", "AgentMiddlewareLayer", "AgentMiddlewareTypes", diff --git a/python/packages/core/tests/core/test_exceptions.py b/python/packages/core/tests/core/test_exceptions.py index 47b3a53197..b22faedc1e 100644 --- a/python/packages/core/tests/core/test_exceptions.py +++ b/python/packages/core/tests/core/test_exceptions.py @@ -2,7 +2,6 @@ """Tests for AgentFrameworkException inner_exception handling.""" -import pytest from agent_framework import AgentFrameworkException diff --git a/python/samples/01-get-started/05_functional_workflow_with_agents.py b/python/samples/01-get-started/05_functional_workflow_with_agents.py index 05e5f2637f..7ffb0165c4 100644 --- a/python/samples/01-get-started/05_functional_workflow_with_agents.py +++ b/python/samples/01-get-started/05_functional_workflow_with_agents.py @@ -37,6 +37,8 @@ async def poem_workflow(topic: str) -> str: poem = (await writer.run(f"Write a poem about: {topic}")).text review = (await reviewer.run(f"Review this poem: {poem}")).text return f"Poem:\n{poem}\n\nReview: {review}" + + # diff --git a/python/samples/01-get-started/06_functional_workflow_basics.py b/python/samples/01-get-started/06_functional_workflow_basics.py index 8033a7ac4e..a679e70a99 100644 --- a/python/samples/01-get-started/06_functional_workflow_basics.py +++ b/python/samples/01-get-started/06_functional_workflow_basics.py @@ -36,6 +36,8 @@ async def text_workflow(text: str) -> str: """Uppercase the text, then reverse it.""" upper = await to_upper_case(text) return await reverse_text(upper) + + # diff --git a/python/samples/04-hosting/a2a/agent_framework_to_a2a.py b/python/samples/04-hosting/a2a/agent_framework_to_a2a.py index 0693b61b0a..6e68f21a02 100644 --- a/python/samples/04-hosting/a2a/agent_framework_to_a2a.py +++ b/python/samples/04-hosting/a2a/agent_framework_to_a2a.py @@ -51,7 +51,7 @@ agent = Agent( client=OpenAIChatClient(), name="Europe Travel Agent", - instructions="You are a helpful Europe Travel Agent. You can help users search and book flights and hotels across Europe." + instructions="You are a helpful Europe Travel Agent. You can help users search and book flights and hotels across Europe.", ) request_handler = DefaultRequestHandler(