Support CenterUse CasesCI/CD Pipeline Integration
Back to Use Cases

CI/CD Pipeline Integration

Validate your AI agent as part of your deployment pipeline.

The Challenge

You're deploying changes to your agent. How do you know:

  • The new version actually works?
  • It works from all regions?
  • Performance didn't regress?

The Solution

Integrate Agent Status checks into your CI/CD pipeline. Fail deployments that break your agent.

GitHub Actions

name: Deploy and Validate

on:
  push:
    branches: [main]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Deploy Agent
        run: ./deploy.sh

      - name: Wait for deployment
        run: sleep 30  # Wait for rollout

      - name: Validate with Agent Status
        env:
          AGENTSTATUS_API_KEY: ${{ secrets.AGENTSTATUS_API_KEY }}
          AGENT_ID: ${{ secrets.AGENTSTATUS_AGENT_ID }}
        run: |
          # Trigger validation
          RESPONSE=$(curl -s -X POST \
            "https://api.agentstatus.dev/api/v1/agents/$AGENT_ID/run" \
            -H "Authorization: Bearer $AGENTSTATUS_API_KEY")

          DECISION_ID=$(echo $RESPONSE | jq -r '.decision_id')
          echo "Decision ID: $DECISION_ID"

          # Poll for results
          for i in {1..30}; do
            sleep 5
            RESULT=$(curl -s \
              "https://api.agentstatus.dev/api/v1/runs/$DECISION_ID" \
              -H "Authorization: Bearer $AGENTSTATUS_API_KEY")

            STATUS=$(echo $RESULT | jq -r '.status // "pending"')

            if [ "$STATUS" = "completed" ]; then
              VERDICT=$(echo $RESULT | jq -r '.overall_verdict')
              echo "Verdict: $VERDICT"

              if [ "$VERDICT" = "DOWN" ]; then
                echo "❌ Agent validation FAILED"
                exit 1
              elif [ "$VERDICT" = "DEGRADED" ]; then
                echo "⚠️ Agent is DEGRADED - review required"
                # Optional: fail on degraded
                # exit 1
              else
                echo "✅ Agent validation PASSED"
                exit 0
              fi
            fi
          done

          echo "⏱️ Validation timed out"
          exit 1

GitLab CI

stages:
  - deploy
  - validate

deploy:
  stage: deploy
  script:
    - ./deploy.sh

validate_agent:
  stage: validate
  script:
    - |
      RESPONSE=$(curl -s -X POST \
        "https://api.agentstatus.dev/api/v1/agents/$AGENTSTATUS_AGENT_ID/run" \
        -H "Authorization: Bearer $AGENTSTATUS_API_KEY")

      DECISION_ID=$(echo $RESPONSE | jq -r '.decision_id')

      # Poll and check (similar to GitHub Actions)
      for i in $(seq 1 30); do
        sleep 5
        RESULT=$(curl -s \
          "https://api.agentstatus.dev/api/v1/runs/$DECISION_ID" \
          -H "Authorization: Bearer $AGENTSTATUS_API_KEY")

        if echo $RESULT | jq -e '.status == "completed"' > /dev/null; then
          VERDICT=$(echo $RESULT | jq -r '.overall_verdict')

          if [ "$VERDICT" = "DOWN" ]; then
            echo "Validation failed: $VERDICT"
            exit 1
          fi

          echo "Validation passed: $VERDICT"
          exit 0
        fi
      done

      echo "Timeout"
      exit 1
  only:
    - main

Jenkins Pipeline

pipeline {
    agent any

    environment {
        AGENTSTATUS_API_KEY = credentials('agentstatus-api-key')
        AGENT_ID = 'your-agent-id'
    }

    stages {
        stage('Deploy') {
            steps {
                sh './deploy.sh'
            }
        }

        stage('Validate') {
            steps {
                script {
                    def response = sh(
                        script: """
                            curl -s -X POST \
                            "https://api.agentstatus.dev/api/v1/agents/\${AGENT_ID}/run" \
                            -H "Authorization: Bearer \${AGENTSTATUS_API_KEY}"
                        """,
                        returnStdout: true
                    )

                    def decisionId = readJSON(text: response).decision_id

                    def verdict = ''
                    for (int i = 0; i < 30; i++) {
                        sleep(5)

                        def result = sh(
                            script: """
                                curl -s \
                                "https://api.agentstatus.dev/api/v1/runs/\${decisionId}" \
                                -H "Authorization: Bearer \${AGENTSTATUS_API_KEY}"
                            """,
                            returnStdout: true
                        )

                        def json = readJSON(text: result)
                        if (json.status == 'completed') {
                            verdict = json.overall_verdict
                            break
                        }
                    }

                    if (verdict == 'DOWN') {
                        error("Agent validation failed: \${verdict}")
                    }

                    echo "Agent validation passed: \${verdict}"
                }
            }
        }
    }

    post {
        failure {
            sh './rollback.sh'
        }
    }
}

Validation Strategy

On Every Deploy

Quick validation after each deployment:

  • Single region (fastest)
  • 3-5 nodes
  • Fail fast on DOWN

Nightly Full Validation

Comprehensive validation on schedule:

  • All regions
  • Maximum nodes
  • Full latency analysis
  • Report generation

Pre-Release Gate

Before promoting to production:

  • Staging agent validation
  • Comparison with production baseline
  • Manual approval on DEGRADED

Rollback on Failure

- name: Rollback on failure
  if: failure()
  run: |
    echo "Validation failed, rolling back..."
    ./rollback.sh

    curl -X POST $SLACK_WEBHOOK \
      -d '{"text": "⚠️ Deployment rolled back due to Agent Status validation failure"}'

Best Practices

  • Don't skip validation — Even "small" changes can break agents
  • Set appropriate timeouts — Allow enough time for validations
  • Use staging first — Validate staging before production
  • Store results — Log validation results for debugging
  • Alert on skip — Know when validation was bypassed
  • Need more help?

    Our support team is available to assist you

    Contact Support