Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
# To include a file that is excluded by default, use negation: !filename

# azd tooling files
agent.yaml
agent.manifest.yaml
azure.yaml
.agentignore

Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
.azure
azure.yaml
.azure
Original file line number Diff line number Diff line change
Expand Up @@ -138,17 +138,17 @@ credential-gated behaviors or deployments is proven by an offline smoke check.
### Deploy to Foundry

```bash
cd python/samples/02-agents/harness/build_your_own_claw/claw_step04_production_ready
azd ai agent init -m agent.manifest.yaml --entry-point hosted.py
mkdir claw-hosted-agent && cd claw-hosted-agent
azd ai agent init -t https://github.com/microsoft/agent-framework/blob/main/python/samples/02-agents/harness/build_your_own_claw/claw_step04_production_ready/azure.yaml --src . --model-deployment "<existing-model-deployment>"
azd deploy
```

Foundry deploys this agent with **code (ZIP) deployment** — the default for Python hosted agents.
It uploads this folder, installs `requirements.txt`, and runs a Python entry point. Which file runs
is set by `codeConfiguration.entryPoint` in the generated `azure.yaml` and defaults to `main.py`, so
you must point it at `hosted.py`. We therefore pass `--entry-point hosted.py` to
`azd ai agent init`. The deploy packages this folder only, so `skills/` and
Select the existing Foundry project containing that model. Foundry deploys this agent with **code (ZIP)
deployment**: [`azure.yaml`](azure.yaml) sets `codeConfiguration.entryPoint` and `startupCommand` to
`hosted.py`. It uploads this folder and installs `requirements.txt`. The deploy packages this folder only, so `skills/` and
`subprocess_script_runner.py` are copied in here, making the folder a self-contained package.
The Toolbox and Purview integrations are optional. Set `TOOLBOX_MCP_SERVER_URL` and
`PURVIEW_CLIENT_APP_ID` with `azd env set` only when using them.

## Run evals

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def _build_skills_provider(credential: TokenCredential) -> tuple[SkillsProvider,
logger.warning(
"Foundry skills disabled: TOOLBOX_MCP_SERVER_URL is set but is not an http(s) URL. "
"If this looks like an unsubstituted placeholder, check the environment variable wiring "
"in azure.yaml / agent.manifest.yaml.",
"in azure.yaml.",
)
else:
logger.info("Foundry skills disabled. Set TOOLBOX_MCP_SERVER_URL to enable them.")
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/Azure/azure-dev/main/schemas/v1.0/azure.yaml.json

requiredVersions:
azd: '>=1.36.0'
extensions:
azure.ai.agents: '>=1.0.0-beta.20'
azure.ai.projects: '>=1.0.0-beta.14'
name: personal-finance-claw
services:
ai-project:
host: azure.ai.project
personal-finance-claw:
host: azure.ai.agent
project: .
language: python
uses:
- ai-project
kind: hosted
name: personal-finance-claw
description: A production-ready Agent Framework claw harness for personal finance, hosted by Foundry.
metadata:
tags:
- Agent Framework
- AI Agent Hosting
- Azure AI AgentServer
- Responses Protocol
- Harness
- CodeAct
- Monty
- Observability
- Purview
protocols:
- protocol: responses
version: 2.0.0
env:
AZURE_AI_MODEL_DEPLOYMENT_NAME: ${AZURE_AI_MODEL_DEPLOYMENT_NAME}
ENABLE_SENSITIVE_DATA: 'false'
TOOLBOX_MCP_SERVER_URL: ${TOOLBOX_MCP_SERVER_URL:-}
PURVIEW_CLIENT_APP_ID: ${PURVIEW_CLIENT_APP_ID:-}
PYTHONNOUSERSITE: '1'
startupCommand: python hosted.py
container:
resources:
cpu: '0.5'
memory: 1Gi
codeConfiguration:
dependencyResolution: remote_build
entryPoint: hosted.py
runtime: python_3_13
infra:
provider: microsoft.foundry
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
default), and the Foundry hosting runtime collects and exports the traces, metrics, and logs — so
there is no ``configure_otel_providers()`` call. When deployed, Foundry injects
``APPLICATIONINSIGHTS_CONNECTION_STRING`` automatically. To capture prompt/response content, set
``ENABLE_SENSITIVE_DATA=true`` (see ``agent.yaml``). Because the exporters are Foundry-managed, run
``ENABLE_SENSITIVE_DATA=true`` (see ``azure.yaml``). Because the exporters are Foundry-managed, run
this host with ``azd ai agent run`` to see telemetry; running it directly won't export anything.

