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 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..2ba8126 --- /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..2ba8126 --- /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..2ba8126 --- /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..2ba8126 --- /dev/null +++ b/samples/hosted-agent/python/workflow/.foundry/.deployment.json @@ -0,0 +1,3 @@ +{ + "projectId": "{{ProjectId}}" +} \ No newline at end of file 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__":