Add new examples, reorganize files, and improve repo setup#2
Merged
pamelafox merged 7 commits intoAzure-Samples:mainfrom Feb 10, 2026
Merged
Add new examples, reorganize files, and improve repo setup#2pamelafox merged 7 commits intoAzure-Samples:mainfrom
pamelafox merged 7 commits intoAzure-Samples:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR expands and reorganizes the repository’s Python example set (including Spanish translations), adds MCP and low-level OpenAI tool-calling samples, and improves repo setup/consistency (deps + line endings).
Changes:
- Added new examples: middleware demos, MCP local/remote agent examples, MCP server, and low-level OpenAI tool-calling (EN + ES).
- Standardized example naming (agent_/workflow_/openai_) and refreshed README tables.
- Repo-wide setup improvements: add
fastmcp, enforce line endings via.gitattributes, and normalize env/bootstrap scripts.
Reviewed changes
Copilot reviewed 29 out of 32 changed files in this pull request and generated 14 comments.
Show a summary per file
| File | Description |
|---|---|
| requirements.txt | Adds fastmcp dependency for MCP server example. |
| infra/write_dot_env.sh | Normalizes line endings (LF) and keeps env-writing logic. |
| infra/write_dot_env.ps1 | Normalizes line endings / formatting. |
| examples/workflow_magenticone.py | Adds --devui entrypoint option to MagenticOne workflow example. |
| examples/workflow_hitl.py | Removes Ollama path; normalizes line endings. |
| examples/workflow_basic.py | Removes Ollama path; keeps DevUI-based workflow example. |
| examples/spanish/workflow_magenticone.py | Spanish MagenticOne workflow + --devui option. |
| examples/spanish/workflow_hitl.py | Spanish HITL workflow; removes Ollama path. |
| examples/spanish/workflow_basic.py | Spanish workflow example; removes Ollama path. |
| examples/spanish/openai_tool_calling.py | Spanish low-level OpenAI SDK tool-calling example. |
| examples/spanish/mcp_server.py | Spanish MCP expense-tracking server example. |
| examples/spanish/agent_tools.py | Spanish tools example + optional DevUI mode. |
| examples/spanish/agent_tool.py | Spanish single-tool agent example; removes Ollama path. |
| examples/spanish/agent_supervisor.py | Spanish supervisor example + optional DevUI mode. |
| examples/spanish/agent_middleware.py | Spanish middleware example + optional DevUI mode. |
| examples/spanish/agent_mcp_remote.py | Spanish remote MCP agent example (Microsoft Learn MCP). |
| examples/spanish/agent_mcp_local.py | Spanish local MCP agent example (connects to local MCP server). |
| examples/spanish/agent_basic.py | Spanish basic agent example; removes Ollama path. |
| examples/spanish/README.md | Updates Spanish examples table to new names + new examples. |
| examples/openai_tool_calling.py | Adds low-level OpenAI SDK tool-calling example (EN). |
| examples/mcp_server.py | Adds MCP expense-tracking server example (EN). |
| examples/expenses.csv | Adds a sample CSV data file used by the MCP server example. |
| examples/agent_tools.py | Adds optional DevUI mode and naming to tools agent example (EN). |
| examples/agent_tool.py | Removes Ollama path; line ending normalization (EN). |
| examples/agent_supervisor.py | Adds optional DevUI mode and naming to supervisor example (EN). |
| examples/agent_middleware.py | Adds middleware example (EN) + optional DevUI mode. |
| examples/agent_mcp_remote.py | Adds remote MCP agent example (EN). |
| examples/agent_mcp_local.py | Adds local MCP agent example (EN). |
| examples/agent_basic.py | Removes Ollama path; line ending normalization (EN). |
| README.md | Updates examples table with new names + new examples. |
| .gitattributes | Enforces LF for .sh and CRLF for .ps1 in working tree. |
| .env.sample | Removes Ollama sample config and updates supported API hosts. |
Comments suppressed due to low confidence (11)
examples/agent_supervisor.py:196
- With
--devui, the script callsserve(...)and never runsmain(), soasync_credential.close()is skipped when using Azure auth. Move credential creation/cleanup into a context that also covers DevUI execution, or add an exit hook to close the credential.
examples/spanish/agent_tools.py:108 - With
--devui, the script callsserve(...)and never runsmain(), soasync_credential.close()is skipped when using Azure auth. Move credential creation/cleanup into a context that also covers DevUI execution, or add an exit hook to close the credential.
examples/spanish/agent_supervisor.py:204 - With
--devui, the script callsserve(...)and never runsmain(), soasync_credential.close()is skipped when using Azure auth. Move credential creation/cleanup into a context that also covers DevUI execution, or add an exit hook to close the credential.
examples/spanish/workflow_magenticone.py:181 - With
--devui, the script callsserve(...)and never runsmain(), soasync_credential.close()is skipped when using Azure auth. Move credential creation/cleanup into a context that also covers DevUI execution, or add an exit hook to close the credential.
examples/agent_tools.py:107 - With
--devui, the script callsserve(...)and never runsmain(), soasync_credential.close()is skipped when using Azure auth. Move credential creation/cleanup into a context that also covers DevUI execution, or add an exit hook to close the credential.
examples/workflow_basic.py:22 - When
API_HOST == "azure",DefaultAzureCredential()(aio) is created but never closed. Since this script starts a long-lived DevUI server, the credential and underlying HTTP session can leak resources. Consider using the sync credential here, or registering an on-exit cleanup that closesasync_credential.
examples/workflow_magenticone.py:181 - With
--devui, the script callsserve(...)and never runsmain(), soasync_credential.close()is skipped when using Azure auth. Move credential creation/cleanup into a context that also covers DevUI execution, or add an exit hook to close the credential.
examples/workflow_hitl.py:238 - Variable last_executor is not used.
examples/spanish/workflow_hitl.py:240 - Variable ultimo_ejecutor is not used.
examples/workflow_hitl.py:322 - This statement is unreachable.
examples/spanish/workflow_hitl.py:325 - This statement is unreachable.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
tweaked some spanish words and ran pre-commit
…localhost binding
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.
Summary
This PR adds new examples, reorganizes existing files with clearer naming, and makes several repo-wide improvements.
New examples
agent_middleware.py— Demonstrates agent, chat, and function middleware for logging, timing, and request blocking (both function-based and class-based middleware).openai_tool_calling.py— Low-level OpenAI SDK tool calling with manual JSON argument parsing and tool dispatch (no Agent Framework abstraction).agent_mcp_remote.py— Agent using a remote MCP server (Microsoft Learn athttps://learn.microsoft.com/api/mcp) for documentation search.agent_mcp_local.py+mcp_server.py— Agent connecting to a local FastMCP expense-tracking server.File renames (clearer prefixes)
All examples are now prefixed by category:
agent_*— Single-agent examples usingChatAgentworkflow_*— Multi-agent workflows (WorkflowBuilder,MagenticBuilder)openai_*— Raw OpenAI SDK examplesbasic.pyagent_basic.pytool.pyagent_tool.pytools.pyagent_tools.pysupervisor.pyagent_supervisor.pymiddleware.pyagent_middleware.pyhitl.pyworkflow_hitl.pymagenticone.pyworkflow_magenticone.pyworkflow.pyworkflow_basic.pyDevUI support
Added optional
--devuiflag to select examples (agent_tools,agent_supervisor,agent_middleware,workflow_magenticone). Run withpython examples/agent_tools.py --devuito launch the web UI instead of console output.Repo-wide changes
.env.sampleinfra/write_dot_env.sh.gitattributesto enforce LF for.shand CRLF for.ps1fastmcptorequirements.txt(for MCP server example)Spanish translations
All new examples have corresponding Spanish translations in
examples/spanish/, and the Spanish README is synced with the English version.