File access and shell are disabled on the hosted container (see ``enable_file_access`` /
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
.venv
__pycache__
.azure
.git
.env
.env.*
*.pyc
*.pyo
*.pyd
Expand Down
Original file line number Diff line number Diff line change
@@ -1,35 +1,12 @@
# Build this image with the repository's `python/` directory as the build context so
# the in-tree agent-framework packages can be installed from source. From the repo root:
#
# docker build \
# -f python/samples/04-hosting/foundry-hosted-agents/responses/08_hyperlight_codeact/Dockerfile \
# -t <acr>.azurecr.io/<image>:<tag> \
# python/
FROM python:3.12-slim

WORKDIR /app
ENV PYTHONNOUSERSITE=1

# Copy the in-tree agent-framework packages we need. Order matters for editable
# installs because of inter-package dependencies; we install in dependency order
# below. Hyperlight backends are platform gated, so we install them via pip
# resolution rather than copying the wheels.
COPY packages/core /opt/af/core
COPY packages/openai /opt/af/openai
COPY packages/foundry /opt/af/foundry
COPY packages/foundry_hosting /opt/af/foundry_hosting
COPY packages/hyperlight /opt/af/hyperlight

# Copy just the sample we care about into the user agent location.
COPY samples/04-hosting/foundry-hosted-agents/responses/08_hyperlight_codeact/ /app/user_agent/
WORKDIR /app/user_agent

RUN pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir /opt/af/core \
&& pip install --no-cache-dir /opt/af/openai \
&& pip install --no-cache-dir /opt/af/foundry \
&& pip install --no-cache-dir /opt/af/foundry_hosting \
&& pip install --no-cache-dir /opt/af/hyperlight \
&& if grep -Eq '^[[:space:]]*[^#[:space:]]' requirements.txt; then pip install --no-cache-dir -r requirements.txt; fi
COPY requirements.txt .
RUN pip install --no-cache-dir --pre -r requirements.txt
COPY main.py .

EXPOSE 8088

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ direct LLM tools. All of this can be run as a container, however not under all c
> below). We are working with the platform team to enable a hypervisor-capable
> hosting target.

The sample's `azure.yaml` uses the current azd project format, but it does not
remove this hypervisor requirement.

## How It Works

### Model integration
Expand Down Expand Up @@ -62,11 +65,27 @@ nested virtualization and `/dev/kvm` device passthrough — for example an Azure
VM, AKS nodes with KVM enabled, or Azure Container Instances configured for
nested virt.

Build and run the self-contained container on a supported Linux host:

```bash
docker build -t hyperlight-codeact .
docker run --device=/dev/kvm --env-file .env -p 8088:8088 hyperlight-codeact
```

The container also needs Azure identity credentials for its Foundry model.

## Running the Agent Host

Follow the instructions in the
[Running the Agent Host Locally](../../foundry-hosted-agents//README.md#running-the-agent-host-locally)
section of the README in the Foundry Hosted Agent directory.
To initialize a standalone project for local `azd` use:

```bash
mkdir hyperlight-codeact && cd hyperlight-codeact
azd ai agent init -t https://github.com/microsoft/agent-framework/blob/main/python/samples/04-hosting/container/hyperlight_codeact/azure.yaml --src .
```

Then follow the
[local host instructions](../../foundry-hosted-agents/README.md#running-the-agent-host-locally),
using a host with a supported hypervisor.

## Interacting with the agent

Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/Azure/azure-dev/main/schemas/v1.0/azure.yaml.json

requiredVersions:
azd: '>=1.36.0'
extensions:
azure.ai.agents: '>=1.0.0-beta.20'
azure.ai.projects: '>=1.0.0-beta.14'
name: agent-framework-agent-with-hyperlight-codeact-responses
services:
ai-project:
host: azure.ai.project
deployments:
- name: gpt-4.1-mini
model:
format: OpenAI
name: gpt-4.1-mini
version: '2025-04-14'
sku:
name: GlobalStandard
capacity: 10
agent-framework-agent-with-hyperlight-codeact-responses:
host: azure.ai.agent
project: .
language: docker
docker:
remoteBuild: true
uses:
- ai-project
kind: hosted
name: agent-framework-agent-with-hyperlight-codeact-responses
description: An Agent Framework agent with a Hyperlight CodeAct sandbox hosted by Foundry.
metadata:
tags:
- Agent Framework
- AI Agent Hosting
- Azure AI AgentServer
- Responses Protocol
- Streaming
- Hyperlight CodeAct
protocols:
- protocol: responses
version: 2.0.0
env:
AZURE_AI_MODEL_DEPLOYMENT_NAME: ${AZURE_AI_MODEL_DEPLOYMENT_NAME}
PYTHONNOUSERSITE: '1'
startupCommand: python main.py
container:
resources:
cpu: '1'
memory: 2Gi
infra:
provider: microsoft.foundry
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
from typing import Annotated, Any, Literal

from agent_framework import Agent, tool
from agent_framework.foundry import FoundryChatClient, FoundryChatOptions, ResponsesHostServer
from agent_framework.foundry import FoundryChatClient, FoundryChatOptions
from agent_framework.hyperlight import HyperlightCodeActProvider
from agent_framework_foundry_hosting import ResponsesHostServer
from azure.identity import DefaultAzureCredential
from dotenv import load_dotenv

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# agent-framework, agent-framework-foundry-hosting, and agent-framework-hyperlight
# are installed from local source by the Dockerfile (build context = python/).
# Add any sample-only third-party deps here.
agent-framework-foundry
agent-framework-foundry-hosting
agent-framework-hyperlight
azure-identity
python-dotenv
Loading
Loading