Skip to content

Nightly production evaluation #34

Nightly production evaluation

Nightly production evaluation #34

Workflow file for this run

name: Nightly production evaluation
on:
schedule:
- cron: "0 6 * * *"
workflow_dispatch:
permissions:
id-token: write
issues: write
jobs:
monitor:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
- name: Install dependencies
run: pip install -r requirements.txt
- uses: azure/login@v2
with:
client-id: ${{ vars.AZURE_CLIENT_ID }}
tenant-id: ${{ vars.AZURE_TENANT_ID }}
subscription-id: ${{ vars.AZURE_SUBSCRIPTION_ID }}
- name: Get latest agent version
id: agent
env:
FOUNDRY_PROD_ENDPOINT: ${{ vars.FOUNDRY_PROD_ENDPOINT }}
run: |
VERSION=$(python3 -c "
import os
from azure.ai.projects import AIProjectClient
from azure.identity import DefaultAzureCredential
client = AIProjectClient(endpoint=os.environ['FOUNDRY_PROD_ENDPOINT'], credential=DefaultAzureCredential())
versions = client.agents.list_versions(agent_name='tech-trends-agent')
latest = max(versions, key=lambda v: int(v.version))
print(latest.version)
")
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Run evaluation against production agent
id: eval
uses: microsoft/ai-agent-evals@v3-beta
with:
azure-ai-project-endpoint: ${{ vars.FOUNDRY_PROD_ENDPOINT }}
deployment-name: ${{ vars.GPT_DEPLOYMENT }}
agent-ids: "tech-trends-agent:${{ steps.agent.outputs.version }}"
data-path: "./evals/golden-dataset.json"
evaluation-result-view: "default"
- name: Open GitHub issue if scores degraded
if: failure()
uses: actions/github-script@v7
with:
script: |
github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: `Production agent eval degraded - ${new Date().toISOString().split('T')[0]}`,
body: 'Nightly evaluation scored below threshold. Check the [Actions run](' +
`${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}).`,
labels: ['agent-quality', 'alert']
});