Python: restructure: Python samples into progressive 01-05 layout (#3862)

* restructure: Python samples into progressive 01-05 layout

- 01-get-started/: 6 numbered steps (hello agent → hosting)
- 02-agents/: all agent concept samples (tools, middleware, providers, etc.)
- 03-workflows/: ALL existing workflow samples preserved as-is
- 04-hosting/: azure-functions, durabletask, a2a
- 05-end-to-end/: demos, evaluation, hosted agents
- Old files moved to _to_delete/ for review
- Added AGENTS.md with structure documentation
- autogen-migration/ and semantic-kernel-migration/ preserved at root

* fix: switch to AzureOpenAI Foundry, fix CI failures

- Switch all 01-get-started samples to AzureOpenAIResponsesClient with
  Azure AI Foundry project endpoint (AZURE_AI_PROJECT_ENDPOINT +
  AZURE_OPENAI_RESPONSES_DEPLOYMENT_NAME + AzureCliCredential)
- Add _to_delete/ and 05-end-to-end/ to pyrightconfig.samples.json excludes
- Fix test paths in packages/ that referenced old getting_started/ dirs:
  durabletask conftest + streaming test, azurefunctions conftest,
  devui conftest + capture_messages + openai_sdk_integration
- Fix workflow_as_agent_human_in_the_loop.py import (sibling import)
- Update hosting READMEs and tool comment paths
- Replace root README.md with new structure overview
- Update AGENTS.md to document Azure OpenAI Foundry as default provider

* cleanup: remove _to_delete folder, copy resource files to active dirs

All files in _to_delete/ were either:
- Exact duplicates of files in the new structure (240 files)
- Same file with only comment path updates (100 files)
- One import-fix diff (workflow_as_agent_human_in_the_loop.py)
- One superseded minimal_sample.py

Resource files (sample.pdf, countries.json, employees.pdf, weather.json)
copied to 02-agents/sample_assets/ and 02-agents/resources/ since active
samples reference them.

* fix: address PR review comments, centralize resources, remove root duplicates

- Fix type annotation in 04_memory.py (string union -> proper types)
- Fix old sample paths in observability files
- Fix grammar/spelling in observability samples
- Move sample_assets/ and resources/ to shared/ folder
- Remove 8 duplicate observability files from 02-agents root
- Update resource path references in multimodal_input and provider samples

* fix: update broken links from old getting_started paths to new structure

- Update relative paths in READMEs: getting_started/ → 01-get-started/,
  02-agents/, 03-workflows/, 04-hosting/, 05-end-to-end/
- Fix absolute GitHub URLs in package READMEs
- Fix broken link in ollama package README

* fix: convert absolute GitHub URLs to relative paths for link checker

Absolute URLs to python/samples/ on main branch 404 until PR merges.
Converted to relative paths that linkspector can verify locally.

* fix: update link for handoff sample moved to orchestrations/

* fix: update chatkit-integration README path from demos/ to 05-end-to-end/

* fix: update broken links in orchestrations README to match flat directory structure
This commit is contained in:
Eduard van Valkenburg
2026-02-12 18:36:36 +01:00
committed by GitHub
Unverified
parent 69dcfe31ee
commit a2856d3b92
536 changed files with 3816 additions and 1632 deletions
+1 -1
View File
@@ -12,7 +12,7 @@ The A2A agent integration enables communication with remote A2A-compliant agents
### Basic Usage Example
See the [A2A agent examples](https://github.com/microsoft/agent-framework/tree/main/python/samples/getting_started/agents/a2a/) which demonstrate:
See the [A2A agent examples](../../samples/04-hosting/a2a/) which demonstrate:
- Connecting to remote A2A agents
- Sending messages and receiving responses
+1 -1
View File
@@ -12,7 +12,7 @@ The Anthropic integration enables communication with the Anthropic API, allowing
### Basic Usage Example
See the [Anthropic agent examples](https://github.com/microsoft/agent-framework/tree/main/python/samples/getting_started/agents/anthropic/) which demonstrate:
See the [Anthropic agent examples](../../samples/02-agents/providers/anthropic/) which demonstrate:
- Connecting to a Anthropic endpoint with an agent
- Streaming and non-streaming responses
+1 -1
View File
@@ -15,7 +15,7 @@ The Azure AI Search integration provides context providers for RAG (Retrieval Au
### Basic Usage Example
See the [Azure AI Search context provider examples](https://github.com/microsoft/agent-framework/tree/main/python/samples/getting_started/agents/azure_ai/) which demonstrate:
See the [Azure AI Search context provider examples](../../samples/02-agents/providers/azure_ai/) which demonstrate:
- Semantic search with hybrid (vector + keyword) queries
- Agentic mode with Knowledge Bases for complex multi-hop reasoning
@@ -300,7 +300,7 @@ def _get_sample_path_from_marker(request: pytest.FixtureRequest) -> tuple[Path |
sample_name = marker.args[0]
repo_root = _resolve_repo_root()
sample_path = repo_root / "samples" / "getting_started" / "azure_functions" / sample_name
sample_path = repo_root / "samples" / "04-hosting" / "azure_functions" / sample_name
if not sample_path.exists():
return None, f"Sample directory does not exist: {sample_path}"
+1 -1
View File
@@ -124,4 +124,4 @@ async def chatkit_endpoint(request: Request):
return Response(content=result.json, media_type="application/json") # type: ignore[union-attr]
```
For a complete end-to-end example with a full frontend, see the [weather agent sample](../../samples/demos/chatkit-integration/README.md).
For a complete end-to-end example with a full frontend, see the [weather agent sample](../../samples/05-end-to-end/chatkit-integration/README.md).
+1 -1
View File
@@ -89,7 +89,7 @@ The package uses MSAL (Microsoft Authentication Library) for authentication with
### Examples
For more comprehensive examples, see the [Copilot Studio examples](https://github.com/microsoft/agent-framework/tree/main/python/samples/getting_started/agents/copilotstudio/) which demonstrate:
For more comprehensive examples, see the [Copilot Studio examples](../../samples/02-agents/providers/copilotstudio/) which demonstrate:
- Basic non-streaming and streaming execution
- Explicit settings and manual token acquisition
+5 -5
View File
@@ -53,7 +53,7 @@ client = AzureOpenAIChatClient(
)
```
See the following [setup guide](https://github.com/microsoft/agent-framework/tree/main/python/samples/getting_started) for more information.
See the following [setup guide](../../samples/01-get-started) for more information.
## 2. Create a Simple Agent
@@ -161,7 +161,7 @@ async def main():
asyncio.run(main())
```
You can explore additional agent samples [here](https://github.com/microsoft/agent-framework/tree/main/python/samples/getting_started/agents).
You can explore additional agent samples [here](../../samples/02-agents).
## 5. Multi-Agent Orchestration
@@ -213,12 +213,12 @@ if __name__ == "__main__":
asyncio.run(main())
```
**Note**: Sequential, Concurrent, Group Chat, Handoff, and Magentic orchestrations are available. See examples in [orchestration samples](../../samples/getting_started/orchestrations).
**Note**: Sequential, Concurrent, Group Chat, Handoff, and Magentic orchestrations are available. See examples in [orchestration samples](../../samples/02-agents/orchestrations).
## More Examples & Samples
- [Getting Started with Agents](https://github.com/microsoft/agent-framework/tree/main/python/samples/getting_started/agents): Basic agent creation and tool usage
- [Chat Client Examples](https://github.com/microsoft/agent-framework/tree/main/python/samples/getting_started/chat_client): Direct chat client usage patterns
- [Getting Started with Agents](../../samples/02-agents): Basic agent creation and tool usage
- [Chat Client Examples](../../samples/02-agents/chat_client): Direct chat client usage patterns
- [Azure AI Integration](https://github.com/microsoft/agent-framework/tree/main/python/packages/azure-ai): Azure AI integration
- [.NET Workflows Samples](https://github.com/microsoft/agent-framework/tree/main/dotnet/samples/GettingStarted/Workflows): Advanced multi-agent patterns (.NET)
@@ -3,7 +3,7 @@
"""Tests to ensure PowerFx evaluation supports all expressions used in declarative YAML workflows.
This test suite validates that all PowerFx expressions found in the sample YAML workflows
under samples/getting_started/workflows/declarative/ work correctly with our implementation.
under samples/03-workflows/declarative/ work correctly with our implementation.
Coverage includes:
- Built-in PowerFx functions: Concat, If, IsBlank, Not, Or, Upper, Find
+1 -1
View File
@@ -373,7 +373,7 @@ This restricts developer APIs (reload, deployment, entity details) and requires
## Examples
See working implementations in `python/samples/getting_started/devui/`
See working implementations in `python/samples/02-agents/devui/`
## License
+2 -2
View File
@@ -45,7 +45,7 @@ AZURE_OPENAI_CHAT_DEPLOYMENT_NAME="your-deployment-name"
**Option A: In-Memory Mode (Recommended for quick testing)**
```bash
cd samples/getting_started/devui
cd samples/02-agents/devui
python in_memory_mode.py
```
@@ -54,7 +54,7 @@ This runs a simple example with predefined agents and opens your browser automat
**Option B: Directory-Based Discovery**
```bash
cd samples/getting_started/devui
cd samples/02-agents/devui
devui
```
+4 -4
View File
@@ -7,7 +7,7 @@
All DevUI samples are now located at:
```
python/samples/getting_started/devui/
python/samples/02-agents/devui/
```
## Available Samples
@@ -22,17 +22,17 @@ python/samples/getting_started/devui/
## Quick Start
```bash
cd ../../samples/getting_started/devui
cd ../../samples/02-agents/devui
python in_memory_mode.py
```
Or for directory discovery:
```bash
cd ../../samples/getting_started/devui
cd ../../samples/02-agents/devui
devui
```
## Learn More
See the [DevUI samples README](../../../samples/getting_started/devui/README.md) for detailed documentation.
See the [DevUI samples README](../../../samples/02-agents/devui/README.md) for detailed documentation.
@@ -28,8 +28,8 @@ def start_server() -> tuple[str, Any]:
"""Start server with samples directory."""
# Get samples directory - updated path after samples were moved
current_dir = Path(__file__).parent
# Samples are now in python/samples/getting_started/devui
samples_dir = current_dir.parent.parent.parent / "samples" / "getting_started" / "devui"
# Samples are now in python/samples/02-agents/devui
samples_dir = current_dir.parent.parent.parent / "samples" / "02-agents" / "devui"
if not samples_dir.exists():
raise RuntimeError(f"Samples directory not found: {samples_dir}")
@@ -413,8 +413,8 @@ def executor_failed_event() -> WorkflowEvent[WorkflowErrorDetails]:
def test_entities_dir() -> str:
"""Use the samples directory which has proper entity structure."""
current_dir = Path(__file__).parent
# Navigate to python/samples/getting_started/devui
samples_dir = current_dir.parent.parent.parent.parent / "samples" / "getting_started" / "devui"
# Navigate to python/samples/02-agents/devui
samples_dir = current_dir.parent.parent.parent.parent / "samples" / "02-agents" / "devui"
return str(samples_dir.resolve())
@@ -28,7 +28,7 @@ def devui_server() -> Generator[str, None, None]:
"""
# Get samples directory
current_dir = Path(__file__).parent
samples_dir = current_dir.parent.parent.parent / "samples" / "getting_started" / "devui"
samples_dir = current_dir.parent.parent.parent / "samples" / "02-agents" / "devui"
if not samples_dir.exists():
pytest.skip(f"Samples directory not found: {samples_dir}")
@@ -382,7 +382,7 @@ def worker_process(
pytest.fail("Test class must have @pytest.mark.sample() marker")
sample_name: str = cast(str, sample_marker.args[0]) # type: ignore[union-attr]
sample_path: Path = Path(__file__).parents[4] / "samples" / "getting_started" / "durabletask" / sample_name
sample_path: Path = Path(__file__).parents[4] / "samples" / "04-hosting" / "durabletask" / sample_name
worker_file: Path = sample_path / "worker.py"
if not worker_file.exists():
@@ -27,7 +27,7 @@ import pytest
import redis.asyncio as aioredis
# Add sample directory to path to import RedisStreamResponseHandler
SAMPLE_DIR = Path(__file__).parents[4] / "samples" / "getting_started" / "durabletask" / "03_single_agent_streaming"
SAMPLE_DIR = Path(__file__).parents[4] / "samples" / "04-hosting" / "durabletask" / "03_single_agent_streaming"
sys.path.insert(0, str(SAMPLE_DIR))
from redis_stream_response_handler import RedisStreamResponseHandler # type: ignore[reportMissingImports] # noqa: E402
+1 -1
View File
@@ -12,7 +12,7 @@ The Mem0 context provider enables persistent memory capabilities for your agents
### Basic Usage Example
See the [Mem0 basic example](https://github.com/microsoft/agent-framework/tree/main/python/samples/getting_started/context_providers/mem0/mem0_basic.py) which demonstrates:
See the [Mem0 basic example](../../samples/02-agents/context_providers/mem0/mem0_basic.py) which demonstrates:
- Setting up an agent with Mem0 context provider
- Teaching the agent user preferences
+1 -1
View File
@@ -10,4 +10,4 @@ and see the [README](https://github.com/microsoft/agent-framework/tree/main/pyth
# Run samples with the Ollama Conector
You can find samples how to run the connector under the [Getting_started] (./getting_started/README.md) folder
You can find samples how to run the connector in the [Ollama provider samples](../../samples/02-agents/providers/ollama).
+2 -2
View File
@@ -14,7 +14,7 @@ The `RedisProvider` enables persistent context & memory capabilities for your ag
#### Basic Usage Examples
Review the set of [getting started examples](../../samples/getting_started/context_providers/redis/README.md) for using the Redis context provider.
Review the set of [getting started examples](../../samples/02-agents/context_providers/redis/README.md) for using the Redis context provider.
### Redis Chat Message Store
@@ -30,7 +30,7 @@ The `RedisChatMessageStore` provides persistent conversation storage using Redis
#### Basic Usage Examples
See the complete [Redis chat message store examples](../../samples/getting_started/threads/redis_chat_message_store_thread.py) including:
See the complete [Redis chat message store examples](../../samples/02-agents/conversations/redis_chat_message_store_thread.py) including:
- User session management
- Conversation persistence across restarts
- Thread serialization and deserialization