Foundry Hosted Agents Samples
This directory contains samples that demonstrate how to use the Agent Framework to host agents on Foundry with different capabilities and configurations. Each sample includes a README with instructions on how to set up, run, and interact with the agent.
Read more about Foundry Hosted Agents here.
Environment setup
-
Navigate to the sample directory you want to run. For example:
python -m venv .venv # Windows .venv\Scripts\Activate # macOS/Linux source .venv/bin/activate -
Install dependencies:
pip install -r requirements.txt -
Create a
.envfile with your Foundry configuration following theenv.examplefile in the sample. -
Make sure you are logged in with the Azure CLI:
az login
Deploying to a Docker container
Navigate to the sample directory and build the Docker image:
docker build -t hosted-agent-sample .
Run the container, passing in the required environment variables:
docker run -p 8088:8088 \
-e FOUNDRY_PROJECT_ENDPOINT=<your-endpoint> \
-e FOUNDRY_MODEL=<your-model> \
hosted-agent-sample
The server will be available at http://localhost:8088. You can send requests using the same curl command shown above.
Deploying to Foundry
Follow this guide to deploy your agent to Foundry.