A minimal Agent Framework agent hosted on Microsoft Foundry using the Responses protocol. This sample demonstrates basic request/response interaction and multi-turn conversations.
The agent uses FoundryChatClient from the Agent Framework and is served via ResponsesHostServer, which exposes a REST API compatible with the OpenAI Responses protocol. See main.py for the implementation.
- Azure Developer CLI (
azd) — Install azd - Install the AI agent extension:
azd ext install microsoft.foundry
- Authenticate:
azd auth login
No cloning required. Create a new folder and initialize from the manifest:
mkdir my-basic-agent && cd my-basic-agent
azd ai agent init -m https://github.com/microsoft-foundry/foundry-samples/blob/main/samples/python/hosted-agents/agent-framework/responses/01-basic/azure.yamlFollow the prompts to configure your Foundry project and model deployment. If you don't have an existing Foundry project, azd ai agent init will guide you through creating one.
If you don't already have a Foundry project and model deployment:
azd provisionazd ai agent runThe agent host will start on http://localhost:8088.
In a separate terminal, from the project directory:
azd ai agent invoke --local "Hi"Once tested locally, deploy to Microsoft Foundry:
azd deployFor the full deployment guide, see Deploy a hosted agent.
azd ai agent invoke "Hi"- VS Code with the Foundry Toolkit extension installed.
- For debugging Python in VS Code, install the Python extension pack.
- Python 3.13 or later and uv installed outside the project virtual environment.
-
Create and synchronize the locked environment:
uv sync --frozen
-
Open the Command Palette (
Ctrl+Shift+P), run Python: Select Interpreter, and select the.venvcreated by uv.
Press F5 to start the agent. The agent starts and the Agent Inspector opens automatically. Chat with the agent in the Inspector.
- Set the required environment variables and sign in to Azure with the Azure CLI (
az login). - Start the agent:
uv run --no-sync python main.py(listens onhttp://localhost:8088). - Command Palette (
Ctrl+Shift+P) → Foundry Toolkit: Open Agent Inspector, then send a message to test.
- Open the Command Palette (
Ctrl+Shift+P) and run Foundry Toolkit: Deploy Hosted Agent. The extension opens a Deploy Hosted Agent wizard and readsagent.yamlto auto-populate settings. - If prompted, complete Foundry Project Setup to select subscription and project.
- On the Basics tab, choose deployment method (Code or Container) and confirm the agent name.
- On Review + Deploy, confirm runtime details, pick CPU and Memory size, and click Deploy.
- After deployment, invoke the agent in the Agent Playground and stream live logs from the Logs tab.
- Quickstart: Create a hosted agent — end-to-end walkthrough using
azd - Tool catalog — browse available tools to extend your agent (Bing Search, Azure AI Search, file search, code interpreter, and more)
- Manage hosted agents — monitor and manage deployed agents
- Add tools to your agent — sample with local tool functions
- Use Foundry Toolbox — sample with Azure Foundry Toolbox integration