Skip to content
Memtru
Documentation menu
Guides

CI integration

Memtru runs wherever Python 3.11+ runs. Use exit codes to fail the build and keep the reports as artifacts. Uploading to the dashboard is optional.

GitHub Actions

A complete workflow is in examples/github-actions/memory-tests.yml:

name: Agent memory tests
on:
  pull_request:
  push:
    branches: [main]

jobs:
  memory-tests:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: actions/setup-python@v7
        with:
          python-version: "3.12"
      - name: Install Memtru
        run: pip install memtru
      - name: Run memory tests
        run: memtru test --config memtru.yaml
      - name: Keep reports
        if: always()
        uses: actions/upload-artifact@v7
        with:
          name: memtru-report
          path: .memtru/reports/

Action versions were current major versions when this was written; check for newer ones before adopting.

Optional upload

Store a project token as the MEMTRU_TOKEN secret, then add:

      - name: Upload sanitized report
        if: always()
        run: memtru upload --yes
        env:
          MEMTRU_URL: https://memtru.com   # optional; this is the default
          MEMTRU_TOKEN: ${{ secrets.MEMTRU_TOKEN }}

The token is read from the environment and never printed. GitHub also masks secrets in logs.

Policies

  • Fail on inconclusive results: memtru test --fail-on-inconclusive (exit 4) or ci.fail_on_inconclusive: true.
  • Block regressions only: run on the base branch, keep its JSON as an artifact, then memtru compare base.json .memtru/reports/latest.json (exit 1 on new failures).
  • Run a subset: memtru test -s cross_user_isolation -s cross_tenant_isolation.

Other CI systems

The same three commands work anywhere:

pip install memtru
memtru test --config memtru.yaml
# optional
MEMTRU_TOKEN=... memtru upload --yes   # MEMTRU_URL defaults to https://memtru.com