Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
23 changes: 8 additions & 15 deletions samples/python/hosted-agents/agent-framework/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ The extension also adds an **Agent Inspector** UI for chatting with a hosted age
1. **Foundry Toolkit VS Code Extension** — [install from the VS Code marketplace](https://learn.microsoft.com/en-us/azure/foundry/agents/quickstarts/quickstart-hosted-agent?pivots=vscode) and sign in to Azure.
2. For debugging Python in VS Code, install the **[Python](https://marketplace.visualstudio.com/items?itemName=ms-python.python)** extension pack.
3. Python 3.10 or later. The uv setup option requires Python 3.13 or later.
4. [pipx](https://pipx.pypa.io/stable/installation/) if you use the uv setup option.
4. [uv](https://docs.astral.sh/uv/getting-started/installation/) installed outside the project virtual environment if you use the uv setup option.
Comment thread
luyajun0205 marked this conversation as resolved.

#### Set up the Python virtual environment

Expand All @@ -179,11 +179,10 @@ Use the setup option that matches the dependency files included with the sample.

**Using uv**

Install uv outside the project environment, then let uv create and synchronize the locked environment:
Create and synchronize the locked environment:

```bash
pipx install uv==0.11.7
uv sync --frozen --python 3.13
uv sync --frozen
```

Open the Command Palette (`Ctrl+Shift+P`), run **Python: Select Interpreter**, and select the `.venv` created by uv.
Expand All @@ -210,7 +209,7 @@ Once the agent is running on `http://localhost:8088/` (via [`azd ai agent run`](
2. A deployed model in your Foundry project
3. Azure CLI installed and authenticated
4. Python 3.10 or later. The uv setup option requires Python 3.13 or later.
5. [pipx](https://pipx.pypa.io/stable/installation/) if you use the uv setup option
5. [uv](https://docs.astral.sh/uv/getting-started/installation/) installed outside the project virtual environment if you use the uv setup option

#### Running the Agent Host with Python

Expand Down Expand Up @@ -247,17 +246,11 @@ Use the setup option that matches the dependency files included with the sample.

**Using uv**

1. Install uv outside the project environment:
Navigate to the sample's service directory (the `project` path in its `azure.yaml`), then create and synchronize the locked environment:

```bash
pipx install uv==0.11.7
```

2. Navigate to the sample's service directory (the `project` path in its `azure.yaml`), then create and synchronize the locked environment:

```bash
uv sync --frozen --python 3.13
```
```bash
uv sync --frozen
```

After setting up the environment:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,14 @@ azd ai agent invoke '{"message": "Hi"}'

1. **VS Code** with the **[Foundry Toolkit](https://marketplace.visualstudio.com/items?itemName=ms-windows-ai-studio.windows-ai-studio)** extension installed.
2. For debugging Python in VS Code, install the **[Python](https://marketplace.visualstudio.com/items?itemName=ms-python.python)** extension pack.
3. **Python 3.13 or later** and [uv](https://docs.astral.sh/uv/getting-started/installation/) installed outside the project virtual environment.

### Set up the Python virtual environment

- With Python 3.13 or later and [pipx](https://pipx.pypa.io/stable/installation/), install uv outside the project environment, then let uv create and synchronize the locked environment:
- Create and synchronize the locked environment:

```bash
pipx install uv==0.11.7
uv sync --frozen --python 3.13
uv sync --frozen
```
- Open the Command Palette (`Ctrl+Shift+P`), run **Python: Select Interpreter**, and select the `.venv` created by uv.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,14 @@ azd ai agent invoke '{"message": "Write a short friendly hello message."}'

1. **VS Code** with the **[Foundry Toolkit](https://marketplace.visualstudio.com/items?itemName=ms-windows-ai-studio.windows-ai-studio)** extension installed.
2. For debugging Python in VS Code, install the **[Python](https://marketplace.visualstudio.com/items?itemName=ms-python.python)** extension pack.
3. **Python 3.13 or later** and [uv](https://docs.astral.sh/uv/getting-started/installation/) installed outside the project virtual environment.

### Set up the Python virtual environment

- With Python 3.13 or later and [pipx](https://pipx.pypa.io/stable/installation/), install uv outside the project environment, then let uv create and synchronize the locked environment:
- Create and synchronize the locked environment:

```bash
pipx install uv==0.11.7
uv sync --frozen --python 3.13
uv sync --frozen
```
- Open the Command Palette (`Ctrl+Shift+P`), run **Python: Select Interpreter**, and select the `.venv` created by uv.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@ azd ai agent invoke "Hi"

1. **VS Code** with the **[Foundry Toolkit](https://marketplace.visualstudio.com/items?itemName=ms-windows-ai-studio.windows-ai-studio)** extension installed.
2. For debugging Python in VS Code, install the **[Python](https://marketplace.visualstudio.com/items?itemName=ms-python.python)** extension pack.
3. **Python 3.13 or later** and [uv](https://docs.astral.sh/uv/getting-started/installation/) installed outside the project virtual environment.

### Set up the Python virtual environment

- With Python 3.13 or later and [pipx](https://pipx.pypa.io/stable/installation/), install uv outside the project environment, then let uv create and synchronize the locked environment:
- Create and synchronize the locked environment:

```bash
pipx install uv==0.11.7
uv sync --frozen --python 3.13
uv sync --frozen
```
- Open the Command Palette (`Ctrl+Shift+P`), run **Python: Select Interpreter**, and select the `.venv` created by uv.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,14 @@ azd ai agent invoke "What is the weather in Seattle?"

1. **VS Code** with the **[Foundry Toolkit](https://marketplace.visualstudio.com/items?itemName=ms-windows-ai-studio.windows-ai-studio)** extension installed.
2. For debugging Python in VS Code, install the **[Python](https://marketplace.visualstudio.com/items?itemName=ms-python.python)** extension pack.
3. **Python 3.13 or later** and [uv](https://docs.astral.sh/uv/getting-started/installation/) installed outside the project virtual environment.

### Set up the Python virtual environment

- With Python 3.13 or later and [pipx](https://pipx.pypa.io/stable/installation/), install uv outside the project environment, then let uv create and synchronize the locked environment:
- Create and synchronize the locked environment:

```bash
pipx install uv==0.11.7
uv sync --frozen --python 3.13
uv sync --frozen
```
- Open the Command Palette (`Ctrl+Shift+P`), run **Python: Select Interpreter**, and select the `.venv` created by uv.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,14 @@ azd ai agent invoke "What tools do you have?"

1. **VS Code** with the **[Foundry Toolkit](https://marketplace.visualstudio.com/items?itemName=ms-windows-ai-studio.windows-ai-studio)** extension installed.
2. For debugging Python in VS Code, install the **[Python](https://marketplace.visualstudio.com/items?itemName=ms-python.python)** extension pack.
3. **Python 3.13 or later** and [uv](https://docs.astral.sh/uv/getting-started/installation/) installed outside the project virtual environment.

#### Set up the Python virtual environment

- With Python 3.13 or later and [pipx](https://pipx.pypa.io/stable/installation/), install uv outside the project environment, then let uv create and synchronize the locked environment:
- Create and synchronize the locked environment:

```bash
pipx install uv==0.11.7
uv sync --frozen --python 3.13
uv sync --frozen
```
- Open the Command Palette (`Ctrl+Shift+P`), run **Python: Select Interpreter**, and select the `.venv` created by uv.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,14 @@ azd ai agent invoke "Create a slogan for a new electric SUV that is affordable a

1. **VS Code** with the **[Foundry Toolkit](https://marketplace.visualstudio.com/items?itemName=ms-windows-ai-studio.windows-ai-studio)** extension installed.
2. For debugging Python in VS Code, install the **[Python](https://marketplace.visualstudio.com/items?itemName=ms-python.python)** extension pack.
3. **Python 3.13 or later** and [uv](https://docs.astral.sh/uv/getting-started/installation/) installed outside the project virtual environment.

### Set up the Python virtual environment

- With Python 3.13 or later and [pipx](https://pipx.pypa.io/stable/installation/), install uv outside the project environment, then let uv create and synchronize the locked environment:
- Create and synchronize the locked environment:

```bash
pipx install uv==0.11.7
uv sync --frozen --python 3.13
uv sync --frozen
```
- Open the Command Palette (`Ctrl+Shift+P`), run **Python: Select Interpreter**, and select the `.venv` created by uv.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,15 @@ azd ai agent invoke --new-session "Hi!"

1. **VS Code** with the **[Foundry Toolkit](https://marketplace.visualstudio.com/items?itemName=ms-windows-ai-studio.windows-ai-studio)** extension installed.
2. For debugging Python in VS Code, install the **[Python](https://marketplace.visualstudio.com/items?itemName=ms-python.python)** extension pack.
3. A Foundry Toolbox must exist in the selected Foundry project. By default, the sample uses a toolbox named `agent-tools` with `code_interpreter` and `web_search` tools.
3. **Python 3.13 or later** and [uv](https://docs.astral.sh/uv/getting-started/installation/) installed outside the project virtual environment.
4. A Foundry Toolbox must exist in the selected Foundry project. By default, the sample uses a toolbox named `agent-tools` with `code_interpreter` and `web_search` tools.

### Set up the Python virtual environment

- With Python 3.13 or later and [pipx](https://pipx.pypa.io/stable/installation/), install uv outside the project environment, then let uv create and synchronize the locked environment:
- Create and synchronize the locked environment:

```bash
pipx install uv==0.11.7
uv sync --frozen --python 3.13
uv sync --frozen
```
- Open the Command Palette (`Ctrl+Shift+P`), run **Python: Select Interpreter**, and select the `.venv` created by uv.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,20 +103,16 @@ azd ai agent invoke "Create a colorful 3-day PDF travel guide for Lisbon focused

1. **VS Code** with the **[Foundry Toolkit](https://marketplace.visualstudio.com/items?itemName=ms-windows-ai-studio.windows-ai-studio)** extension installed.
2. For debugging Python in VS Code, install the **[Python](https://marketplace.visualstudio.com/items?itemName=ms-python.python)** extension pack.
3. **Python 3.13 or later** and [uv](https://docs.astral.sh/uv/getting-started/installation/) installed outside the project virtual environment.

### Set up the Python virtual environment

- Open the Command Palette (`Ctrl+Shift+P`) and run **Python: Create Environment...** to create a virtual environment in the workspace (or **Python: Select Interpreter** to use an existing one).
- Install dependencies in the virtual environment:
- Create and synchronize the locked environment:

```bash
# use uv to accelerate
pip install uv
uv pip install -r requirements.txt

# or pure pip
pip install -r requirements.txt
uv sync --frozen
```
- Open the Command Palette (`Ctrl+Shift+P`), run **Python: Select Interpreter**, and select the `.venv` created by uv.

### Run and debug the agent

Expand All @@ -125,7 +121,7 @@ Press **F5** to start the agent. The agent starts and the **Agent Inspector** op
### Or run manually, then open the Inspector

1. Set the required environment variables and sign in to Azure with the Azure CLI (`az login`).
2. Start the agent: `python main.py` (listens on `http://localhost:8088`).
2. Start the agent: `uv run --no-sync python main.py` (listens on `http://localhost:8088`).
3. Command Palette (`Ctrl+Shift+P`) → **Foundry Toolkit: Open Agent Inspector**, then send a message to test.

### Deploy to Foundry
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
FROM python:3.12-slim
FROM ghcr.io/astral-sh/uv:0.11.7 AS uv
FROM python:3.13-slim

WORKDIR /app
COPY --from=uv /uv /uvx /bin/

COPY . user_agent/
WORKDIR /app/user_agent
COPY pyproject.toml uv.lock uv.toml ./
RUN uv sync --frozen --no-dev --no-install-project

RUN if [ -f requirements.txt ]; then \
pip install -r requirements.txt; \
else \
echo "No requirements.txt found"; \
fi
COPY . .

EXPOSE 8088

Expand All @@ -23,7 +21,7 @@ EXPOSE 8088
# container start.
# PYTHONDONTWRITEBYTECODE is cleared for these commands only: it blocks
# bytecode *writes*, not *reads*, so images that set it still benefit.
RUN PYTHONDONTWRITEBYTECODE= python -m compileall -q $(python -c "import sysconfig as s; print(s.get_paths()['stdlib'], s.get_paths()['purelib'])") || true; \
PYTHONDONTWRITEBYTECODE= python -m compileall -q .
RUN PYTHONDONTWRITEBYTECODE= .venv/bin/python -m compileall -q $(.venv/bin/python -c "import sysconfig as s; print(s.get_paths()['stdlib'], s.get_paths()['purelib'])") || true; \
PYTHONDONTWRITEBYTECODE= .venv/bin/python -m compileall -q -x '[.]venv' .

CMD ["python", "main.py"]
CMD ["/app/user_agent/.venv/bin/python", "main.py"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[project]
name = "agent-framework-agent-with-skills-responses"
version = "0.1.0"
description = "A Microsoft Foundry hosted agent with native file-based skills."
requires-python = ">=3.13"
dependencies = [
"agent-framework-foundry==1.10.4",
"agent-framework-foundry-hosting==1.0.0b260813",
"debugpy==1.8.21",
]

This file was deleted.

This file was deleted.

Loading
Loading