Skip to content

Commit 9355329

Browse files
Python: [BREAKING] updated structure and samples (microsoft#875)
* updated structure and samples * updated names and removed cross tests * updated projects etc * updated tests * updated test * test fixes * removed devui for now * updated all-tests task * removed old style configs * remove coverage from tests * updated to unit tests with all-tests * updated foundry everywhere * fix azure ai tests * fix merge tests * fix mypy
1 parent 366a7f7 commit 9355329

169 files changed

Lines changed: 1156 additions & 1758 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/python-merge-tests.yml

Lines changed: 13 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -61,67 +61,10 @@ jobs:
6161
OPENAI_RESPONSES_MODEL_ID: ${{ vars.OPENAI__RESPONSESMODELID }}
6262
OPENAI_API_KEY: ${{ secrets.OPENAI__APIKEY }}
6363
LOCAL_MCP_URL: ${{ vars.LOCAL_MCP__URL }}
64-
PACKAGE_NAME: "main"
65-
defaults:
66-
run:
67-
working-directory: python
68-
steps:
69-
- uses: actions/checkout@v5
70-
- name: Set up python and install the project
71-
id: python-setup
72-
uses: ./.github/actions/python-setup
73-
with:
74-
python-version: ${{ matrix.python-version }}
75-
os: ${{ runner.os }}
76-
env:
77-
# Configure a constant location for the uv cache
78-
UV_CACHE_DIR: /tmp/.uv-cache
79-
- name: Test with pytest
80-
timeout-minutes: 10
81-
run: uv run poe --directory ./packages/${{ env.PACKAGE_NAME }} test -n logical --dist loadfile --dist worksteal --junitxml=coverage.xml
82-
working-directory: ./python
83-
- name: Test main samples
84-
timeout-minutes: 10
85-
if: env.RUN_SAMPLES_TESTS == 'true'
86-
run: uv run pytest tests/samples/ -m "openai"
87-
working-directory: ./python
88-
- name: Move coverage file
89-
run: |
90-
mv ./packages/${{ env.PACKAGE_NAME }}/coverage.xml coverage_${{ env.PACKAGE_NAME }}.xml
91-
working-directory: ./python
92-
- name: Upload coverage artifact
93-
uses: actions/upload-artifact@v4
94-
with:
95-
name: coverage-${{ env.PACKAGE_NAME }}
96-
path: ./python/coverage_${{ env.PACKAGE_NAME }}.xml
97-
- name: Surface failing tests
98-
if: always()
99-
uses: pmeier/pytest-results-action@v0.7.2
100-
with:
101-
path: ./python/**.xml
102-
summary: true
103-
display-options: fEX
104-
fail-on-empty: true
105-
title: Test results
106-
107-
python-tests-azure:
108-
name: Python Tests - Azure
109-
needs: paths-filter
110-
if: github.event_name != 'pull_request' && needs.paths-filter.outputs.pythonChanges == 'true'
111-
runs-on: ${{ matrix.os }}
112-
environment: ${{ matrix.environment }}
113-
strategy:
114-
fail-fast: true
115-
matrix:
116-
python-version: ["3.10"]
117-
os: [ubuntu-latest]
118-
environment: ["integration"]
119-
env:
120-
UV_PYTHON: ${{ matrix.python-version }}
12164
AZURE_OPENAI_CHAT_DEPLOYMENT_NAME: ${{ vars.AZUREOPENAI__CHATDEPLOYMENTNAME }}
12265
AZURE_OPENAI_RESPONSES_DEPLOYMENT_NAME: ${{ vars.AZUREOPENAI__RESPONSESDEPLOYMENTNAME }}
12366
AZURE_OPENAI_ENDPOINT: ${{ vars.AZUREOPENAI__ENDPOINT }}
124-
PACKAGE_NAME: "azure"
67+
PACKAGE_NAME: "main"
12568
defaults:
12669
run:
12770
working-directory: python
@@ -147,14 +90,14 @@ jobs:
14790
timeout-minutes: 10
14891
run: uv run poe --directory ./packages/${{ env.PACKAGE_NAME }} test -n logical --dist loadfile --dist worksteal --junitxml=coverage.xml
14992
working-directory: ./python
150-
- name: Test azure samples
93+
- name: Test main samples
15194
timeout-minutes: 10
15295
if: env.RUN_SAMPLES_TESTS == 'true'
153-
run: uv run pytest tests/samples/ -m "azure"
96+
run: uv run pytest tests/samples/ -m "openai"
15497
working-directory: ./python
15598
- name: Move coverage file
15699
run: |
157-
mv ./packages/${{ env.PACKAGE_NAME }}/coverage.xml ./coverage_${{ env.PACKAGE_NAME }}.xml
100+
mv ./packages/${{ env.PACKAGE_NAME }}/coverage.xml coverage_${{ env.PACKAGE_NAME }}.xml
158101
working-directory: ./python
159102
- name: Upload coverage artifact
160103
uses: actions/upload-artifact@v4
@@ -171,8 +114,8 @@ jobs:
171114
fail-on-empty: true
172115
title: Test results
173116

174-
python-tests-foundry:
175-
name: Python Tests - Foundry
117+
python-tests-azure-ai:
118+
name: Python Tests - AzureAI
176119
needs: paths-filter
177120
if: github.event_name != 'pull_request' && needs.paths-filter.outputs.pythonChanges == 'true'
178121
runs-on: ${{ matrix.os }}
@@ -185,9 +128,9 @@ jobs:
185128
environment: ["integration"]
186129
env:
187130
UV_PYTHON: ${{ matrix.python-version }}
188-
FOUNDRY_PROJECT_ENDPOINT: ${{ secrets.AZUREAI__ENDPOINT }}
189-
FOUNDRY_MODEL_DEPLOYMENT_NAME: ${{ vars.AZUREAI__DEPLOYMENTNAME }}
190-
PACKAGE_NAME: "foundry"
131+
AZURE_AI_PROJECT_ENDPOINT: ${{ secrets.AZUREAI__ENDPOINT }}
132+
AZURE_AI_MODEL_DEPLOYMENT_NAME: ${{ vars.AZUREAI__DEPLOYMENTNAME }}
133+
PACKAGE_NAME: "azure-ai"
191134
defaults:
192135
run:
193136
working-directory: python
@@ -213,14 +156,14 @@ jobs:
213156
timeout-minutes: 10
214157
run: uv run poe --directory ./packages/${{ env.PACKAGE_NAME }} test -n logical --dist loadfile --dist worksteal --junitxml=coverage.xml
215158
working-directory: ./python
216-
- name: Test foundry samples
159+
- name: Test azure samples
217160
timeout-minutes: 10
218161
if: env.RUN_SAMPLES_TESTS == 'true'
219-
run: uv run pytest tests/samples/ -m "foundry"
162+
run: uv run pytest tests/samples/ -m "azure-ai"
220163
working-directory: ./python
221164
- name: Move coverage file
222165
run: |
223-
mv ./packages/${{ env.PACKAGE_NAME }}/coverage.xml coverage_${{ env.PACKAGE_NAME }}.xml
166+
mv ./packages/${{ env.PACKAGE_NAME }}/coverage.xml ./coverage_${{ env.PACKAGE_NAME }}.xml
224167
working-directory: ./python
225168
- name: Upload coverage artifact
226169
uses: actions/upload-artifact@v4
@@ -245,8 +188,7 @@ jobs:
245188
needs:
246189
[
247190
python-tests-main,
248-
python-tests-azure,
249-
python-tests-foundry
191+
python-tests-azure-ai
250192
]
251193
steps:
252194

.github/workflows/python-test-coverage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
# Configure a constant location for the uv cache
3737
UV_CACHE_DIR: /tmp/.uv-cache
3838
- name: Run all tests with coverage report
39-
run: uv run poe all-tests -n logical --dist loadfile --dist worksteal --cov-report=xml:python-coverage.xml -q --junitxml=pytest.xml
39+
run: uv run poe all-tests-cov --cov-report=xml:python-coverage.xml -q --junitxml=pytest.xml
4040
- name: Upload coverage report
4141
uses: actions/upload-artifact@v4
4242
with:

.github/workflows/python-tests.yml

Lines changed: 4 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -36,100 +36,10 @@ jobs:
3636
env:
3737
# Configure a constant location for the uv cache
3838
UV_CACHE_DIR: /tmp/.uv-cache
39-
# Main package tests
40-
- name: Set environment variables - main - win
41-
if: ${{ matrix.os == 'windows-latest' }}
42-
run: |
43-
echo "PACKAGE_NAME=main" | Out-File -FilePath $env:GITHUB_ENV -Append
44-
- name: Set environment variables - main
45-
if: ${{ matrix.os != 'windows-latest' }}
46-
run: |
47-
echo "PACKAGE_NAME=main" >> $GITHUB_ENV
48-
- name: Test with pytest - main
49-
run: uv run poe --directory ./packages/${{ env.PACKAGE_NAME }} test -n logical --dist loadfile --dist worksteal --junitxml=coverage.xml
39+
# Unit tests
40+
- name: Run all tests
41+
run: uv run poe all-tests
5042
working-directory: ./python
51-
- name: Move coverage file - main
52-
run: |
53-
mv ./packages/${{ env.PACKAGE_NAME }}/coverage.xml coverage_${{ matrix.OS }}_${{ matrix.python-version }}_${{ env.PACKAGE_NAME }}.xml
54-
working-directory: ./python
55-
- name: Upload coverage artifact - main
56-
uses: actions/upload-artifact@v4
57-
with:
58-
name: coverage-${{ matrix.OS }}-${{ matrix.python-version }}-${{ env.PACKAGE_NAME }}
59-
path: ./python/coverage_${{ matrix.OS }}_${{ matrix.python-version }}_${{ env.PACKAGE_NAME }}.xml
60-
61-
# Azure package tests
62-
- name: Set environment variables - azure - win
63-
if: ${{ matrix.os == 'windows-latest' }}
64-
run: |
65-
echo "PACKAGE_NAME=azure" | Out-File -FilePath $env:GITHUB_ENV -Append
66-
- name: Set environment variables - azure
67-
if: ${{ matrix.os != 'windows-latest' }}
68-
run: |
69-
echo "PACKAGE_NAME=azure" >> $GITHUB_ENV
70-
- name: Test with pytest - azure
71-
run: uv run poe --directory ./packages/${{ env.PACKAGE_NAME }} test -n logical --dist loadfile --dist worksteal --junitxml=coverage.xml
72-
working-directory: ./python
73-
- name: Move coverage file - azure
74-
run: |
75-
mv ./packages/${{ env.PACKAGE_NAME }}/coverage.xml coverage_${{ matrix.OS }}_${{ matrix.python-version }}_${{ env.PACKAGE_NAME }}.xml
76-
working-directory: ./python
77-
- name: Upload coverage artifact - azure
78-
uses: actions/upload-artifact@v4
79-
with:
80-
name: coverage-${{ matrix.OS }}-${{ matrix.python-version }}-${{ env.PACKAGE_NAME }}
81-
path: ./python/coverage_${{ matrix.OS }}_${{ matrix.python-version }}_${{ env.PACKAGE_NAME }}.xml
82-
83-
# Foundry package tests
84-
- name: Set environment variables - foundry - win
85-
if: ${{ matrix.os == 'windows-latest' }}
86-
run: |
87-
echo "PACKAGE_NAME=foundry" | Out-File -FilePath $env:GITHUB_ENV -Append
88-
- name: Set environment variables - foundry
89-
if: ${{ matrix.os != 'windows-latest' }}
90-
run: |
91-
echo "PACKAGE_NAME=foundry" >> $GITHUB_ENV
92-
- name: Test with pytest - foundry
93-
run: uv run poe --directory ./packages/${{ env.PACKAGE_NAME }} test -n logical --dist loadfile --dist worksteal --junitxml=coverage.xml
94-
working-directory: ./python
95-
- name: Move coverage file - foundry
96-
run: |
97-
mv ./packages/${{ env.PACKAGE_NAME }}/coverage.xml coverage_${{ matrix.OS }}_${{ matrix.python-version }}_${{ env.PACKAGE_NAME }}.xml
98-
working-directory: ./python
99-
- name: Upload coverage artifact - foundry
100-
uses: actions/upload-artifact@v4
101-
with:
102-
name: coverage-${{ matrix.OS }}-${{ matrix.python-version }}-${{ env.PACKAGE_NAME }}
103-
path: ./python/coverage_${{ matrix.OS }}_${{ matrix.python-version }}_${{ env.PACKAGE_NAME }}.xml
104-
105-
# Lab package tests
106-
- name: Set environment variables - lab - win
107-
if: ${{ matrix.os == 'windows-latest' }}
108-
run: |
109-
echo "PACKAGE_NAME=lab" | Out-File -FilePath $env:GITHUB_ENV -Append
110-
- name: Set environment variables - lab
111-
if: ${{ matrix.os != 'windows-latest' }}
112-
run: |
113-
echo "PACKAGE_NAME=lab" >> $GITHUB_ENV
114-
- name: Test with pytest - lab - gaia
115-
run: uv run poe --directory ./packages/${{ env.PACKAGE_NAME }}/gaia test -n logical --dist loadfile --dist worksteal --junitxml=coverage.xml
116-
working-directory: ./python
117-
- name: Test with pytest - lab - tau2
118-
run: |
119-
uv run poe --directory ./packages/${{ env.PACKAGE_NAME }}/tau2 setup-data
120-
uv run poe --directory ./packages/${{ env.PACKAGE_NAME }}/tau2 test -n logical --dist loadfile --dist worksteal --junitxml=coverage.xml
121-
uv run poe --directory ./packages/${{ env.PACKAGE_NAME }}/tau2 purge-data
122-
working-directory: ./python
123-
- name: Move coverage file - lab
124-
run: |
125-
mv ./packages/${{ env.PACKAGE_NAME }}/gaia/coverage.xml coverage_${{ matrix.OS }}_${{ matrix.python-version }}_${{ env.PACKAGE_NAME }}_gaia.xml
126-
mv ./packages/${{ env.PACKAGE_NAME }}/tau2/coverage.xml coverage_${{ matrix.OS }}_${{ matrix.python-version }}_${{ env.PACKAGE_NAME }}_tau2.xml
127-
working-directory: ./python
128-
- name: Upload coverage artifact - lab
129-
uses: actions/upload-artifact@v4
130-
with:
131-
name: coverage-${{ matrix.OS }}-${{ matrix.python-version }}-${{ env.PACKAGE_NAME }}
132-
path: ./python/coverage_${{ matrix.OS }}_${{ matrix.python-version }}_${{ env.PACKAGE_NAME }}_*.xml
13343

13444
# Surface failing tests
13545
- name: Surface failing tests
@@ -139,5 +49,5 @@ jobs:
13949
path: ./python/**.xml
14050
summary: true
14151
display-options: fEX
142-
fail-on-empty: true
52+
fail-on-empty: false
14353
title: Test results

python/.env.example

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Foundry
2-
FOUNDRY_PROJECT_ENDPOINT=""
3-
FOUNDRY_MODEL_DEPLOYMENT_NAME=""
1+
# Azure AI
2+
AZURE_AI_PROJECT_ENDPOINT=""
3+
AZURE_AI_MODEL_DEPLOYMENT_NAME=""
44
# OpenAI
55
OPENAI_API_KEY=""
66
OPENAI_CHAT_MODEL_ID=""

python/DEV_SETUP.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ The package follows a flat import structure:
275275
- **Connectors**: Import from `agent_framework.<vendor/platform>`
276276
```python
277277
from agent_framework.openai import OpenAIChatClient
278-
from agent_framework.azure import AzureChatClient
278+
from agent_framework.azure import AzureOpenAIChatClient
279279
```
280280

281281
## Testing

python/README.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55
```bash
66
# Base package including workflow support
77
pip install agent-framework
8-
# Optional: Add Azure integration
9-
pip install agent-framework[azure]
10-
# Optional: Add Foundry integration
11-
pip install agent-framework[foundry]
8+
# Optional: Add Azure AI integration (Foundry)
9+
pip install agent-framework[azure-ai]
10+
# Optional: Add Microsoft integrations, currently only CopilotStudioAgents
11+
pip install agent-framework[microsoft]
1212
# Optional: Both
13-
pip install agent-framework[azure,foundry]
13+
pip install agent-framework[microsoft,azure-ai]
14+
# All-in-one
15+
pip install agent-framework[all]
1416
```
1517

1618
Supported Platforms:
@@ -29,16 +31,16 @@ AZURE_OPENAI_API_KEY=...
2931
AZURE_OPENAI_ENDPOINT=...
3032
AZURE_OPENAI_CHAT_DEPLOYMENT_NAME=...
3133
...
32-
FOUNDRY_PROJECT_ENDPOINT=...
33-
FOUNDRY_MODEL_DEPLOYMENT_NAME=...
34+
AZURE_AI_PROJECT_ENDPOINT=...
35+
AZURE_AI_MODEL_DEPLOYMENT_NAME=...
3436
```
3537

3638
You can also override environment variables by explicitly passing configuration parameters to the chat client constructor:
3739

3840
```python
39-
from agent_framework.azure import AzureChatClient
41+
from agent_framework.azure import AzureOpenAIChatClient
4042

41-
chat_client = AzureChatClient(
43+
chat_client = AzureOpenAIChatClient(
4244
api_key='',
4345
endpoint='',
4446
deployment_name='',
@@ -215,8 +217,8 @@ if __name__ == "__main__":
215217

216218
- [Getting Started with Agents](https://github.com/microsoft/agent-framework/tree/main/python/samples/getting_started/agents): Basic agent creation and tool usage
217219
- [Chat Client Examples](https://github.com/microsoft/agent-framework/tree/main/python/samples/getting_started/chat_client): Direct chat client usage patterns
218-
- [Azure Integration](https://github.com/microsoft/agent-framework/tree/main/python/packages/azure): Azure OpenAI and AI Foundry integration
219-
- [.NET Orchestration Samples](https://github.com/microsoft/agent-framework/tree/main/dotnet/samples/GettingStarted/Orchestration): Advanced multi-agent patterns (.NET)
220+
- [Azure AI Integration](https://github.com/microsoft/agent-framework/tree/main/python/packages/azure-ai): Azure AI integration
221+
- [Workflow Samples](https://github.com/microsoft/agent-framework/tree/main/python/samples/getting_started/workflow): Advanced multi-agent patterns
220222

221223
## Agent Framework Documentation
222224

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# Get Started with Microsoft Agent Framework Azure
1+
# Get Started with Microsoft Agent Framework Azure AI
22

33
Please install this package as the extra for `agent-framework`:
44

55
```bash
6-
pip install agent-framework[azure]
6+
pip install agent-framework[azure_ai]
77
```
88

99
and see the [README](https://github.com/microsoft/agent-framework/tree/main/python/README.md) for more information.

python/packages/foundry/agent_framework_foundry/__init__.py renamed to python/packages/azure-ai/agent_framework_azure_ai/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
import importlib.metadata
44

5-
from ._chat_client import FoundryChatClient, FoundrySettings
5+
from ._chat_client import AzureAIAgentClient, AzureAISettings
66

77
try:
88
__version__ = importlib.metadata.version(__name__)
99
except importlib.metadata.PackageNotFoundError:
1010
__version__ = "0.0.0" # Fallback for development mode
1111

1212
__all__ = [
13-
"FoundryChatClient",
14-
"FoundrySettings",
13+
"AzureAIAgentClient",
14+
"AzureAISettings",
1515
"__version__",
1616
]

0 commit comments

Comments
 (0)