Python: fix and unify devui samples#5025
Merged
eavanvalkenburg merged 1 commit intomicrosoft:mainfrom Apr 1, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Python DevUI samples to be runnable again and more consistent, including standardizing naming/config, adding new workflow samples, and adding a folder-level launcher plus refreshed documentation to support DevUI directory discovery.
Changes:
- Standardize DevUI sample configuration around shared/root
.envplus per-sample overrides, and update samples to use Azure CLI auth where appropriate. - Add/refresh multiple discoverable DevUI workflow samples (agents-as-executors, spam/HIL, fan-in/fan-out, declarative YAML) and package scaffolding.
- Add
python/samples/02-agents/devui/main.pyand updateREADME.mdto document programmatic vs discovery-based launch modes.
Reviewed changes
Copilot reviewed 18 out of 28 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| python/samples/05-end-to-end/evaluation/foundry_evals/evaluate_tool_calls_sample.py | Minor string formatting tweak in evaluation sample instructions. |
| python/samples/04-hosting/a2a/a2a_agent_as_function_tools.py | Minor formatting change for env-var error message. |
| python/samples/02-agents/devui/workflow_with_agents/workflow.py | Switch workflow sample to OpenAIChatClient (Azure OpenAI Responses) with Azure CLI auth. |
| python/samples/02-agents/devui/workflow_with_agents/.env.example | Add Azure OpenAI Responses env template for this workflow sample. |
| python/samples/02-agents/devui/workflow_with_agents/init.py | Make package export workflow for discovery. |
| python/samples/02-agents/devui/workflow_spam/workflow.py | Add a multi-step spam workflow sample with HIL approval and branching. |
| python/samples/02-agents/devui/workflow_spam/init.py | Export workflow for discovery. |
| python/samples/02-agents/devui/workflow_fanout/workflow.py | Add a complex fan-in/fan-out workflow sample demonstrating parallel stages. |
| python/samples/02-agents/devui/workflow_fanout/init.py | Add package marker/docstring for fanout workflow sample. |
| python/samples/02-agents/devui/workflow_declarative/workflow.yaml | Add YAML-defined conditional workflow for declarative demo. |
| python/samples/02-agents/devui/workflow_declarative/workflow.py | Add a DevUI runner that loads the declarative YAML via WorkflowFactory. |
| python/samples/02-agents/devui/workflow_declarative/init.py | Add package marker/docstring for declarative workflow sample. |
| python/samples/02-agents/devui/workflow_agents/.env.example | Remove per-sample env example (migrating toward shared/root env approach). |
| python/samples/02-agents/devui/weather_agent_azure/.env.example | Remove per-sample env example (migrating toward shared/root env approach). |
| python/samples/02-agents/devui/README.md | Rewrite DevUI samples README to document launch modes, discovery, and env precedence. |
| python/samples/02-agents/devui/main.py | Add folder-level launcher to load root .env then run DevUI discovery on the folder. |
| python/samples/02-agents/devui/in_memory_mode.py | Update in-memory sample to use Foundry + Azure CLI credential and rename agent variable. |
| python/samples/02-agents/devui/foundry_agent/.env.example | Remove per-sample env example (migrating toward shared/root env approach). |
| python/samples/02-agents/devui/azure_responses_agent/agent.py | Remove the Azure Responses agent sample implementation. |
| python/samples/02-agents/devui/azure_responses_agent/.env.example | Remove Azure Responses agent env template. |
| python/samples/02-agents/devui/azure_responses_agent/init.py | Remove Azure Responses agent package export. |
| python/samples/02-agents/devui/agent_weather/agent.py | Rename/retarget agent to Foundry settings and Azure CLI auth; update logs and sample config. |
| python/samples/02-agents/devui/agent_weather/.env.example | Add Foundry env template for this agent sample. |
| python/samples/02-agents/devui/agent_weather/init.py | Export agent for discovery. |
| python/samples/02-agents/devui/agent_foundry/agent.py | Fix Foundry client parameter name (model) in minimal Foundry agent sample. |
| python/samples/02-agents/devui/agent_foundry/.env.example | Add Foundry env template for this agent sample. |
| python/samples/02-agents/devui/agent_foundry/init.py | Export agent for discovery. |
| python/samples/02-agents/devui/.env.example | Add shared/root env template used by launcher and as discovery fallback. |
Comments suppressed due to low confidence (4)
python/samples/02-agents/devui/agent_weather/agent.py:160
cleanup_resources()claims credentials/sessions would be closed, but the sample constructsAzureCliCredential()inline inFoundryChatClient(...)and doesn’t register any hook to close it. DevUI’s automatic shutdown cleanup won’t be able to close this credential unless you keep a reference (or pass aproject_client) and registercredential.close(and/orclient.project_client.close) viaregister_cleanup.
python/samples/02-agents/devui/agent_weather/agent.py:182- This sample prints a hard-coded “Entity ID: agent_WeatherAgent”, but
serve(entities=[agent], ...)registers in-memory entities with a generated ID that includes a UUID (see DevUI’s_generate_entity_id). Consider removing this line or updating it to avoid implying a stable ID.
python/samples/02-agents/devui/agent_foundry/agent.py:58 - This agent creates
AzureCliCredential()inline when constructingFoundryChatClient. Since DevUI can’t reliably close credentials that aren’t attached to the client object, prefer creating the credential as a named variable and registeringcredential.closeviaagent_framework.devui.register_cleanupto avoid resource leaks on shutdown.
python/samples/02-agents/devui/workflow_with_agents/workflow.py:72 OpenAIChatClientwrapscredentialinto a token provider and does not retain the original credential object, so DevUI shutdown cleanup won’t be able to close theAzureCliCredential()created inline here. Prefer creating the credential as a variable and registeringcredential.closeviaagent_framework.devui.register_cleanup(or using an async credential context) to prevent resource leaks.
westey-m
approved these changes
Apr 1, 2026
rogerbarreto
approved these changes
Apr 1, 2026
Member
rogerbarreto
left a comment
There was a problem hiding this comment.
CLG, worth checking why workflow-declarative is not using FoundryChatClient anymore
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
Fixes all the devui samples, unifies naming, adds a main runner that uses folder discovery and updates the README
Description
Contribution Checklist