Skip to content

Commit a2856d3

Browse files
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
1 parent 69dcfe3 commit a2856d3

536 files changed

Lines changed: 3816 additions & 1632 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Still have questions? Join our [weekly office hours](./COMMUNITY.md#public-commu
5353
### **Highlights**
5454

5555
- **Graph-based Workflows**: Connect agents and deterministic functions using data flows with streaming, checkpointing, human-in-the-loop, and time-travel capabilities
56-
- [Python workflows](./python/samples/getting_started/workflows/) | [.NET workflows](./dotnet/samples/GettingStarted/Workflows/)
56+
- [Python workflows](./python/samples/03-workflows/) | [.NET workflows](./dotnet/samples/GettingStarted/Workflows/)
5757
- **AF Labs**: Experimental packages for cutting-edge features including benchmarking, reinforcement learning, and research initiatives
5858
- [Labs directory](./python/packages/lab/)
5959
- **DevUI**: Interactive developer UI for agent development, testing, and debugging workflows
@@ -73,11 +73,11 @@ Still have questions? Join our [weekly office hours](./COMMUNITY.md#public-commu
7373
- **Python and C#/.NET Support**: Full framework support for both Python and C#/.NET implementations with consistent APIs
7474
- [Python packages](./python/packages/) | [.NET source](./dotnet/src/)
7575
- **Observability**: Built-in OpenTelemetry integration for distributed tracing, monitoring, and debugging
76-
- [Python observability](./python/samples/getting_started/observability/) | [.NET telemetry](./dotnet/samples/GettingStarted/AgentOpenTelemetry/)
76+
- [Python observability](./python/samples/02-agents/observability/) | [.NET telemetry](./dotnet/samples/GettingStarted/AgentOpenTelemetry/)
7777
- **Multiple Agent Provider Support**: Support for various LLM providers with more being added continuously
78-
- [Python examples](./python/samples/getting_started/agents/) | [.NET examples](./dotnet/samples/GettingStarted/AgentProviders/)
78+
- [Python examples](./python/samples/02-agents/providers/) | [.NET examples](./dotnet/samples/GettingStarted/AgentProviders/)
7979
- **Middleware**: Flexible middleware system for request/response processing, exception handling, and custom pipelines
80-
- [Python middleware](./python/samples/getting_started/middleware/) | [.NET middleware](./dotnet/samples/GettingStarted/Agents/Agent_Step14_Middleware/)
80+
- [Python middleware](./python/samples/02-agents/middleware/) | [.NET middleware](./dotnet/samples/GettingStarted/Agents/Agent_Step14_Middleware/)
8181

8282
### 💬 **We want your feedback!**
8383

@@ -159,9 +159,9 @@ Console.WriteLine(await agent.RunAsync("Write a haiku about Microsoft Agent Fram
159159

160160
### Python
161161

162-
- [Getting Started with Agents](./python/samples/getting_started/agents): basic agent creation and tool usage
163-
- [Chat Client Examples](./python/samples/getting_started/chat_client): direct chat client usage patterns
164-
- [Getting Started with Workflows](./python/samples/getting_started/workflows): basic workflow creation and integration with agents
162+
- [Getting Started with Agents](./python/samples/01-get-started): progressive tutorial from hello-world to hosting
163+
- [Agent Concepts](./python/samples/02-agents): deep-dive samples by topic (tools, middleware, providers, etc.)
164+
- [Getting Started with Workflows](./python/samples/03-workflows): workflow creation and integration with agents
165165

166166
### .NET
167167

agent-samples/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Declarative Agents
22

3-
This folder contains sample agent definitions that can be run using the declarative agent support, for python see the [declarative agent python sample folder](../python/samples/getting_started/declarative/).
3+
This folder contains sample agent definitions that can be run using the declarative agent support, for python see the [declarative agent python sample folder](../python/samples/02-agents/declarative/).

docs/decisions/0012-python-typeddict-options.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,4 +126,4 @@ response = await client.get_response(
126126

127127
Chosen option: **"Option 2: TypedDict with Generic Type Parameters"**, because it provides full type safety, excellent IDE support with autocompletion, and allows users to extend provider-specific options for their use cases. Extended this Generic to ChatAgents in order to also properly type the options used in agent construction and run methods.
128128

129-
See [typed_options.py](../../python/samples/concepts/typed_options.py) for a complete example demonstrating the usage of typed options with custom extensions.
129+
See [typed_options.py](../../python/samples/02-agents/typed_options.py) for a complete example demonstrating the usage of typed options with custom extensions.

python/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ client = AzureOpenAIChatClient(
7070
)
7171
```
7272

73-
See the following [setup guide](https://github.com/microsoft/agent-framework/tree/main/python/samples/getting_started) for more information.
73+
See the following [setup guide](samples/01-get-started) for more information.
7474

7575
## 2. Create a Simple Agent
7676

@@ -181,7 +181,7 @@ if __name__ == "__main__":
181181
asyncio.run(main())
182182
```
183183

184-
You can explore additional agent samples [here](https://github.com/microsoft/agent-framework/tree/main/python/samples/getting_started/agents).
184+
You can explore additional agent samples [here](samples/02-agents).
185185

186186
## 5. Multi-Agent Orchestration
187187

@@ -233,14 +233,14 @@ if __name__ == "__main__":
233233
asyncio.run(main())
234234
```
235235

236-
For more advanced orchestration patterns including Sequential, Concurrent, Group Chat, Handoff, and Magentic orchestrations, see the [orchestration samples](samples/getting_started/orchestrations).
236+
For more advanced orchestration patterns including Sequential, Concurrent, Group Chat, Handoff, and Magentic orchestrations, see the [orchestration samples](samples/02-agents/orchestrations).
237237

238238
## More Examples & Samples
239239

240-
- [Getting Started with Agents](https://github.com/microsoft/agent-framework/tree/main/python/samples/getting_started/agents): Basic agent creation and tool usage
241-
- [Chat Client Examples](https://github.com/microsoft/agent-framework/tree/main/python/samples/getting_started/chat_client): Direct chat client usage patterns
240+
- [Getting Started with Agents](samples/02-agents): Basic agent creation and tool usage
241+
- [Chat Client Examples](samples/02-agents/chat_client): Direct chat client usage patterns
242242
- [Azure AI Integration](https://github.com/microsoft/agent-framework/tree/main/python/packages/azure-ai): Azure AI integration
243-
- [Workflow Samples](https://github.com/microsoft/agent-framework/tree/main/python/samples/getting_started/workflows): Advanced multi-agent patterns
243+
- [Workflow Samples](samples/03-workflows): Advanced multi-agent patterns
244244

245245
## Agent Framework Documentation
246246

python/packages/a2a/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ The A2A agent integration enables communication with remote A2A-compliant agents
1212

1313
### Basic Usage Example
1414

15-
See the [A2A agent examples](https://github.com/microsoft/agent-framework/tree/main/python/samples/getting_started/agents/a2a/) which demonstrate:
15+
See the [A2A agent examples](../../samples/04-hosting/a2a/) which demonstrate:
1616

1717
- Connecting to remote A2A agents
1818
- Sending messages and receiving responses

python/packages/anthropic/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ The Anthropic integration enables communication with the Anthropic API, allowing
1212

1313
### Basic Usage Example
1414

15-
See the [Anthropic agent examples](https://github.com/microsoft/agent-framework/tree/main/python/samples/getting_started/agents/anthropic/) which demonstrate:
15+
See the [Anthropic agent examples](../../samples/02-agents/providers/anthropic/) which demonstrate:
1616

1717
- Connecting to a Anthropic endpoint with an agent
1818
- Streaming and non-streaming responses

python/packages/azure-ai-search/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The Azure AI Search integration provides context providers for RAG (Retrieval Au
1515

1616
### Basic Usage Example
1717

18-
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:
18+
See the [Azure AI Search context provider examples](../../samples/02-agents/providers/azure_ai/) which demonstrate:
1919

2020
- Semantic search with hybrid (vector + keyword) queries
2121
- Agentic mode with Knowledge Bases for complex multi-hop reasoning

python/packages/azurefunctions/tests/integration_tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ def _get_sample_path_from_marker(request: pytest.FixtureRequest) -> tuple[Path |
300300

301301
sample_name = marker.args[0]
302302
repo_root = _resolve_repo_root()
303-
sample_path = repo_root / "samples" / "getting_started" / "azure_functions" / sample_name
303+
sample_path = repo_root / "samples" / "04-hosting" / "azure_functions" / sample_name
304304

305305
if not sample_path.exists():
306306
return None, f"Sample directory does not exist: {sample_path}"

python/packages/chatkit/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,4 +124,4 @@ async def chatkit_endpoint(request: Request):
124124
return Response(content=result.json, media_type="application/json") # type: ignore[union-attr]
125125
```
126126

127-
For a complete end-to-end example with a full frontend, see the [weather agent sample](../../samples/demos/chatkit-integration/README.md).
127+
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).

python/packages/copilotstudio/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ The package uses MSAL (Microsoft Authentication Library) for authentication with
8989

9090
### Examples
9191

92-
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:
92+
For more comprehensive examples, see the [Copilot Studio examples](../../samples/02-agents/providers/copilotstudio/) which demonstrate:
9393

9494
- Basic non-streaming and streaming execution
9595
- Explicit settings and manual token acquisition

0 commit comments

Comments
 (0)