Add HITL workflow examples, Spanish translations, and slide plan#25
Merged
pamelafox merged 9 commits intoAzure-Samples:mainfrom Mar 3, 2026
Merged
Add HITL workflow examples, Spanish translations, and slide plan#25pamelafox merged 9 commits intoAzure-Samples:mainfrom
pamelafox merged 9 commits intoAzure-Samples:mainfrom
Conversation
New example files: - agent_tool_approval.py: Standalone agent with tool approval - workflow_hitl_requests.py: Simple always-ask HITL chat - workflow_hitl_requests_structured.py: Trip planner with structured outputs - workflow_hitl_tool_approval.py: Email agent workflow with tool approval - workflow_hitl_checkpoint.py: Content review with FileCheckpointStorage - workflow_hitl_checkpoint_pg.py: Custom PostgresCheckpointStorage backend - workflow_hitl_handoff.py: Interactive handoff (no autonomous mode) - workflow_hitl_handoff_approval.py: Handoff + tool approval combined - workflow_hitl_magentic.py: Magentic plan review Changes: - Renamed workflow_hitl_handoff.py -> workflow_hitl_handoff_approval.py - Created new simpler workflow_hitl_handoff.py (user input only) - Removed workflow_magenticone.py (not covered in presentation) - Added all 9 Spanish translations - Updated both README.md files with new examples - Updated plan.md with finalized slide content and speaker notes
Contributor
There was a problem hiding this comment.
Pull request overview
Adds Human-in-the-Loop (HITL) workflow/agent examples (tool approval, request/response loops, checkpoints/resume, handoff, Magentic plan review), plus Spanish translations and presentation planning materials to support the Session 6 “Adding a human-in-the-loop to workflows” content.
Changes:
- Added multiple new HITL Python examples (and Spanish equivalents) covering tool approval, request/response patterns, checkpointing (file + Postgres), handoff, and Magentic plan review.
- Updated READMEs and
.gitignoreto document examples and ignore checkpoint artifacts. - Added slide plan / prior-session ASCII exports and introduced a reusable GitHub “pptx-from-template” skill.
Reviewed changes
Copilot reviewed 25 out of 26 changed files in this pull request and generated 19 comments.
Show a summary per file
| File | Description |
|---|---|
| plan.md | Slide plan/outline for the HITL workflows session |
| first_workflows.md | ASCII export of prior “First workflows” slide deck |
| advanced_workflows.md | ASCII export of prior “Advanced workflows” slide deck |
| examples/workflow_magenticone.py | Removed MagenticOne example (superseded/unstable per PR description) |
| examples/agent_tool_approval.py | New standalone agent example demonstrating tool approval |
| examples/workflow_hitl_tool_approval.py | New workflow example demonstrating tool approval loop |
| examples/workflow_hitl_requests.py | New “always ask” request/response HITL workflow |
| examples/workflow_hitl_requests_structured.py | New structured-output HITL workflow where agent decides ask vs finish |
| examples/workflow_hitl_checkpoint.py | New file-based checkpoint + HITL resume example |
| examples/workflow_hitl_checkpoint_pg.py | New Postgres-backed checkpoint storage + resume example |
| examples/workflow_hitl_handoff.py | New interactive handoff example (no autonomous mode) |
| examples/workflow_hitl_magentic.py | New Magentic plan-review HITL example |
| examples/spanish/README.md | Spanish README updated with new entries |
| examples/spanish/agent_tool_approval.py | Spanish translation of tool approval agent example |
| examples/spanish/workflow_hitl_tool_approval.py | Spanish translation of tool approval workflow example |
| examples/spanish/workflow_hitl_requests.py | Spanish translation of always-ask HITL workflow |
| examples/spanish/workflow_hitl_requests_structured.py | Spanish translation of structured HITL workflow |
| examples/spanish/workflow_hitl_checkpoint.py | Spanish translation of checkpoint HITL example |
| examples/spanish/workflow_hitl_checkpoint_pg.py | Spanish translation of Postgres checkpoint HITL example |
| examples/spanish/workflow_hitl_handoff.py | Spanish translation of interactive handoff example |
| examples/spanish/workflow_hitl_magentic.py | Spanish translation of Magentic plan-review HITL example |
| README.md | Root README updated to list new HITL examples |
| .gitignore | Ignore workflow checkpoint directory under examples/ |
| .devcontainer/devcontainer.json | Added PostgreSQL VS Code extension |
| .github/skills/pptx-from-template/pptx_from_template.py | Helper script for generating PPTX from a template |
| .github/skills/pptx-from-template/SKILL.md | Documentation for the PPTX template skill |
Comments suppressed due to low confidence (1)
examples/spanish/workflow_hitl_tool_approval.py:221
- The HITL yes/no prompt uses
(y/n)here, but other Spanish HITL examples in this repo use bilingual control words and Spanish yes/no (s/n). Consider switching to(s/n)(or accepting both) to match the repo’s Spanish HITL convention and reduce user confusion.
approval = input(" ¿Aprobar/Approve? (y/n): ").strip().lower()
approved = approval == "y"
print(f" {'✅ Aprobado' if approved else '❌ Rechazado'}\n")
responses[request_info_event.request_id] = data.to_function_approval_response(approved=approved)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
madebygps
reviewed
Mar 3, 2026
Collaborator
|
2 comments and LGTM |
- Fix docstring in workflow_hitl_tool_approval.py to match implementation - Replace json.dumps with Jsonb adapter in workflow_hitl_checkpoint_pg.py - Move WorkflowCheckpoint to public import path - Translate tool docstrings to Spanish in spanish/ examples - Translate 'goodbye' termination to Spanish in workflow_hitl_handoff.py - Fix run command filename in workflow_hitl_requests.py - Remove misleading 'exit' from prompts in workflow_hitl_requests_structured.py - Update AGENTS.md to clarify @tool docstring translation rule
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
Adds new Human-in-the-Loop (HITL) example files for the Microsoft Agent Framework, along with Spanish translations and README updates. These examples support the "Adding a human-in-the-loop to workflows" presentation (Session 6 of the Python + Agents series).
Based off this plan:
https://gist.github.com/pamelafox/e2c01f0a331b14a309a59063db59855e
New Example Files
Tool Approval
agent_tool_approval.py@tool(approval_mode="always_require")— no workflow neededworkflow_hitl_tool_approval.pyRequests & Responses
workflow_hitl_requests.pyctx.request_info()and@response_handlerworkflow_hitl_requests_structured.pyPlannerOutput) — agent decides when to ask vs. finishCheckpoints & Resuming
workflow_hitl_checkpoint.pyFileCheckpointStorage— exit process and resume from checkpointworkflow_hitl_checkpoint_pg.pyPostgresCheckpointStoragebackendHandoff with HITL
workflow_hitl_handoff.pyHandoffAgentUserRequestRemoved Examples
workflow_hitl_handoff_approval.py— Handoff + tool approval combined. Removed due to framework bug (microsoft/agent-framework#4411).workflow_hitl_magentic.py— Magentic orchestration with plan review. Removed due to instability; not referenced from slides.workflow_magenticone.py— Superseded by the above (also removed).Other Changes
examples/spanish/following AGENTS.md conventions (LATAM Spanish, tuteo)examples/checkpoints/Key Patterns Demonstrated
@tool(approval_mode="always_require")with standaloneAgentand in workflowsctx.request_info()/@response_handlerfor custom HITL request/response cyclesFileCheckpointStorage+workflow.run(checkpoint_id=...)for durable resumeCheckpointStorageprotocol implementation (PostgreSQL)HandoffBuilderwithout.with_autonomous_mode()for interactive multi-agent routing