Skip to content

Add new examples, reorganize files, and improve repo setup#2

Merged
pamelafox merged 7 commits intoAzure-Samples:mainfrom
pamelafox:pamela-examples
Feb 10, 2026
Merged

Add new examples, reorganize files, and improve repo setup#2
pamelafox merged 7 commits intoAzure-Samples:mainfrom
pamelafox:pamela-examples

Conversation

@pamelafox
Copy link
Copy Markdown
Contributor

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 at https://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 using ChatAgent
  • workflow_* — Multi-agent workflows (WorkflowBuilder, MagenticBuilder)
  • openai_* — Raw OpenAI SDK examples
Old name New name
basic.py agent_basic.py
tool.py agent_tool.py
tools.py agent_tools.py
supervisor.py agent_supervisor.py
middleware.py agent_middleware.py
hitl.py workflow_hitl.py
magenticone.py workflow_magenticone.py
workflow.py workflow_basic.py

DevUI support

Added optional --devui flag to select examples (agent_tools, agent_supervisor, agent_middleware, workflow_magenticone). Run with python examples/agent_tools.py --devui to launch the web UI instead of console output.

Repo-wide changes

  • Removed Ollama support from all examples and .env.sample
  • Fixed CRLF line endings in infra/write_dot_env.sh
  • Added .gitattributes to enforce LF for .sh and CRLF for .ps1
  • Added fastmcp to requirements.txt (for MCP server example)
  • Cleaned up README descriptions — removed redundant "Uses Agent Framework" prefix from table

Spanish translations

All new examples have corresponding Spanish translations in examples/spanish/, and the Spanish README is synced with the English version.

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 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 calls serve(...) and never runs main(), so async_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 calls serve(...) and never runs main(), so async_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 calls serve(...) and never runs main(), so async_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 calls serve(...) and never runs main(), so async_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 calls serve(...) and never runs main(), so async_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 closes async_credential.
    examples/workflow_magenticone.py:181
  • With --devui, the script calls serve(...) and never runs main(), so async_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.

Comment thread examples/spanish/openai_tool_calling.py Outdated
Comment thread examples/mcp_server.py
Comment thread .env.sample Outdated
Comment thread examples/agent_middleware.py
Comment thread examples/spanish/mcp_server.py
Comment thread examples/openai_tool_calling.py Outdated
Comment thread examples/mcp_server.py
Comment thread examples/mcp_server.py Outdated
Comment thread examples/expenses.csv
Comment thread examples/spanish/mcp_server.py
Copy link
Copy Markdown
Collaborator

@madebygps madebygps left a comment

Choose a reason for hiding this comment

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

lgtm

@pamelafox pamelafox merged commit a23e190 into Azure-Samples:main Feb 10, 2026
1 check passed
@pamelafox pamelafox deleted the pamela-examples branch February 10, 2026 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants