mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
94eae24082
* DevUI: Add OpenAI Responses API proxy support with enhanced UI features This commit adds support for proxying requests to OpenAI's Responses API, allowing DevUI to route conversations to OpenAI models when configured to enable testing. Backend changes: - Add OpenAI proxy executor with conversation routing logic - Enhance event mapper to support OpenAI Responses API format - Extend server endpoints to handle OpenAI proxy mode - Update models with OpenAI-specific response types - Remove emojis from logging and CLI output for cleaner text Frontend changes: - Add settings modal with OpenAI proxy configuration UI - Enhance agent and workflow views with improved state management - Add new UI components (separator, switch) for settings - Update debug panel with better event filtering - Improve message renderers for OpenAI content types - Update types and API client for OpenAI integration * update ui, settings modal and workflow input form, add register cleanup hooks. * add workflow HIL support, user mode, other fixes * feat(devui): add human-in-the-loop (HIL) support with dynamic response schemas Implement HIL workflow support allowing workflows to pause for user input with dynamically generated JSON schemas based on response handler type hints. Key Features: - Automatic response schema extraction from @response_handler decorators - Dynamic form generation in UI based on Pydantic/dataclass response types - Checkpoint-based conversation storage for HIL requests/responses - Resume workflow execution after user provides HIL response Backend Changes: - Add extract_response_type_from_executor() to introspect response handlers - Enrich RequestInfoEvent with response_schema via _enrich_request_info_event_with_response_schema() - Map RequestInfoEvent to response.input.requested OpenAI event format - Store HIL responses in conversation history and restore checkpoints Frontend Changes: - Add HILInputModal component with SchemaFormRenderer for dynamic forms - Support Pydantic BaseModel and dataclass response types - Render enum fields as dropdowns, strings as text/textarea, numbers, booleans, arrays, objects - Display original request context alongside response form Testing: - Add tests for checkpoint storage (test_checkpoints.py) - Add schema generation tests for all input types (test_schema_generation.py) - Validate end-to-end HIL flow with spam workflow sample This enables workflows to seamlessly pause execution and request structured user input with type-safe, validated forms generated automatically from response type annotations. * improve HIL support, improve workflow execution view * ui updates * ui updates * improve HIL for workflows, add auth and view modes * update workflow * security improvements , ui fixes * fix mypy error * update loading spinner in ui --------- Co-authored-by: Mark Wallace <127216156+markwallace-microsoft@users.noreply.github.com>
94eae24082
·
2025-11-07 23:28:32 +00:00
History
Python Samples
This directory contains samples demonstrating the capabilities of Microsoft Agent Framework for Python.
Agents
A2A (Agent-to-Agent)
| File | Description |
|---|---|
getting_started/agents/a2a/agent_with_a2a.py |
Agent2Agent (A2A) Protocol Integration Sample |
Anthropic
| File | Description |
|---|---|
getting_started/agents/anthropic/anthropic_basic.py |
Agent with Anthropic Client |
getting_started/agents/anthropic/anthropic_advanced.py |
Advanced sample with thinking and hosted tools. |
Azure AI
Azure OpenAI
Copilot Studio
| File | Description |
|---|---|
getting_started/agents/copilotstudio/copilotstudio_basic.py |
Copilot Studio Agent Basic Example |
getting_started/agents/copilotstudio/copilotstudio_with_explicit_settings.py |
Copilot Studio Agent with Explicit Settings Example |
Custom
| File | Description |
|---|---|
getting_started/agents/custom/custom_agent.py |
Custom Agent Implementation Example |
getting_started/agents/custom/custom_chat_client.py |
Custom Chat Client Implementation Example |
Ollama
| File | Description |
|---|---|
getting_started/agents/ollama/ollama_with_openai_chat_client.py |
Ollama with OpenAI Chat Client Example |
OpenAI
Chat Client
| File | Description |
|---|---|
getting_started/chat_client/azure_ai_chat_client.py |
Azure AI Chat Client Direct Usage Example |
getting_started/chat_client/azure_assistants_client.py |
Azure OpenAI Assistants Client Direct Usage Example |
getting_started/chat_client/azure_chat_client.py |
Azure Chat Client Direct Usage Example |
getting_started/chat_client/azure_responses_client.py |
Azure OpenAI Responses Client Direct Usage Example |
getting_started/chat_client/chat_response_cancellation.py |
Chat Response Cancellation Example |
getting_started/chat_client/openai_assistants_client.py |
OpenAI Assistants Client Direct Usage Example |
getting_started/chat_client/openai_chat_client.py |
OpenAI Chat Client Direct Usage Example |
getting_started/chat_client/openai_responses_client.py |
OpenAI Responses Client Direct Usage Example |
Context Providers
Mem0
| File | Description |
|---|---|
getting_started/context_providers/mem0/mem0_basic.py |
Basic Mem0 integration example |
getting_started/context_providers/mem0/mem0_oss.py |
Mem0 OSS (Open Source) integration example |
getting_started/context_providers/mem0/mem0_threads.py |
Mem0 with thread management example |
Redis
| File | Description |
|---|---|
getting_started/context_providers/redis/redis_basics.py |
Basic Redis provider example |
getting_started/context_providers/redis/redis_conversation.py |
Redis conversation context management example |
getting_started/context_providers/redis/redis_threads.py |
Redis with thread management example |
Other
| File | Description |
|---|---|
getting_started/context_providers/simple_context_provider.py |
Simple context provider implementation example |
DevUI
| File | Description |
|---|---|
getting_started/devui/fanout_workflow/workflow.py |
Complex fan-out/fan-in workflow example |
getting_started/devui/foundry_agent/agent.py |
Azure AI Foundry agent example |
getting_started/devui/in_memory_mode.py |
In-memory mode example for DevUI |
getting_started/devui/spam_workflow/workflow.py |
Spam detection workflow example |
getting_started/devui/weather_agent_azure/agent.py |
Weather agent using Azure OpenAI example |
getting_started/devui/workflow_agents/workflow.py |
Workflow with multiple agents example |
Evaluation
| File | Description |
|---|---|
getting_started/evaluation/azure_ai_foundry/red_team_agent_sample.py |
Red team agent evaluation sample for Azure AI Foundry |
MCP (Model Context Protocol)
| File | Description |
|---|---|
getting_started/mcp/agent_as_mcp_server.py |
Agent as MCP Server Example |
getting_started/mcp/mcp_api_key_auth.py |
MCP Authentication Example |
Middleware
Multimodal Input
| File | Description |
|---|---|
getting_started/multimodal_input/azure_chat_multimodal.py |
Azure OpenAI Chat with multimodal (image) input example |
getting_started/multimodal_input/azure_responses_multimodal.py |
Azure OpenAI Responses with multimodal (image) input example |
getting_started/multimodal_input/openai_chat_multimodal.py |
OpenAI Chat with multimodal (image) input example |
Observability
| File | Description |
|---|---|
getting_started/observability/advanced_manual_setup_console_output.py |
Advanced manual observability setup with console output |
getting_started/observability/advanced_zero_code.py |
Zero-code observability setup example |
getting_started/observability/agent_observability.py |
Agent observability example |
getting_started/observability/azure_ai_agent_observability.py |
Azure AI agent observability example |
getting_started/observability/azure_ai_chat_client_with_observability.py |
Azure AI chat client with observability example |
getting_started/observability/setup_observability_with_env_var.py |
Setup observability using environment variables |
getting_started/observability/setup_observability_with_parameters.py |
Setup observability using parameters |
getting_started/observability/workflow_observability.py |
Workflow observability example |
Threads
| File | Description |
|---|---|
getting_started/threads/custom_chat_message_store_thread.py |
Implementation of custom chat message store state |
getting_started/threads/redis_chat_message_store_thread.py |
Basic example of using Redis chat message store |
getting_started/threads/suspend_resume_thread.py |
Demonstrates how to suspend and resume a service-managed thread |
Tools
| File | Description |
|---|---|
getting_started/tools/ai_function_declaration_only.py |
Function declarations without implementations for testing agent reasoning |
getting_started/tools/ai_function_from_dict_with_dependency_injection.py |
Creating AI functions from dictionary definitions using dependency injection |
getting_started/tools/ai_function_recover_from_failures.py |
Graceful error handling when tools raise exceptions |
getting_started/tools/ai_function_with_approval.py |
User approval workflows for function calls without threads |
getting_started/tools/ai_function_with_approval_and_threads.py |
Tool approval workflows using threads for conversation history management |
getting_started/tools/ai_function_with_max_exceptions.py |
Limiting tool failure exceptions using max_invocation_exceptions |
getting_started/tools/ai_function_with_max_invocations.py |
Limiting total tool invocations using max_invocations |
getting_started/tools/ai_functions_in_class.py |
Using ai_function decorator with class methods for stateful tools |
Workflows
Start Here
| File | Description |
|---|---|
getting_started/workflows/_start-here/step1_executors_and_edges.py |
Step 1: Foundational patterns: Executors and edges |
getting_started/workflows/_start-here/step2_agents_in_a_workflow.py |
Step 2: Agents in a Workflow non-streaming |
getting_started/workflows/_start-here/step3_streaming.py |
Step 3: Agents in a workflow with streaming |
Agents in Workflows
| File | Description |
|---|---|
getting_started/workflows/agents/azure_ai_agents_streaming.py |
Sample: Agents in a workflow with streaming |
getting_started/workflows/agents/azure_chat_agents_function_bridge.py |
Sample: Two agents connected by a function executor bridge |
getting_started/workflows/agents/azure_chat_agents_streaming.py |
Sample: Agents in a workflow with streaming |
getting_started/workflows/agents/azure_chat_agents_tool_calls_with_feedback.py |
Sample: Tool-enabled agents with human feedback |
getting_started/workflows/agents/custom_agent_executors.py |
Step 2: Agents in a Workflow non-streaming |
getting_started/workflows/agents/workflow_as_agent_human_in_the_loop.py |
Sample: Workflow Agent with Human-in-the-Loop |
getting_started/workflows/agents/workflow_as_agent_reflection_pattern.py |
Sample: Workflow as Agent with Reflection and Retry Pattern |
Checkpoint
| File | Description |
|---|---|
getting_started/workflows/checkpoint/checkpoint_with_human_in_the_loop.py |
Sample: Checkpoint + human-in-the-loop quickstart |
getting_started/workflows/checkpoint/checkpoint_with_resume.py |
Sample: Checkpointing and Resuming a Workflow (with an Agent stage) |
getting_started/workflows/checkpoint/sub_workflow_checkpoint.py |
Sample: Checkpointing for workflows that embed sub-workflows |
Composition
| File | Description |
|---|---|
getting_started/workflows/composition/sub_workflow_basics.py |
Sample: Sub-Workflows (Basics) |
getting_started/workflows/composition/sub_workflow_parallel_requests.py |
Sample: Sub-workflow with parallel request handling by specialized interceptors |
getting_started/workflows/composition/sub_workflow_request_interception.py |
Sample: Sub-Workflows with Request Interception |
Control Flow
| File | Description |
|---|---|
getting_started/workflows/control-flow/edge_condition.py |
Sample: Conditional routing with structured outputs |
getting_started/workflows/control-flow/multi_selection_edge_group.py |
Step 06b — Multi-Selection Edge Group sample |
getting_started/workflows/control-flow/sequential_executors.py |
Sample: Sequential workflow with streaming |
getting_started/workflows/control-flow/sequential_streaming.py |
Sample: Foundational sequential workflow with streaming using function-style executors |
getting_started/workflows/control-flow/simple_loop.py |
Sample: Simple Loop (with an Agent Judge) |
getting_started/workflows/control-flow/switch_case_edge_group.py |
Sample: Switch-Case Edge Group with an explicit Uncertain branch |
Human-in-the-Loop
| File | Description |
|---|---|
getting_started/workflows/human-in-the-loop/guessing_game_with_human_input.py |
Sample: Human in the loop guessing game |
Observability
| File | Description |
|---|---|
getting_started/workflows/observability/tracing_basics.py |
Basic tracing workflow sample |
Orchestration
| File | Description |
|---|---|
getting_started/workflows/orchestration/concurrent_agents.py |
Sample: Concurrent fan-out/fan-in (agent-only API) with default aggregator |
getting_started/workflows/orchestration/concurrent_custom_agent_executors.py |
Sample: Concurrent Orchestration with Custom Agent Executors |
getting_started/workflows/orchestration/concurrent_custom_aggregator.py |
Sample: Concurrent Orchestration with Custom Aggregator |
getting_started/workflows/orchestration/group_chat_prompt_based_manager.py |
Sample: Group Chat Orchestration with LLM-based manager |
getting_started/workflows/orchestration/group_chat_simple_selector.py |
Sample: Group Chat Orchestration with function-based speaker selector |
getting_started/workflows/orchestration/handoff_simple.py |
Sample: Handoff Orchestration with simple agent handoff pattern |
getting_started/workflows/orchestration/handoff_specialist_to_specialist.py |
Sample: Handoff Orchestration with specialist-to-specialist routing |
getting_started/workflows/orchestration/magentic.py |
Sample: Magentic Orchestration (agentic task planning with multi-agent execution) |
getting_started/workflows/orchestration/magentic_checkpoint.py |
Sample: Magentic Orchestration with Checkpointing |
getting_started/workflows/orchestration/magentic_human_plan_update.py |
Sample: Magentic Orchestration with Human Plan Review |
getting_started/workflows/orchestration/sequential_agents.py |
Sample: Sequential workflow (agent-focused API) with shared conversation context |
getting_started/workflows/orchestration/sequential_custom_executors.py |
Sample: Sequential workflow mixing agents and a custom summarizer executor |
Parallelism
| File | Description |
|---|---|
getting_started/workflows/parallelism/aggregate_results_of_different_types.py |
Sample: Concurrent fan out and fan in with two different tasks that output results of different types |
getting_started/workflows/parallelism/fan_out_fan_in_edges.py |
Sample: Concurrent fan out and fan in with three domain agents |
getting_started/workflows/parallelism/map_reduce_and_visualization.py |
Sample: Map reduce word count with fan out and fan in over file backed intermediate results |
State Management
| File | Description |
|---|---|
getting_started/workflows/state-management/shared_states_with_agents.py |
Sample: Shared state with agents and conditional routing |
Visualization
| File | Description |
|---|---|
getting_started/workflows/visualization/concurrent_with_visualization.py |
Sample: Concurrent (Fan-out/Fan-in) with Agents + Visualization |
Sample Guidelines
For information on creating new samples, see SAMPLE_GUIDELINES.md.