Skip to content

Commit e69def1

Browse files
authored
Update requests and responses docs (#747)
* Update Requests and Responses docs * Add migration guide * Add checkpoint updates * Fix warnings and issues * Add community readme * Remove request_type param from ctx.request_info() * Add version number * Add version number link * Add support tab to home
1 parent 6e83c43 commit e69def1

16 files changed

Lines changed: 443 additions & 146 deletions

File tree

agent-framework/TOC.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ items:
1616
href: user-guide/model-context-protocol/TOC.yml
1717
- name: Workflows
1818
href: user-guide/workflows/TOC.yml
19+
- name: Support
20+
href: support/TOC.yml
1921
- name: Migration Guide
2022
href: migration-guide/TOC.yml
2123
- name: API Reference Guide

agent-framework/migration-guide/from-autogen/index.md

Lines changed: 62 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ A comprehensive guide for migrating from AutoGen to the Microsoft Agent Framewor
4343
- [MagenticOneGroupChat Pattern](#magenticonegroupchat-pattern)
4444
- [Future Patterns](#future-patterns)
4545
- [Human-in-the-Loop with Request Response](#human-in-the-loop-with-request-response)
46-
- [Agent Framework RequestInfoExecutor](#agent-framework-requestinfoexecutor)
46+
- [Agent Framework Request-Response API](#agent-framework-request-response-api)
4747
- [Running Human-in-the-Loop Workflows](#running-human-in-the-loop-workflows)
4848
- [Checkpointing and Resuming Workflows](#checkpointing-and-resuming-workflows)
4949
- [Agent Framework Checkpointing](#agent-framework-checkpointing)
@@ -1290,61 +1290,62 @@ A key new feature in Agent Framework's `Workflow` is the concept of **request an
12901290

12911291
AutoGen's `Team` abstraction runs continuously once started and doesn't provide built-in mechanisms to pause execution for human input. Any human-in-the-loop functionality requires custom implementations outside the framework.
12921292

1293-
#### Agent Framework RequestInfoExecutor
1293+
#### Agent Framework Request-Response API
12941294

1295-
Agent Framework provides `RequestInfoExecutor` - a workflow-native bridge that pauses the graph at a request for information, emits a `RequestInfoEvent` with a typed payload, and resumes execution only after the application supplies a matching `RequestResponse`.
1295+
Agent Framework provides built-in request-response capabilities where any executor can send requests using `ctx.request_info()` and handle responses with the `@response_handler` decorator.
12961296

12971297
```python
12981298
from agent_framework import (
1299-
RequestInfoExecutor, RequestInfoEvent, RequestInfoMessage,
1300-
RequestResponse, WorkflowBuilder, WorkflowContext, executor
1299+
RequestInfoEvent, WorkflowBuilder, WorkflowContext,
1300+
Executor, handler, response_handler
13011301
)
13021302
from dataclasses import dataclass
1303-
from typing_extensions import Never
13041303

13051304
# Assume we have agent_executor defined elsewhere
13061305

13071306
# Define typed request payload
13081307
@dataclass
1309-
class ApprovalRequest(RequestInfoMessage):
1308+
class ApprovalRequest:
13101309
"""Request human approval for agent output."""
13111310
content: str = ""
13121311
agent_name: str = ""
13131312

13141313
# Workflow executor that requests human approval
1315-
@executor(id="reviewer")
1316-
async def approval_executor(
1317-
agent_response: str,
1318-
ctx: WorkflowContext[ApprovalRequest]
1319-
) -> None:
1320-
# Request human input with structured data
1321-
approval_request = ApprovalRequest(
1322-
content=agent_response,
1323-
agent_name="writer_agent"
1324-
)
1325-
await ctx.send_message(approval_request)
1326-
1327-
# Human feedback handler
1328-
@executor(id="processor")
1329-
async def process_approval(
1330-
feedback: RequestResponse[ApprovalRequest, str],
1331-
ctx: WorkflowContext[Never, str]
1332-
) -> None:
1333-
decision = feedback.data.strip().lower()
1334-
original_content = feedback.original_request.content
1335-
1336-
if decision == "approved":
1337-
await ctx.yield_output(f"APPROVED: {original_content}")
1338-
else:
1339-
await ctx.yield_output(f"REVISION NEEDED: {decision}")
1314+
class ReviewerExecutor(Executor):
1315+
1316+
@handler
1317+
async def review_content(
1318+
self,
1319+
agent_response: str,
1320+
ctx: WorkflowContext
1321+
) -> None:
1322+
# Request human input with structured data
1323+
approval_request = ApprovalRequest(
1324+
content=agent_response,
1325+
agent_name="writer_agent"
1326+
)
1327+
await ctx.request_info(request_data=approval_request, response_type=str)
1328+
1329+
@response_handler
1330+
async def handle_approval_response(
1331+
self,
1332+
original_request: ApprovalRequest,
1333+
decision: str,
1334+
ctx: WorkflowContext
1335+
) -> None:
1336+
decision_lower = decision.strip().lower()
1337+
original_content = original_request.content
1338+
1339+
if decision_lower == "approved":
1340+
await ctx.yield_output(f"APPROVED: {original_content}")
1341+
else:
1342+
await ctx.yield_output(f"REVISION NEEDED: {decision}")
13401343

13411344
# Build workflow with human-in-the-loop
1342-
hitl_executor = RequestInfoExecutor(id="request_approval")
1345+
reviewer = ReviewerExecutor(id="reviewer")
13431346

13441347
workflow = (WorkflowBuilder()
1345-
.add_edge(agent_executor, approval_executor)
1346-
.add_edge(approval_executor, hitl_executor)
1347-
.add_edge(hitl_executor, process_approval)
1348+
.add_edge(agent_executor, reviewer)
13481349
.set_start_executor(agent_executor)
13491350
.build())
13501351
```
@@ -1468,11 +1469,16 @@ async def checkpoint_example():
14681469
Agent Framework provides APIs to list, inspect, and resume from specific checkpoints:
14691470

14701471
```python
1472+
from typing_extensions import Never
1473+
14711474
from agent_framework import (
1472-
RequestInfoExecutor, FileCheckpointStorage, WorkflowBuilder,
1473-
Executor, WorkflowContext, handler
1475+
Executor,
1476+
FileCheckpointStorage,
1477+
WorkflowContext,
1478+
WorkflowBuilder,
1479+
get_checkpoint_summary,
1480+
handler,
14741481
)
1475-
from typing_extensions import Never
14761482

14771483
class UpperCaseExecutor(Executor):
14781484
@handler
@@ -1506,10 +1512,8 @@ async def checkpoint_resume_example():
15061512

15071513
# Display checkpoint information
15081514
for checkpoint in checkpoints:
1509-
summary = RequestInfoExecutor.checkpoint_summary(checkpoint)
1515+
summary = get_checkpoint_summary(checkpoint)
15101516
print(f"Checkpoint {summary.checkpoint_id}: iteration={summary.iteration_count}")
1511-
print(f" Shared state: {checkpoint.shared_state}")
1512-
print(f" Executor states: {list(checkpoint.executor_states.keys())}")
15131517

15141518
# Resume from a specific checkpoint
15151519
if checkpoints:
@@ -1528,19 +1532,28 @@ async def checkpoint_resume_example():
15281532

15291533
**Checkpoint with Human-in-the-Loop Integration:**
15301534

1531-
Checkpointing works seamlessly with human-in-the-loop workflows, allowing workflows to be paused for human input and resumed later:
1535+
Checkpointing works seamlessly with human-in-the-loop workflows, allowing workflows to be paused for human input and resumed later. When resuming from a checkpoint that contains pending requests, those requests will be re-emitted as events:
15321536

15331537
```python
15341538
# Assume we have workflow, checkpoint_id, and checkpoint_storage from previous examples
1535-
async def resume_with_responses_example():
1536-
# Resume with pre-supplied human responses
1537-
responses = {"request_id_123": "approved"}
1538-
1539+
async def resume_with_pending_requests_example():
1540+
# Resume from checkpoint - pending requests will be re-emitted
1541+
request_info_events = []
15391542
async for event in workflow.run_stream_from_checkpoint(
15401543
checkpoint_id,
1541-
checkpoint_storage=checkpoint_storage,
1542-
responses=responses # Pre-supply human responses
1544+
checkpoint_storage=checkpoint_storage
15431545
):
1546+
if isinstance(event, RequestInfoEvent):
1547+
request_info_events.append(event)
1548+
1549+
# Handle re-emitted pending request
1550+
responses = {}
1551+
for event in request_info_events:
1552+
response = handle_request(event.data)
1553+
responses[event.request_id] = response
1554+
1555+
# Send response back to workflow
1556+
async for event in workflow.send_responses_streaming(responses):
15441557
print(f"Event: {event}")
15451558
```
15461559

agent-framework/support/TOC.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
- name: Overview
2+
href: index.md
3+
- name: Upgrade
4+
href: upgrade/TOC.yml

agent-framework/support/index.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
title: Support for Agent Framework
3+
description: Support for Agent Framework
4+
author: TaoChenOSU
5+
ms.topic: conceptual
6+
ms.author: taochen
7+
ms.date: 10/30/2025
8+
ms.service: agent-framework
9+
---
10+
# Support for Agent Framework
11+
12+
👋 Welcome! There are a variety of ways to get supported in the Agent Framework world.
13+
14+
| Your preference | What's available |
15+
|---|---|
16+
| Read the docs | [This learning site](/agent-framework/overview) is the home of the latest information for developers |
17+
| Visit the repo | Our open-source [GitHub repository](https://github.com/microsoft/agent-framework) is available for perusal and suggestions |
18+
| Connect with the Agent Framework Team | Visit our [GitHub Discussions](https://github.com/microsoft/agent-framework/discussions) to get supported quickly with our [CoC](https://github.com/microsoft/agent-framework/blob/main/CODE_OF_CONDUCT.md) actively enforced |
19+
| Office Hours | We will be hosting regular office hours; the calendar invites and cadence are located here: [Community.MD](https://github.com/microsoft/agent-framework/blob/main/COMMUNITY.md) |
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- name: Upgrade Guide for Requests and Responses in Python
2+
href: requests-and-responses-upgrade-guide-python.md

0 commit comments

Comments
 (0)