Conversation
Mechanical fixes across 102 English + Spanish example files: - model_id= → model= in all OpenAIChatClient constructors - Message(text=...) → Message(contents=[...]) - BaseContextProvider → ContextProvider - BaseHistoryProvider → HistoryProvider Additional fix for history provider examples: - Removed tools from agent_history_redis.py and agent_history_sqlite.py to work around Responses API duplicate item ID issue with history providers (microsoft/agent-framework#3295) All examples verified with live LLM calls against Azure OpenAI.
Mechanical fixes across 102 English + Spanish example files: - model_id= → model= in all OpenAIChatClient constructors - Message(text=...) → Message(contents=[...]) - BaseContextProvider → ContextProvider - BaseHistoryProvider → HistoryProvider Additional fix for history provider examples: - Removed tools from agent_history_redis.py and agent_history_sqlite.py to work around Responses API duplicate item ID issue with history providers (microsoft/agent-framework#3295) Added manual test plan to AGENTS.md. All examples verified with live LLM calls against Azure OpenAI. Ran pre-commit (ruff lint + format).
07a7022 to
2bde393
Compare
|
For the record, here's the upgrade plan that the agent followed, based off release notes and changelogs: Upgrade Plan: MAF 1.0.0Upgrade all examples (English + Spanish, ~110 files) to Microsoft Agent Framework 1.0.0. Resources consulted
Phase 1: Mechanical fixes (all files, English + Spanish)These are identifiable by search and can be fixed with confidence before running anything. Step 1:
|
| File | Occurrences |
|---|---|
examples/agent_summarization.py |
3 |
examples/agent_middleware.py |
1 |
examples/agent_knowledge_pg.py |
1 |
examples/agent_knowledge_pg_rewrite.py |
3 |
examples/agent_knowledge_postgres.py |
1 |
examples/agent_knowledge_sqlite.py |
1 |
examples/workflow_aggregator_ranked.py |
2 |
examples/workflow_aggregator_structured.py |
1 |
examples/workflow_converge.py |
1 |
examples/workflow_hitl_checkpoint.py |
2 |
examples/workflow_hitl_checkpoint_pg.py |
2 |
examples/workflow_hitl_requests.py |
2 |
examples/workflow_hitl_requests_structured.py |
2 |
examples/workflow_multi_selection_edge_group.py |
1 |
Plus all corresponding examples/spanish/ equivalents.
Step 3: BaseContextProvider → ContextProvider, BaseHistoryProvider → HistoryProvider
From 1.0.0 — Remove deprecated BaseContextProvider and BaseHistoryProvider aliases and rc6 — Context providers can add middleware:
ContextProviderandHistoryProviderare now the canonical Python base classes.BaseContextProviderandBaseHistoryProviderremain temporarily as deprecated aliases... [then in 1.0.0] Remove deprecatedBaseContextProviderandBaseHistoryProvideraliases.
Scope: 5 English + 5 Spanish files.
Before:
from agent_framework import BaseContextProvider
class MyProvider(BaseContextProvider):After:
from agent_framework import ContextProvider
class MyProvider(ContextProvider):Affected files:
| File | Class to rename |
|---|---|
examples/agent_history_sqlite.py |
BaseHistoryProvider → HistoryProvider |
examples/agent_knowledge_pg.py |
BaseContextProvider → ContextProvider |
examples/agent_knowledge_pg_rewrite.py |
BaseContextProvider → ContextProvider |
examples/agent_knowledge_postgres.py |
BaseContextProvider → ContextProvider |
examples/agent_knowledge_sqlite.py |
BaseContextProvider → ContextProvider |
Plus all corresponding examples/spanish/ equivalents.
Phase 2: Run and verify each example group
Run examples in logical groups, simplest first, fixing any additional runtime breakage discovered.
Step 4: Simple agent examples (no external dependencies)
agent_basic.pyagent_tool.pyagent_tools.pyagent_session.pyagent_with_subagent.pyagent_without_subagent.pyagent_supervisor.py
Step 5: Middleware and summarization examples
agent_middleware.pyagent_summarization.pyagent_tool_approval.py
Step 6: Knowledge provider examples (require DB/service setup)
agent_knowledge_sqlite.py— can test locallyagent_knowledge_pg.py— needs Postgresagent_knowledge_pg_rewrite.py— needs Postgresagent_knowledge_postgres.py— needs Postgresagent_knowledge_aisearch.py— needs Azure AI Search
Step 7: Memory/history examples
agent_history_sqlite.py— can test locallyagent_history_redis.py— needs Redisagent_memory_redis.py— needs Redisagent_memory_mem0.py— needs Mem0
Step 8: MCP examples
agent_mcp_local.py— needs local MCP server runningagent_mcp_remote.py— needs remote MCP server
Step 9: OTel / Evaluation examples
agent_otel_aspire.py— needs Aspire dashboardagent_otel_appinsights.py— needs Application Insightsagent_evaluation.py— needs azure-ai-evaluationagent_evaluation_batch.pyagent_evaluation_generate.pyagent_redteam.py— needs red team setup
Step 10: Simple workflow examples
workflow_agents.pyworkflow_agents_sequential.pyworkflow_agents_concurrent.pyworkflow_agents_streaming.pyworkflow_conditional.pyworkflow_conditional_state.pyworkflow_conditional_state_isolated.pyworkflow_conditional_structured.pyworkflow_switch_case.py
Step 11: Complex workflow examples
workflow_converge.pyworkflow_fan_out_fan_in_edges.pyworkflow_aggregator_ranked.pyworkflow_aggregator_structured.pyworkflow_aggregator_summary.pyworkflow_aggregator_voting.pyworkflow_multi_selection_edge_group.pyworkflow_rag_ingest.py
Step 12: HITL and handoff workflow examples
workflow_handoffbuilder.pyworkflow_handoffbuilder_rules.pyworkflow_hitl_handoff.pyworkflow_hitl_requests.pyworkflow_hitl_requests_structured.pyworkflow_hitl_tool_approval.pyworkflow_hitl_checkpoint.pyworkflow_hitl_checkpoint_pg.py— needs Postgres
Step 13: MagenticOne workflow
workflow_magenticone.py
Phase 3: Spanish translations
Step 14: Apply same fixes to all Spanish files
After English files are verified, apply the same mechanical fixes (steps 1–3) to all examples/spanish/ equivalents. Spot-check 3–5 Spanish files to confirm they import and start correctly.
Verification
- After Phase 1 fixes, run
ruff check examples/to catch import errors and unused imports. - For each example in Phase 2, run
python examples/<file>.pyand confirm no import/startup errors. - For interactive examples, confirm at least one successful prompt→response cycle.
- For workflow examples, confirm the workflow runs to completion.
- Spot-check 3–5 Spanish files after Phase 3.
- Final sweep — should return zero hits:
grep -rn "model_id\|BaseContextProvider\|BaseHistoryProvider" examples/
Decisions and notes
.textread access (e.g.,response.text,message.text) is NOT broken — only thetext=constructor kwarg was removed.SupportsAgentRunimport and type hints in custom providers are still valid — no change needed.call_next()in middleware already has no arguments — already correct per the rc5 middleware changes.pyproject.tomlalready has 1.0.0 versions — no dependency changes needed.- Spanish files should mirror English changes exactly (same code, different strings).
- Examples requiring external services (Postgres, Redis, Azure AI Search, etc.) may only be verifiable as "imports and starts without crash" unless those services are available.
There was a problem hiding this comment.
Pull request overview
Upgrades this repository’s Python examples and supporting docs/infra to Microsoft Agent Framework (MAF) 1.0.0, including migration to the Responses API and removal of GitHub Models support.
Changes:
- Migrated examples to MAF 1.0.0 APIs (
model_id→model,Message(text=...)→Message(contents=[...]), provider base class renames). - Removed GitHub Models provider paths and updated default provider settings (now Azure/OpenAI only).
- Updated infra/docs for new default model/deployments (gpt-5.4) and added a manual test plan.
Show a summary per file
| File | Description |
|---|---|
| README.md | Removes GitHub Models guidance; updates provider setup and model/IaC description. |
| pyproject.toml | Pins Agent Framework packages to 1.0.0 / related prereleases; adds OpenAI package. |
| presentations/english/session-6/README.md | Formatting-only update. |
| presentations/english/session-3/README.md | Formatting-only updates across many lines. |
| presentations/english/session-2/README.md | Formatting-only update. |
| presentations/english/session-1/README.md | Formatting-only update. |
| infra/main.bicep | Updates allowed regions and defaults for Responses API + gpt-5.4 deployment/version. |
| examples/workflow_switch_case.py | Removes GitHub provider path; updates OpenAIChatClient params and defaults. |
| examples/workflow_rag_ingest.py | Removes GitHub embeddings path; updates default host and config. |
| examples/workflow_multi_selection_edge_group.py | Removes GitHub provider path; updates Message construction to contents. |
| examples/workflow_magenticone.py | Removes GitHub provider path; updates model defaults to gpt-5.4. |
| examples/workflow_hitl_tool_approval.py | Removes GitHub provider path; updates model defaults to gpt-5.4. |
| examples/workflow_hitl_requests.py | Updates Message construction to contents; removes GitHub provider path. |
| examples/workflow_hitl_requests_structured.py | Updates Message construction to contents; removes GitHub provider path. |
| examples/workflow_hitl_handoff.py | Removes GitHub provider path; updates model defaults to gpt-5.4. |
| examples/workflow_hitl_checkpoint.py | Updates Message construction to contents; removes GitHub provider path. |
| examples/workflow_hitl_checkpoint_pg.py | Fixes imports/formatting; updates Message construction to contents; removes GitHub provider path. |
| examples/workflow_handoffbuilder.py | Removes GitHub provider path; updates model defaults to gpt-5.4. |
| examples/workflow_handoffbuilder_rules.py | Import ordering cleanup; removes GitHub provider path; updates model defaults to gpt-5.4. |
| examples/workflow_fan_out_fan_in_edges.py | Removes GitHub provider path; updates model defaults to gpt-5.4. |
| examples/workflow_converge.py | Removes GitHub provider path; updates assistant message creation to contents. |
| examples/workflow_conditional.py | Removes GitHub provider path; updates model defaults to gpt-5.4. |
| examples/workflow_conditional_structured.py | Removes GitHub provider path; minor print formatting change. |
| examples/workflow_conditional_state.py | Removes GitHub provider path; updates model defaults to gpt-5.4. |
| examples/workflow_conditional_state_isolated.py | Removes GitHub provider path; updates model defaults to gpt-5.4. |
| examples/workflow_aggregator_voting.py | Removes GitHub provider path; updates model defaults to gpt-5.4. |
| examples/workflow_aggregator_summary.py | Removes GitHub provider path; updates model defaults to gpt-5.4. |
| examples/workflow_aggregator_structured.py | Removes GitHub provider path; updates Message construction to contents. |
| examples/workflow_aggregator_ranked.py | Updates Message construction to contents; removes GitHub provider path; print formatting tweaks. |
| examples/workflow_agents.py | Removes GitHub provider path; updates model defaults to gpt-5.4. |
| examples/workflow_agents_streaming.py | Removes GitHub provider path; updates model defaults to gpt-5.4. |
| examples/workflow_agents_sequential.py | Removes GitHub provider path; updates model defaults to gpt-5.4; minor formatting. |
| examples/workflow_agents_concurrent.py | Removes GitHub provider path; updates model defaults to gpt-5.4. |
| examples/sqlite_viewer.py | Formatting cleanup for argparse and tuple unpacking. |
| examples/spanish/workflow_switch_case.py | Spanish mirror: removes GitHub provider path; updates model defaults. |
| examples/spanish/workflow_rag_ingest.py | Spanish mirror: removes GitHub embeddings path; updates defaults. |
| examples/spanish/workflow_multi_selection_edge_group.py | Spanish mirror: updates Message to contents; removes GitHub provider path. |
| examples/spanish/workflow_magenticone.py | Spanish mirror: removes GitHub provider path; updates model defaults. |
| examples/spanish/workflow_hitl_tool_approval.py | Spanish mirror: removes GitHub provider path; updates model defaults. |
| examples/spanish/workflow_hitl_requests.py | Spanish mirror: updates Message to contents; removes GitHub provider path. |
| examples/spanish/workflow_hitl_requests_structured.py | Spanish mirror: updates Message to contents; removes GitHub provider path. |
| examples/spanish/workflow_hitl_handoff.py | Spanish mirror: formatting tweaks; removes GitHub provider path; updates model defaults. |
| examples/spanish/workflow_hitl_checkpoint.py | Spanish mirror: updates Message to contents; removes GitHub provider path. |
| examples/spanish/workflow_hitl_checkpoint_pg.py | Spanish mirror: import/formatting tweaks; updates Message to contents; removes GitHub provider path. |
| examples/spanish/workflow_handoffbuilder.py | Spanish mirror: removes GitHub provider path; updates model defaults. |
| examples/spanish/workflow_handoffbuilder_rules.py | Spanish mirror: removes GitHub provider path; updates model defaults; minor formatting. |
| examples/spanish/workflow_fan_out_fan_in_edges.py | Spanish mirror: removes GitHub provider path; updates model defaults. |
| examples/spanish/workflow_converge.py | Spanish mirror: removes GitHub provider path; updates assistant message creation to contents. |
| examples/spanish/workflow_conditional.py | Spanish mirror: removes GitHub provider path; updates model defaults. |
| examples/spanish/workflow_conditional_structured.py | Spanish mirror: removes GitHub provider path. |
| examples/spanish/workflow_conditional_state.py | Spanish mirror: removes GitHub provider path. |
| examples/spanish/workflow_conditional_state_isolated.py | Spanish mirror: removes GitHub provider path. |
| examples/spanish/workflow_aggregator_voting.py | Spanish mirror: removes GitHub provider path. |
| examples/spanish/workflow_aggregator_summary.py | Spanish mirror: removes GitHub provider path. |
| examples/spanish/workflow_aggregator_structured.py | Spanish mirror: updates Message to contents; removes GitHub provider path. |
| examples/spanish/workflow_aggregator_ranked.py | Spanish mirror: updates Message to contents; removes GitHub provider path; print formatting tweaks. |
| examples/spanish/workflow_agents.py | Spanish mirror: removes GitHub provider path; prompt quoting tweak. |
| examples/spanish/workflow_agents_streaming.py | Spanish mirror: removes GitHub provider path; prompt quoting tweak. |
| examples/spanish/workflow_agents_sequential.py | Spanish mirror: removes GitHub provider path; prompt quoting tweak; minor formatting. |
| examples/spanish/workflow_agents_concurrent.py | Spanish mirror: removes GitHub provider path. |
| examples/spanish/sqlite_viewer.py | Spanish mirror: formatting cleanup for argparse and tuple unpacking. |
| examples/spanish/redis_viewer.py | Spanish mirror: formatting cleanup for Panel prints. |
| examples/spanish/README.md | Spanish README removes GitHub Models guidance and updates IaC model name. |
| examples/spanish/openai_tool_calling.py | Removes GitHub Models branch; updates default OpenAI model. |
| examples/spanish/agent_without_subagent.py | Removes GitHub provider path; updates model defaults; formatting for annotations/strings. |
| examples/spanish/agent_with_subagent.py | Removes GitHub provider path; updates model defaults; formatting cleanup. |
| examples/spanish/agent_tools.py | Removes GitHub provider path; updates model defaults; comment text updated. |
| examples/spanish/agent_tool.py | Removes GitHub provider path; updates model defaults; comment text updated. |
| examples/spanish/agent_tool_approval.py | Removes GitHub provider path; updates model defaults; formats sample DB entries. |
| examples/spanish/agent_supervisor.py | Removes GitHub provider path; updates model defaults; comment text updated. |
| examples/spanish/agent_summarization.py | Updates Message to contents; removes GitHub provider path; updates model defaults. |
| examples/spanish/agent_session.py | Removes GitHub provider path; updates to model= and default model. |
| examples/spanish/agent_redteam.py | Removes GitHub provider path; updates model defaults. |
| examples/spanish/agent_otel_aspire.py | Removes GitHub provider path; updates model defaults; comment text updated. |
| examples/spanish/agent_otel_appinsights.py | Removes GitHub provider path; updates model defaults. |
| examples/spanish/agent_middleware.py | Updates Message to contents; removes GitHub provider path; import ordering cleanup. |
| examples/spanish/agent_memory_redis.py | Removes GitHub provider path; updates model defaults. |
| examples/spanish/agent_memory_mem0.py | Removes GitHub provider path and GitHub-specific mem0 config; updates model defaults. |
| examples/spanish/agent_mcp_remote.py | Removes GitHub provider path; updates model defaults; comment text updated. |
| examples/spanish/agent_mcp_local.py | Removes GitHub provider path; updates MCP URL default and example prompt; updates model defaults. |
| examples/spanish/agent_knowledge_sqlite.py | Renames BaseContextProvider → ContextProvider; updates Message to contents; removes GitHub provider path. |
| examples/spanish/agent_knowledge_postgres.py | Renames BaseContextProvider → ContextProvider; removes GitHub provider path; updates Message to contents. |
| examples/spanish/agent_knowledge_pg.py | Renames BaseContextProvider → ContextProvider; removes GitHub provider path; updates Message to contents. |
| examples/spanish/agent_knowledge_pg_rewrite.py | Renames BaseContextProvider → ContextProvider; removes GitHub provider path; updates Message to contents. |
| examples/spanish/agent_knowledge_aisearch.py | Updates terminology to ContextProvider; removes GitHub provider path; updates model defaults. |
| examples/spanish/agent_history_sqlite.py | Switches BaseHistoryProvider → HistoryProvider and removes tools to avoid Responses API replay issues. |
| examples/spanish/agent_history_redis.py | Removes tools to avoid Responses API replay issues; removes GitHub provider path. |
| examples/spanish/agent_evaluation.py | Removes GitHub Models evaluator config; updates model defaults to gpt-5.4. |
| examples/spanish/agent_evaluation_generate.py | Removes GitHub provider path; updates model defaults. |
| examples/spanish/agent_evaluation_batch.py | Import ordering cleanup; removes GitHub evaluator config; updates model default. |
| examples/spanish/agent_basic.py | Removes GitHub provider path; updates model defaults; formatting cleanup. |
| examples/redis_viewer.py | Formatting cleanup for Panel prints. |
| examples/openai_tool_calling.py | Removes GitHub Models branch; updates default OpenAI model. |
| examples/expenses.csv | Updates sample data used by MCP server. |
| examples/agent_without_subagent.py | Removes GitHub provider path; updates model defaults; formatting cleanup. |
| examples/agent_with_subagent.py | Removes GitHub provider path; updates model defaults; formatting cleanup. |
| examples/agent_tools.py | Removes GitHub provider path; updates model defaults. |
| examples/agent_tool.py | Removes GitHub provider path; updates model defaults; minor formatting. |
| examples/agent_tool_approval.py | Removes GitHub provider path; updates model defaults. |
| examples/agent_supervisor.py | Removes GitHub provider path; updates model defaults. |
| examples/agent_summarization.py | Updates Message to contents; removes GitHub provider path; updates model defaults. |
| examples/agent_session.py | Removes GitHub provider path; updates to model= and default model. |
| examples/agent_redteam.py | Removes GitHub provider path; updates model defaults. |
| examples/agent_otel_aspire.py | Removes GitHub provider path; updates model defaults. |
| examples/agent_otel_appinsights.py | Removes GitHub provider path; updates model defaults. |
| examples/agent_middleware.py | Updates Message to contents; removes GitHub provider path; import ordering cleanup. |
| examples/agent_memory_redis.py | Removes GitHub provider path; updates model defaults. |
| examples/agent_memory_mem0.py | Removes GitHub provider path and GitHub-specific mem0 config; updates model defaults. |
| examples/agent_mcp_remote.py | Removes GitHub provider path; updates model defaults. |
| examples/agent_mcp_local.py | Removes GitHub provider path; updates MCP URL default and example prompt; updates model defaults. |
| examples/agent_knowledge_sqlite.py | Renames BaseContextProvider → ContextProvider; updates Message to contents; removes GitHub provider path. |
| examples/agent_knowledge_postgres.py | Renames BaseContextProvider → ContextProvider; removes GitHub provider path; updates Message to contents. |
| examples/agent_knowledge_pg.py | Renames BaseContextProvider → ContextProvider; removes GitHub provider path; updates Message to contents. |
| examples/agent_knowledge_pg_rewrite.py | Renames BaseContextProvider → ContextProvider; removes GitHub provider path; updates Message to contents. |
| examples/agent_knowledge_aisearch.py | Updates terminology to ContextProvider; removes GitHub provider path; updates model defaults. |
| examples/agent_history_sqlite.py | Switches BaseHistoryProvider → HistoryProvider and removes tools to avoid Responses API replay issues. |
| examples/agent_history_redis.py | Removes tools to avoid Responses API replay issues; removes GitHub provider path. |
| examples/agent_evaluation.py | Removes GitHub Models evaluator config; updates model defaults to gpt-5.4. |
| examples/agent_evaluation_generate.py | Removes GitHub provider path; updates model defaults. |
| examples/agent_evaluation_batch.py | Import ordering cleanup; removes GitHub evaluator config; updates model default. |
| examples/agent_basic.py | Removes GitHub provider path; updates model defaults. |
| AGENTS.md | Adds a structured manual test plan for validating upgraded examples. |
| .github/prompts/update_translations.prompt.md | Formatting-only update. |
| .env.sample | Removes GitHub Models settings; updates OpenAI model default and API_HOST options. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 121/128 changed files
- Comments generated: 5
|
lgtm, I ran most of the Spanish ones. |
…dry, fix redis_history_provider.py consistency, clean up expenses.csv
Summary
Upgrades all ~110 example files (English + Spanish) to Microsoft Agent Framework 1.0.0
Changes
Phase 1: Mechanical fixes (102 files)
model_id=→model=in allOpenAIChatClientconstructors (101 files)Message(text=...)→Message(contents=[...])(28 files)BaseContextProvider→ContextProviderandBaseHistoryProvider→HistoryProvider(10 files)Phase 2: Runtime fixes
OpenAIChatClientto the Responses API, which causes duplicaters_*item ID errors when history providers replay messages containing tool call results. See microsoft/agent-framework#3295. The examples now use text-only conversations, matching the official MAF Redis history sample. MAF team is working on a real fix.Phase 3: Remove GitHub Models support
GitHub Models does not support the OpenAI Responses API, which MAF 1.0.0's
OpenAIChatClientnow uses by default. Since all examples now run on the Responses API, GitHub Models is no longer a viable provider for this repo.Notably, this repo does not currently have support for Ollama/SLMs, so the only options are Azure OpenAI or OpenAI.com.
Phase 4: Upgrade to gpt-5.4
gpt-5.4 now has wide region support, so this is a good time to move to it.
Verification
model_id,BaseContextProvider,BaseHistoryProvider