> ## Documentation Index
> Fetch the complete documentation index at: https://docs.flintai.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# CI/CD integration

> Integrate flintai-cli into your continuous integration pipeline

Save scan and eval results as build artifacts to prove validation before deployment.

<Tip>
  **API keys required.** Add your LLM provider API key (Gemini, OpenAI, or Anthropic) to your CI system's secrets/environment variables. Never commit API keys to your repository.
</Tip>

<Tabs>
  <Tab title="GitHub Actions">
    Add `flintai-cli` to your GitHub Actions workflow:

    ```yaml theme={null}
    name: Agent validation

    on: [pull_request]

    jobs:
      scan:
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v6
          
          - name: Set up Python
            uses: actions/setup-python@v6
            with:
              python-version: '3.13'
          
          - name: Install flintai-cli
            run: pip install flintai-cli
          
          - name: Scan agent code
            env:
              GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
            run: flintai scan ./agent --output scan-results.json
          
          - name: Upload scan results
            uses: actions/upload-artifact@v7
            with:
              name: flintai-scan-results
              path: scan-results.json
    ```

    **Attach the artifact to your PR** as proof you validated before merge.

    [GitHub Actions documentation →](https://docs.github.com/en/actions)
  </Tab>

  <Tab title="GitLab CI">
    Add `flintai-cli` to your `.gitlab-ci.yml`:

    ```yaml theme={null}
    stages:
      - validate

    scan-agent:
      stage: validate
      image: python:3.13
      script:
        - pip install flintai-cli
        - flintai scan ./agent --output scan-results.json
      artifacts:
        paths:
          - scan-results.json
        expire_in: 30 days
      variables:
        GEMINI_API_KEY: $GEMINI_API_KEY
    ```

    **The artifact is automatically attached to your merge request.**

    [GitLab CI documentation →](https://docs.gitlab.com/ee/ci/)
  </Tab>

  <Tab title="CircleCI">
    Add `flintai-cli` to your `.circleci/config.yml`:

    ```yaml theme={null}
    version: 2.1

    jobs:
      scan:
        docker:
          - image: cimg/python:3.13
        steps:
          - checkout
          
          - run:
              name: Install flintai-cli
              command: pip install flintai-cli
          
          - run:
              name: Scan agent code
              command: flintai scan ./agent --output scan-results.json
              environment:
                GEMINI_API_KEY: ${GEMINI_API_KEY}
          
          - store_artifacts:
              path: scan-results.json
              destination: flintai-scan-results

    workflows:
      validate:
        jobs:
          - scan
    ```

    **Access artifacts from the job's Artifacts tab.**

    [CircleCI documentation →](https://circleci.com/docs/)
  </Tab>
</Tabs>

## Exit codes

Flint AI Scan returns standard exit codes for CI/CD integration:

| Code | Meaning                                           |
| ---- | ------------------------------------------------- |
| `0`  | Scan completed successfully                       |
| `1`  | Scan failed (invalid path, no Python files, etc.) |

<Note>
  Exit code `0` means the scan ran successfully, **not** that no issues were found. Check the JSON results to see findings.
</Note>

## Other CI systems

The core pattern works anywhere:

1. Install Python 3.13+
2. Install `flintai-cli` with pip
3. Set your LLM API key as an environment variable
4. Run `flintai scan /path/to/agent --output results.json`
5. Save `results.json` as a build artifact
