* fixes to FoundryAgent to connect to new hosted agents Co-authored-by: Copilot <copilot@github.com> * fix mypy Co-authored-by: Copilot <copilot@github.com> * Python: remove Foundry service session helpers Remove the public hosted-agent service session CRUD helpers from FoundryAgent and drop the related feature-stage inventory entry. Update the hosted-agent sample to create and delete service sessions directly through the preview AIProjectClient APIs, and tighten a few test harnesses surfaced by full workspace validation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix from merge * fix hosted env detection Co-authored-by: Copilot <copilot@github.com> * reverted sample update * fix tests and code Co-authored-by: Copilot <copilot@github.com> * remove aenter * skipping some tests Co-authored-by: Copilot <copilot@github.com> --------- Co-authored-by: Copilot <copilot@github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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 MODEL_DEPLOYMENT_NAME=<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.