Python: (samples): adopt AzureOpenAIResponsesClient, reorganize orchestration examples, and fix workflow/orchestration bugs#3873
Merged
markwallace-microsoft merged 3 commits intomicrosoft:mainfrom Feb 12, 2026
Conversation
…and fix workflow/orchestration bugs
Member
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Python getting-started experience by standardizing samples on AzureOpenAIResponsesClient (Azure AI Foundry Agent Service V2), reorganizing orchestration samples by pattern, and addressing several workflow/orchestration runtime correctness issues (kwargs propagation, full-conversation handling, checkpoint capture, Responses payload formatting, and group-chat parsing robustness).
Changes:
- Standardize workflow/orchestration samples on
AzureOpenAIResponsesClient+AzureCliCredential, and align env var usage (AZURE_AI_PROJECT_ENDPOINT,AZURE_AI_MODEL_DEPLOYMENT_NAME). - Reorganize orchestration samples into pattern-based directories and update READMEs/links accordingly.
- Fix core runtime issues (kwargs propagation/merging, full conversation snapshot duplication, checkpoint state commit timing, Responses assistant history formatting, group chat JSON parsing), with targeted regression tests.
Reviewed changes
Copilot reviewed 73 out of 73 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| python/samples/getting_started/workflows/visualization/concurrent_with_visualization.py | Switch sample client to AzureOpenAIResponsesClient and use standardized env vars. |
| python/samples/getting_started/workflows/state-management/workflow_kwargs.py | Update sample to Azure Responses client and add Azure CLI auth + env vars. |
| python/samples/getting_started/workflows/state-management/state_with_agents.py | Update agents to Azure Responses client and standard env vars. |
| python/samples/getting_started/workflows/parallelism/fan_out_fan_in_edges.py | Update to Azure Responses client; improve streaming output handling. |
| python/samples/getting_started/workflows/human-in-the-loop/guessing_game_with_human_input.py | Update to Azure Responses client and standard env vars. |
| python/samples/getting_started/workflows/human-in-the-loop/agents_with_declaration_only_tools.py | Update to Azure Responses client and standard env vars. |
| python/samples/getting_started/workflows/human-in-the-loop/agents_with_approval_requests.py | Update to Azure Responses client; adjust prompt/payload formatting. |
| python/samples/getting_started/workflows/human-in-the-loop/agents_with_HITL.py | Update to Azure Responses client and standard env vars. |
| python/samples/getting_started/workflows/declarative/student_teacher/main.py | Update declarative workflow sample to Azure Responses client + env vars. |
| python/samples/getting_started/workflows/declarative/marketing/main.py | Update declarative workflow sample to Azure Responses client + env vars. |
| python/samples/getting_started/workflows/declarative/function_tools/main.py | Update declarative function-tools sample to Azure Responses client + env vars. |
| python/samples/getting_started/workflows/declarative/deep_research/main.py | Update declarative deep-research sample to Azure Responses client + env vars. |
| python/samples/getting_started/workflows/declarative/customer_support/main.py | Update to Azure Responses client; fix source_executor_id usage for output events. |
| python/samples/getting_started/workflows/control-flow/switch_case_edge_group.py | Update to Azure Responses client + env vars. |
| python/samples/getting_started/workflows/control-flow/simple_loop.py | Update to Azure Responses client; reduce noisy streaming output. |
| python/samples/getting_started/workflows/control-flow/multi_selection_edge_group.py | Update to Azure Responses client; reduce streaming noise; adjust custom event emission. |
| python/samples/getting_started/workflows/control-flow/edge_condition.py | Update to Azure Responses client + env vars; keep file-path lint suppression. |
| python/samples/getting_started/workflows/composition/sub_workflow_request_interception.py | Remove emoji console output for cleaner logs. |
| python/samples/getting_started/workflows/composition/sub_workflow_parallel_requests.py | Remove emoji console output for cleaner logs. |
| python/samples/getting_started/workflows/composition/sub_workflow_kwargs.py | Update to Azure Responses client + env vars. |
| python/samples/getting_started/workflows/composition/sub_workflow_basics.py | Remove emoji console output for cleaner logs. |
| python/samples/getting_started/workflows/checkpoint/workflow_as_agent_checkpoint.py | Update to Azure Responses client + env vars. |
| python/samples/getting_started/workflows/checkpoint/checkpoint_with_human_in_the_loop.py | Update to Azure Responses client + env vars; simplify credential import. |
| python/samples/getting_started/workflows/agents/workflow_as_agent_with_thread.py | Update to Azure Responses client + env vars. |
| python/samples/getting_started/workflows/agents/workflow_as_agent_reflection_pattern.py | Update worker/reviewer clients to Azure Responses client + env vars. |
| python/samples/getting_started/workflows/agents/workflow_as_agent_kwargs.py | Update to Azure Responses client + env vars. |
| python/samples/getting_started/workflows/agents/workflow_as_agent_human_in_the_loop.py | Update to Azure Responses client + env vars. |
| python/samples/getting_started/workflows/agents/custom_agent_executors.py | Update to Azure Responses client + env vars; adjust docs accordingly. |
| python/samples/getting_started/workflows/agents/azure_chat_agents_tool_calls_with_feedback.py | Update to Azure Responses client + env vars. |
| python/samples/getting_started/workflows/agents/azure_chat_agents_streaming.py | Update to Azure Responses client + env vars. |
| python/samples/getting_started/workflows/agents/azure_chat_agents_and_executor.py | Update to Azure Responses client + env vars. |
| python/samples/getting_started/workflows/agents/azure_ai_agents_with_shared_thread.py | Replace V2 provider flow with Azure Responses client; keep shared thread example. |
| python/samples/getting_started/workflows/agents/azure_ai_agents_streaming.py | Replace async agent client flow with Azure Responses client + env vars. |
| python/samples/getting_started/workflows/_start-here/step3_streaming.py | Update start-here streaming sample to Azure Responses client + env vars. |
| python/samples/getting_started/workflows/_start-here/step2_agents_in_a_workflow.py | Update start-here workflow sample to Azure Responses client + env vars. |
| python/samples/getting_started/workflows/README.md | Update/trim links and redirect orchestration/builder-oriented samples to orchestrations set. |
| python/samples/getting_started/orchestrations/sequential/sequential_workflow_as_agent.py | Update to Azure Responses client + env vars. |
| python/samples/getting_started/orchestrations/sequential/sequential_request_info.py | Update to Azure Responses client + env vars. |
| python/samples/getting_started/orchestrations/sequential/sequential_custom_executors.py | Update to Azure Responses client + env vars. |
| python/samples/getting_started/orchestrations/sequential/sequential_builder_tool_approval.py | Update to Azure Responses client + env vars. |
| python/samples/getting_started/orchestrations/sequential/sequential_agents.py | Update to Azure Responses client + env vars. |
| python/samples/getting_started/orchestrations/magentic/magentic_workflow_as_agent.py | Update Magentic sample clients to Azure Responses client + env vars. |
| python/samples/getting_started/orchestrations/magentic/magentic_human_plan_review.py | Update Magentic plan review sample to Azure Responses client + env vars. |
| python/samples/getting_started/orchestrations/magentic/magentic_checkpoint.py | Update Magentic checkpoint sample to Azure Responses client + env vars; fix credential import. |
| python/samples/getting_started/orchestrations/magentic/magentic.py | Update Magentic sample to Azure Responses client + env vars. |
| python/samples/getting_started/orchestrations/handoff_with_code_interpreter_file.py | Remove old top-level handoff CI sample (moved under handoff/). |
| python/samples/getting_started/orchestrations/handoff/handoff_workflow_as_agent.py | Update to Azure Responses client + env vars. |
| python/samples/getting_started/orchestrations/handoff/handoff_with_tool_approval_checkpoint_resume.py | Update to Azure Responses client + env vars. |
| python/samples/getting_started/orchestrations/handoff/handoff_with_code_interpreter_file.py | Add/move CI file-ID retrieval handoff sample under handoff/ and update to Azure Responses client. |
| python/samples/getting_started/orchestrations/handoff/handoff_simple.py | Update to Azure Responses client + env vars. |
| python/samples/getting_started/orchestrations/handoff/handoff_autonomous.py | Update to Azure Responses client + env vars. |
| python/samples/getting_started/orchestrations/group-chat/group_chat_workflow_as_agent.py | Update group chat orchestration-as-agent to Azure Responses client + env vars. |
| python/samples/getting_started/orchestrations/group-chat/group_chat_simple_selector.py | Update to Azure Responses client + env vars. |
| python/samples/getting_started/orchestrations/group-chat/group_chat_request_info.py | Update to Azure Responses client + env vars. |
| python/samples/getting_started/orchestrations/group-chat/group_chat_philosophical_debate.py | Update to Azure Responses client + env vars; improve streaming speaker formatting. |
| python/samples/getting_started/orchestrations/group-chat/group_chat_builder_tool_approval.py | Update tool-approval sample to Azure Responses client + env vars. |
| python/samples/getting_started/orchestrations/group-chat/group_chat_agent_manager.py | Update to Azure Responses client + env vars; improve streaming speaker formatting. |
| python/samples/getting_started/orchestrations/concurrent/concurrent_workflow_as_agent.py | Update to Azure Responses client + env vars. |
| python/samples/getting_started/orchestrations/concurrent/concurrent_request_info.py | Update to Azure Responses client + env vars. |
| python/samples/getting_started/orchestrations/concurrent/concurrent_custom_aggregator.py | Update to Azure Responses client + env vars; formatting cleanup. |
| python/samples/getting_started/orchestrations/concurrent/concurrent_custom_agent_executors.py | Update to Azure Responses client + env vars. |
| python/samples/getting_started/orchestrations/concurrent/concurrent_builder_tool_approval.py | Update tool-approval sample to Azure Responses client + env vars. |
| python/samples/getting_started/orchestrations/concurrent/concurrent_agents.py | Update to Azure Responses client + env vars. |
| python/samples/getting_started/orchestrations/README.md | Restructure orchestration README by directory and update paths. |
| python/packages/orchestrations/tests/test_magentic.py | Add regression coverage for checkpoint state capture; fix run() checkpoint_id usage. |
| python/packages/orchestrations/tests/test_group_chat.py | Add regression test for concatenated JSON manager outputs. |
| python/packages/orchestrations/agent_framework_orchestrations/_group_chat.py | Improve manager output parsing (structured value, JSON text, concatenated JSON). |
| python/packages/core/tests/workflow/test_workflow_kwargs.py | Add tests ensuring options/kwargs merging and flattening behavior is correct. |
| python/packages/core/tests/workflow/test_full_conversation.py | Add round-trip regression test preventing full-conversation duplication. |
| python/packages/core/tests/openai/test_openai_responses_client.py | Add tests enforcing role-specific text content item types and required annotations. |
| python/packages/core/agent_framework/openai/_responses_client.py | Ensure assistant history uses output_text with annotations to satisfy Azure validation. |
| python/packages/core/agent_framework/_workflows/_runner.py | Commit staged state before checkpoint creation to capture executor snapshots reliably. |
| python/packages/core/agent_framework/_workflows/_agent_executor.py | Fix conversation snapshot behavior and correctly merge workflow kwargs into agent options. |
python/samples/getting_started/orchestrations/handoff/handoff_with_code_interpreter_file.py
Show resolved
Hide resolved
python/samples/getting_started/workflows/state-management/workflow_kwargs.py
Show resolved
Hide resolved
python/samples/getting_started/workflows/checkpoint/workflow_as_agent_checkpoint.py
Show resolved
Hide resolved
python/samples/getting_started/workflows/agents/custom_agent_executors.py
Outdated
Show resolved
Hide resolved
python/samples/getting_started/workflows/agents/workflow_as_agent_reflection_pattern.py
Show resolved
Hide resolved
python/samples/getting_started/workflows/agents/workflow_as_agent_reflection_pattern.py
Show resolved
Hide resolved
4 tasks
eavanvalkenburg
approved these changes
Feb 12, 2026
markwallace-microsoft
approved these changes
Feb 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation and Context
This PR standardizes getting-started samples on
AzureOpenAIResponsesClient, restructures orchestration samples by subject, and fixes several runtime issues discovered while validating sample execution.What changed
1) Client standardization in samples
agent_framework.azure.AzureOpenAIResponsesClientazure.identity.AzureCliCredentialAZURE_AI_MODEL_DEPLOYMENT_NAMEAZURE_AI_PROJECT_ENDPOINTas an Azure AI Foundry Agent Service (V2) project endpoint2) Sample reorganization
workflow.as_agent(...)examples fromworkflows/agentsintoorchestrationsconcurrent/sequential/group-chat/handoff/magentic/samples/getting_started/orchestrations/README.mdandsamples/getting_started/workflows/README.mdaccordingly3) Framework/runtime fixes
_agent_executor.pyto correctly flatten/mergeadditional_function_argumentsintooptions.additional_function_arguments(instead of nesting)workflow.run(options=...)AgentExecutorto avoid duplicate history growth_runner.pyto commit state before checkpoint creation so executor snapshots are captured_responses_client.pyassistant text formatting to satisfy Azure Responses validation requirements (output_textwithannotations)_group_chat.pyparsing to handle structured output and concatenated JSON responses reliably4) Sample output/UX fixes
simple_loop,multi_selection_edge_group,fan_out_fan_in_edges)source_executor_idaccess on non-request_infoevents in declarative customer support sampleagents_with_approval_requests.pyTests / validation
packages/core/tests/workflow/test_workflow_kwargs.pypackages/core/tests/workflow/test_full_conversation.pypackages/core/tests/openai/test_openai_responses_client.pypackages/orchestrations/tests/test_group_chat.pypackages/orchestrations/tests/test_magentic.pyNotes
Sample paths changed under
samples/getting_started/orchestrations/**due to folder-based reorganization.Fixes Python: [Bug]: Handoff_with_tool_approval_checkpoint_resume sample is failing #3859
Contribution Checklist