Skip to content

Python: fix and unify devui samples#5025

Merged
eavanvalkenburg merged 1 commit intomicrosoft:mainfrom
eavanvalkenburg:fix_devui_samples
Apr 1, 2026
Merged

Python: fix and unify devui samples#5025
eavanvalkenburg merged 1 commit intomicrosoft:mainfrom
eavanvalkenburg:fix_devui_samples

Conversation

@eavanvalkenburg
Copy link
Copy Markdown
Member

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

  • 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 April 1, 2026 10:31
@markwallace-microsoft markwallace-microsoft added documentation Improvements or additions to documentation python labels Apr 1, 2026
Copy link
Copy Markdown
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 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 .env plus 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.py and update README.md to 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 constructs AzureCliCredential() inline in FoundryChatClient(...) 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 a project_client) and register credential.close (and/or client.project_client.close) via register_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 constructing FoundryChatClient. Since DevUI can’t reliably close credentials that aren’t attached to the client object, prefer creating the credential as a named variable and registering credential.close via agent_framework.devui.register_cleanup to avoid resource leaks on shutdown.
    python/samples/02-agents/devui/workflow_with_agents/workflow.py:72
  • OpenAIChatClient wraps credential into a token provider and does not retain the original credential object, so DevUI shutdown cleanup won’t be able to close the AzureCliCredential() created inline here. Prefer creating the credential as a variable and registering credential.close via agent_framework.devui.register_cleanup (or using an async credential context) to prevent resource leaks.

Comment thread python/samples/02-agents/devui/in_memory_mode.py
Copy link
Copy Markdown
Member

@rogerbarreto rogerbarreto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CLG, worth checking why workflow-declarative is not using FoundryChatClient anymore

@eavanvalkenburg eavanvalkenburg added this pull request to the merge queue Apr 1, 2026
Merged via the queue into microsoft:main with commit 2cb78ea Apr 1, 2026
37 checks passed
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.

5 participants