Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions samples/hosted-agent/README.md
Original file line number Diff line number Diff line change
@@ -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://<project>.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
```
3 changes: 3 additions & 0 deletions samples/hosted-agent/dotnet/agent/.foundry/.deployment.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"projectId": "{{ProjectId}}"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"projectId": "{{ProjectId}}"
}
3 changes: 3 additions & 0 deletions samples/hosted-agent/python/agent/.foundry/.deployment.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"projectId": "{{ProjectId}}"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"projectId": "{{ProjectId}}"
}
3 changes: 1 addition & 2 deletions samples/hosted-agent/python/workflow/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__":
Expand Down