From 9703334180ec8978e2469cdf8fa78463375bcdba Mon Sep 17 00:00:00 2001 From: "huimiu[safe]" Date: Thu, 5 Mar 2026 23:12:47 +0800 Subject: [PATCH 1/4] feat: add .deployment.json files for hosted agent samples in dotnet and python --- samples/hosted-agent/dotnet/agent/.foundry/.deployment.json | 3 +++ samples/hosted-agent/dotnet/workflow/.foundry/.deployment.json | 3 +++ samples/hosted-agent/python/agent/.foundry/.deployment.json | 3 +++ samples/hosted-agent/python/workflow/.foundry/.deployment.json | 3 +++ 4 files changed, 12 insertions(+) create mode 100644 samples/hosted-agent/dotnet/agent/.foundry/.deployment.json create mode 100644 samples/hosted-agent/dotnet/workflow/.foundry/.deployment.json create mode 100644 samples/hosted-agent/python/agent/.foundry/.deployment.json create mode 100644 samples/hosted-agent/python/workflow/.foundry/.deployment.json diff --git a/samples/hosted-agent/dotnet/agent/.foundry/.deployment.json b/samples/hosted-agent/dotnet/agent/.foundry/.deployment.json new file mode 100644 index 0000000..9f58001 --- /dev/null +++ b/samples/hosted-agent/dotnet/agent/.foundry/.deployment.json @@ -0,0 +1,3 @@ +{ + "projectId": "{{projectId}}" +} \ No newline at end of file diff --git a/samples/hosted-agent/dotnet/workflow/.foundry/.deployment.json b/samples/hosted-agent/dotnet/workflow/.foundry/.deployment.json new file mode 100644 index 0000000..9f58001 --- /dev/null +++ b/samples/hosted-agent/dotnet/workflow/.foundry/.deployment.json @@ -0,0 +1,3 @@ +{ + "projectId": "{{projectId}}" +} \ No newline at end of file diff --git a/samples/hosted-agent/python/agent/.foundry/.deployment.json b/samples/hosted-agent/python/agent/.foundry/.deployment.json new file mode 100644 index 0000000..9f58001 --- /dev/null +++ b/samples/hosted-agent/python/agent/.foundry/.deployment.json @@ -0,0 +1,3 @@ +{ + "projectId": "{{projectId}}" +} \ No newline at end of file diff --git a/samples/hosted-agent/python/workflow/.foundry/.deployment.json b/samples/hosted-agent/python/workflow/.foundry/.deployment.json new file mode 100644 index 0000000..9f58001 --- /dev/null +++ b/samples/hosted-agent/python/workflow/.foundry/.deployment.json @@ -0,0 +1,3 @@ +{ + "projectId": "{{projectId}}" +} \ No newline at end of file From fb275475d38f8fa12e6aafcd3fc78752eb3e319a Mon Sep 17 00:00:00 2001 From: "huimiu[safe]" Date: Thu, 5 Mar 2026 23:21:54 +0800 Subject: [PATCH 2/4] fix: standardize projectId casing in .deployment.json files across dotnet and python samples --- samples/hosted-agent/dotnet/agent/.foundry/.deployment.json | 2 +- samples/hosted-agent/dotnet/workflow/.foundry/.deployment.json | 2 +- samples/hosted-agent/python/agent/.foundry/.deployment.json | 2 +- samples/hosted-agent/python/workflow/.foundry/.deployment.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/samples/hosted-agent/dotnet/agent/.foundry/.deployment.json b/samples/hosted-agent/dotnet/agent/.foundry/.deployment.json index 9f58001..2ba8126 100644 --- a/samples/hosted-agent/dotnet/agent/.foundry/.deployment.json +++ b/samples/hosted-agent/dotnet/agent/.foundry/.deployment.json @@ -1,3 +1,3 @@ { - "projectId": "{{projectId}}" + "projectId": "{{ProjectId}}" } \ No newline at end of file diff --git a/samples/hosted-agent/dotnet/workflow/.foundry/.deployment.json b/samples/hosted-agent/dotnet/workflow/.foundry/.deployment.json index 9f58001..2ba8126 100644 --- a/samples/hosted-agent/dotnet/workflow/.foundry/.deployment.json +++ b/samples/hosted-agent/dotnet/workflow/.foundry/.deployment.json @@ -1,3 +1,3 @@ { - "projectId": "{{projectId}}" + "projectId": "{{ProjectId}}" } \ No newline at end of file diff --git a/samples/hosted-agent/python/agent/.foundry/.deployment.json b/samples/hosted-agent/python/agent/.foundry/.deployment.json index 9f58001..2ba8126 100644 --- a/samples/hosted-agent/python/agent/.foundry/.deployment.json +++ b/samples/hosted-agent/python/agent/.foundry/.deployment.json @@ -1,3 +1,3 @@ { - "projectId": "{{projectId}}" + "projectId": "{{ProjectId}}" } \ No newline at end of file diff --git a/samples/hosted-agent/python/workflow/.foundry/.deployment.json b/samples/hosted-agent/python/workflow/.foundry/.deployment.json index 9f58001..2ba8126 100644 --- a/samples/hosted-agent/python/workflow/.foundry/.deployment.json +++ b/samples/hosted-agent/python/workflow/.foundry/.deployment.json @@ -1,3 +1,3 @@ { - "projectId": "{{projectId}}" + "projectId": "{{ProjectId}}" } \ No newline at end of file From 3229b1ff779ccc979bb36d69ec192ed262f054e0 Mon Sep 17 00:00:00 2001 From: "huimiu[safe]" Date: Fri, 6 Mar 2026 12:13:50 +0800 Subject: [PATCH 3/4] fix: correct indentation in main function for agent framework execution --- samples/hosted-agent/python/workflow/main.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/samples/hosted-agent/python/workflow/main.py b/samples/hosted-agent/python/workflow/main.py index 6365887..bf09861 100644 --- a/samples/hosted-agent/python/workflow/main.py +++ b/samples/hosted-agent/python/workflow/main.py @@ -99,8 +99,7 @@ async def main() -> None: # Server mode (default) print("Starting workflow agent HTTP server...") from azure.ai.agentserver.agentframework import from_agent_framework - - await from_agent_framework(agent).run_async() + await from_agent_framework(agent).run_async() if __name__ == "__main__": From d83d52986a34a30a81e8fde32c810e434d3da787 Mon Sep 17 00:00:00 2001 From: "huimiu[safe]" Date: Fri, 6 Mar 2026 12:30:56 +0800 Subject: [PATCH 4/4] feat: add README.md for hosted agent samples with templates and usage instructions --- samples/hosted-agent/README.md | 48 ++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 samples/hosted-agent/README.md diff --git a/samples/hosted-agent/README.md b/samples/hosted-agent/README.md new file mode 100644 index 0000000..b55ec4d --- /dev/null +++ b/samples/hosted-agent/README.md @@ -0,0 +1,48 @@ +# Hosted Agent Samples + +This folder contains sample templates for building code-based **hosted agents** that can be deployed to Microsoft Foundry. Templates are available in both **Python** and **.NET**. + +## Available Templates + +| Template | Python | .NET | Description | +|----------|--------|------|-------------| +| **Agent** | `python/agent` | `dotnet/agent` | A single agent with local tool execution (Seattle Hotel search demo) | +| **Workflow** | `python/workflow` | `dotnet/workflow` | A multi-agent workflow with Writer and Reviewer agents | +| **Minimal** | `python/minimal` | `dotnet/minimal` | A bare-bones Dockerfile for custom implementations | + +## Placeholder Values + +These samples are **project templates** and contain placeholder values that must be replaced before use: + +- `{{AgentName}}` — Your agent's name +- `{{PROJECT_ENDPOINT}}` — Your Microsoft Foundry project endpoint (e.g., `https://.services.ai.azure.com`) +- `{{MODEL_DEPLOYMENT_NAME}}` — Your deployed model name (e.g., `gpt-4o`, `gpt-4.1-mini`) +- `{{SafeProjectName}}` — (.NET) Your project name for the `.csproj` file + +These placeholders appear in `agent.yaml`, source files, and project configuration files throughout the templates. + +## Recommended: Use the Microsoft Foundry VS Code Extension + +For the best experience creating hosted agents, we recommend using the **Microsoft Foundry for Visual Studio Code** extension instead of manually filling in placeholders. The extension provides a guided workflow that automatically configures your project, connects to your Microsoft Foundry resources, and scaffolds a ready-to-run agent project. + +**Install the extension:** [Microsoft Foundry for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=ms-windows-ai-studio.windows-ai-studio) + +With the extension you can: +- Scaffold a new hosted agent project with your settings pre-filled +- Deploy directly to Microsoft Foundry from VS Code +- Test and debug agents locally before deployment + +## Project Structure + +``` +hosted-agent/ +├── version-manifest.json # Version and release metadata +├── python/ +│ ├── agent/ # Single agent with local tool +│ ├── workflow/ # Multi-agent workflow +│ └── minimal/ # Minimal Dockerfile only +└── dotnet/ + ├── agent/ # Single agent with local tool + ├── workflow/ # Multi-agent workflow + └── minimal/ # Minimal Dockerfile only +``` \ No newline at end of file