Drift Agent Runner #627
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Drift Agent Runner | |
| # | |
| # ⚠️ EXPERIMENTAL / HUMAN-IN-THE-LOOP — NOT auto-healing production infrastructure. | |
| # Proposed patches land in agents/output/; a human must review, test, and merge. | |
| # See agents/README.md | |
| # | |
| # Polls pending schema-drift events and uses an LLM (via LlamaIndex) to propose | |
| # mapper patches for src/mappers/. Run on a schedule or after production drift is detected. | |
| # | |
| # Required secrets (GitHub Actions): | |
| # DRIFT_AGENT_TOKEN — matches UniSchema DRIFT_AGENT_TOKEN | |
| # OPENAI_API_KEY — LLM provider key for patch generation | |
| # | |
| # Optional: | |
| # UNISCHEMA_API_URL — production API base URL | |
| # DATABASE_URL — local SQLite path when running against a copied DB | |
| name: Drift Agent Runner | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '0 * * * *' | |
| concurrency: | |
| group: drift-agent-${{ github.ref }} | |
| cancel-in-progress: false | |
| jobs: | |
| drift-agent: | |
| name: Process pending schema drift events | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v7 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| cache: pip | |
| cache-dependency-path: agents/drift_runner/requirements.txt | |
| - name: Install drift runner dependencies | |
| run: pip install -r agents/drift_runner/requirements.txt | |
| - name: Run drift agent (dry-run when secrets are missing) | |
| env: | |
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
| DRIFT_AGENT_TOKEN: ${{ secrets.DRIFT_AGENT_TOKEN }} | |
| UNISCHEMA_API_URL: ${{ secrets.UNISCHEMA_API_URL }} | |
| run: | | |
| if [ -z "$DRIFT_AGENT_TOKEN" ] || [ -z "$UNISCHEMA_API_URL" ]; then | |
| echo "Missing DRIFT_AGENT_TOKEN or UNISCHEMA_API_URL — running dry-run against local fixtures only." | |
| python -m agents.drift_runner --dry-run --limit 1 | |
| exit 0 | |
| fi | |
| python -m agents.drift_runner \ | |
| --api-url "$UNISCHEMA_API_URL" \ | |
| --token "$DRIFT_AGENT_TOKEN" \ | |
| --limit 5 | |
| - name: Upload proposed mapper patches | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: drift-agent-output | |
| path: | | |
| agents/output/ | |
| tests/__fixtures__/drift/ | |
| tests/autogenerated/ | |
| if-no-files-found: ignore |