@@ -173,7 +173,6 @@ Today we'll cover...
173173• Requests and responses: structured human interaction
174174• Checkpoints and resuming: durable HITL workflows
175175• Handoff with HITL: interactive multi-agent routing
176- • Magentic with HITL: plan review before execution
177176```
178177
179178### Slide 4: Follow along
@@ -248,6 +247,7 @@ HITL patterns in agent-framework
248247
249248 Magentic + HITL Complex planning with human review
250249 before executing multi-step plans
250+ (not covered today)
251251```
252252
253253### Slide 9: Section — Tool Approval
@@ -767,7 +767,43 @@ Speaker notes:
767767 any backend you want. Let's see what that looks like with PostgreSQL."
768768```
769769
770- ### Slide 26: Custom checkpoint storage — PostgreSQL example
770+ ### Slide 26: Designing checkpoint storage
771+ ```
772+ Designing your checkpoint storage
773+
774+ Schema example (PostgreSQL):
775+
776+ id workflow_name timestamp data
777+ ───────────── ──────────────── ───────────────────────── ──────────────
778+ abc-001 content_review 2026-03-03T14:22:01+00:00 {"executor_ ...
779+ abc-002 content_review 2026-03-03T14:22:03+00:00 {"executor_ ...
780+ def-001 trip_planner:42 2026-03-03T15:10:44+00:00 {"executor_ ...
781+
782+ Design decisions to consider:
783+
784+ Question Considerations
785+ ──────────────────────── ──────────────────────────────────
786+ How to scope checkpoints? Per workflow name? Per user/session?
787+ e.g. workflow_name = "review:{user_id}"
788+
789+ How long to keep them? Prune after completion? TTL? Keep N latest?
790+
791+ How large are they? Checkpoints include full message history.
792+ Long conversations = large JSONB blobs.
793+
794+ Who can access them? Row-level security? Separate tables per tenant?
795+
796+ Speaker notes:
797+ "Before you write code, think about your schema. At minimum you need an ID,
798+ the workflow name for filtering, and a timestamp for ordering. The data column
799+ stores the encoded checkpoint as JSON — the framework handles serialization for you.
800+ The harder questions are around scoping and lifecycle. In a multi-user app, do you
801+ embed the user ID in the workflow name, or add a user_id column? How do you prune
802+ old checkpoints? These are application-level decisions the framework doesn't make
803+ for you."
804+ ```
805+
806+ ### Slide 27: Custom checkpoint storage — PostgreSQL example
771807```
772808agent-framework
773809
@@ -871,96 +907,7 @@ for event in pending_requests:
871907Full example: workflow_hitl_handoff.py
872908```
873909
874- ### Slide 28: Section — Magentic with HITL
875- ```
876- Magentic with HITL
877- https://learn.microsoft.com/agent-framework/workflows/orchestrations/magentic
878- ```
879-
880- ### Slide 29: Magentic plan review
881- ```
882- Magentic orchestration with HITL plan review
883-
884- Magentic orchestrator
885-
886- Task ledger Progress ledger
887-
888- ┌─────────────────────┐
889- │ Plan Review (HITL) │
890- │ │
891- │ Human can: │
892- │ • Approve plan │
893- │ • Revise plan │
894- └─────────────────────┘
895-
896-
897- Agent A Agent B Agent C
898-
899- Enable with:
900- workflow = MagenticBuilder(
901- participants=[ ...] ,
902- enable_plan_review=True,
903- manager_agent=manager_agent,
904- ).build()
905- ```
906-
907- ### Slide 30: Magentic HITL code
908- ```
909- agent-framework
910-
911- Handling Magentic plan review requests
912-
913- async for event in workflow.run_stream(task):
914- if event.type == "output" and isinstance(event.data, AgentResponseUpdate):
915- print(event.data, end="", flush=True)
916-
917- elif event.type == "request_info" and event.request_type is MagenticPlanReviewRequest:
918- plan_request = event
919-
920- if plan_request:
921- event_data = plan_request.data
922- print(f"Proposed Plan:\n{event_data.plan.text}")
923-
924- reply = input("Feedback (Enter to approve): ")
925- if reply.strip() == "":
926- responses = {plan_request.request_id: event_data.approve()}
927- else:
928- responses = {plan_request.request_id: event_data.revise(reply)}
929-
930- async for event in workflow.run(responses=responses):
931- # ... handle output events
932-
933- Full example: workflow_hitl_magentic.py
934- ```
935-
936- ### Slide 31: HITL patterns comparison
937- ```
938- Choosing the right HITL pattern
939-
940- Pattern Trigger Response type Best for
941-
942- Tool Approval @tool (approval_mode= Approve/Reject Gating sensitive
943- "always_require") boolean operations
944- Works with Agent or (no workflow needed)
945- workflows
946-
947- Requests & ctx.request_info() Custom dataclass General Q&A,
948- Responses in any Executor feedback loops
949-
950- Checkpoints FileCheckpointStorage Resume from disk Long-running tasks,
951- or InMemoryCheckpoint- offline humans,
952- Storage process restarts
953-
954- Handoff HITL HandoffBuilder (no HandoffAgentUser- Interactive multi-
955- autonomous_mode) Request.create_ agent routing
956- response(input)
957-
958- Magentic HITL MagenticBuilder( approve() / Complex planning
959- enable_plan_review= revise(feedback) with review
960- True)
961- ```
962-
963- ### Slide 32: Next steps / resources
910+ ### Slide 29: Next steps / resources
964911```
965912Next steps Register:
966913 https://aka.ms/PythonAgents/series
0 commit comments