feat: expose expected_cost + est_calls_remaining on BudgetAdvisory (#49) #123
Workflow file for this run
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
| name: CI | |
| on: | |
| pull_request: | |
| push: | |
| branches: [main] | |
| concurrency: | |
| group: ci-${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 | |
| with: | |
| python-version: '3.13' | |
| - run: python -m pip install --upgrade pip | |
| - run: pip install -e ".[dev]" | |
| - name: Ruff | |
| run: ruff check . | |
| cost-map-sync: | |
| # The LiteLLM cost map is vendored in two places — the Python package | |
| # (src/floe_guard/cost_map.json) and the JS package (js/src/cost_map.json). | |
| # They must stay byte-identical; fail loudly if they drift so any refresh | |
| # updates both. | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| with: | |
| persist-credentials: false | |
| - name: Python and JS cost maps must match | |
| # -q keeps the failure concise (the map is ~700 lines); the message says | |
| # what to do rather than dumping the whole diff. | |
| run: | | |
| diff -q src/floe_guard/cost_map.json js/src/cost_map.json \ | |
| || { echo "::error::cost_map.json drifted between src/floe_guard/ and js/src/ — re-sync the two copies."; exit 1; } | |
| test: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ['3.10', '3.11', '3.12', '3.13'] | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - run: python -m pip install --upgrade pip | |
| # Install the framework extras so the adapter handler tests actually run | |
| # (instead of skipping). langchain-core covers the LangChain handler | |
| # tests; litellm covers the callback-swallowing regression tests (the | |
| # CrewAI adapter tests stub crewai itself, so the heavy extra stays out); | |
| # langgraph covers the fan-out reserve/settle and advisory-channel tests; | |
| # livekit covers the LiveKit voice-agent reserve/settle/release tests | |
| # (livekit-agents supports Python >=3.10, so it goes in the base install). | |
| - run: pip install -e ".[dev,langchain,litellm,langgraph,livekit]" | |
| # pipecat-ai requires Python >=3.11, so add it (and exercise the Pipecat | |
| # adapter tests) on every matrix cell except 3.10 — there the tests | |
| # importorskip cleanly. | |
| - if: matrix.python-version != '3.10' | |
| run: pip install -e ".[pipecat]" | |
| - name: Pytest | |
| run: pytest -q | |
| test-js: | |
| # The npm package (Vercel AI SDK middleware) lives in js/. Run its build, | |
| # typecheck, and tests on every PR — publish-npm.yml re-runs them at publish | |
| # time, but that's too late to catch a broken PR. | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| defaults: | |
| run: | |
| working-directory: js | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | |
| with: | |
| node-version: '22' | |
| cache: npm | |
| cache-dependency-path: js/package-lock.json | |
| - run: npm ci | |
| - run: npm run build | |
| - run: npm run typecheck | |
| - run: npm test | |
| test-bare: | |
| # Locks the dependency-free contract: the package and its test suite must | |
| # work with NO framework extra installed (handler tests skip cleanly, no | |
| # import errors). This is what publish.yml runs before releasing. | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 | |
| with: | |
| python-version: '3.13' | |
| - run: python -m pip install --upgrade pip | |
| - run: pip install -e ".[dev]" | |
| - name: Pytest (no extras) | |
| run: pytest -q |