name: Examples - APO permissions: contents: read on: schedule: # Every day at 3 AM UTC+8 - cron: '0 19 * * *' workflow_dispatch: repository_dispatch: types: [ci-apo, ci-all] run-name: >- ${{ github.event_name == 'repository_dispatch' && format( 'APO - PR #{0} - {1} - {2}', github.event.client_payload.pull_number, github.event.client_payload.ci_label, github.event.client_payload.correlation_id ) || format('APO - {0}', github.event_name) }} jobs: apo: if: > github.event_name != 'repository_dispatch' || github.event.action == 'ci-apo' || github.event.action == 'ci-all' name: APO (Python ${{ matrix.python-version }}, ${{ matrix.setup-script }}) # This job is run on GitHub hosted runners rather than self-hosted runners because it needs no GPU. runs-on: ubuntu-latest timeout-minutes: 30 strategy: matrix: include: - python-version: '3.10' setup-script: 'legacy' - python-version: '3.12' setup-script: 'stable' - python-version: '3.13' setup-script: 'latest' fail-fast: false steps: - uses: actions/checkout@v6 with: ref: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.pr_ref || (github.event.pull_request.number && format('refs/pull/{0}/merge', github.event.pull_request.number)) || github.ref }} - uses: astral-sh/setup-uv@v7 with: enable-cache: true python-version: ${{ matrix.python-version }} - name: Upgrade dependencies (latest) run: uv lock --upgrade if: matrix.setup-script == 'latest' - name: Sync dependencies (latest) run: | uv sync --frozen --no-default-groups --extra apo \ --group dev --group experiment --group agents --group core-stable if: matrix.setup-script == 'latest' - name: Sync dependencies (stable & legacy) run: | uv sync --frozen --no-default-groups --extra apo \ --group dev --group experiment --group agents --group core-${{ matrix.setup-script }} if: matrix.setup-script != 'latest' - name: Freeze dependencies run: | set -ex uv pip freeze | tee requirements-freeze.txt echo "UV_LOCKED=1" >> $GITHUB_ENV echo "UV_NO_SYNC=1" >> $GITHUB_ENV - name: Upload dependencies artifact uses: actions/upload-artifact@v6 with: name: dependencies-apo-${{ matrix.python-version }}-${{ matrix.setup-script }} path: requirements-freeze.txt compression-level: 0 - name: Launch LiteLLM Proxy run: | ./scripts/litellm_run.sh env: AZURE_API_BASE: ${{ secrets.AZURE_GROUP_SUBSCRIPTION_API_BASE }} AZURE_API_KEY: ${{ secrets.AZURE_GROUP_SUBSCRIPTION_API_KEY }} - name: APO custom algorithm run: | set -ex cd examples/apo uv run apo_custom_algorithm_trainer.py | tee _ci_apo.log # Check whether the log contains "Best prompt found:" grep "Best prompt found:" _ci_apo.log env: # New versions follow OPENAI_BASE_URL instead of OPENAI_API_BASE OPENAI_BASE_URL: http://localhost:12306/ OPENAI_API_KEY: dummy - name: APO custom algorithm debugger run: | set -ex cd examples/apo uv run apo_debug.py --mode runner uv run apo_debug.py --mode hook uv run apo_debug.py --mode trainer env: # New versions follow OPENAI_BASE_URL instead of OPENAI_API_BASE OPENAI_BASE_URL: http://localhost:12306/ OPENAI_API_KEY: dummy - name: APO built-in algorithm run: | set -ex cd examples/apo uv run room_selector_apo.py env: OPENAI_BASE_URL: http://localhost:12306/ OPENAI_API_KEY: dummy if: matrix.setup-script != 'legacy'