Notícias
Notícias
5 min de leitura
9 de setembro de 2026

Agente IA sem CI/CD (deploy quebrado pra produção, customer vê)

Agente IA ruim foi pra produção (customers reclamam). CI/CD quality gate = bloqueia PRs ruins. Como testar agente automaticamente?

Equipe OpenClaw

Equipe OpenClaw · Time de Engenharia & Produto

A Equipe OpenClaw é formada por engenheiros, designers e especialistas em IA dedicados a construir a melhor plataforma de agentes conversacionais para negócios brasileiros. Combinamos expertise…


Agente IA sem CI/CD (deploy quebrado pra produção, customer vê)

Você é founder/CTO de SaaS.

Seu SaaS: agente IA em produção (WhatsApp, suporte, vendas).

Seu deployment processo (muito comum):

  • Your flow: Engineer edits agente prompt → tests locally → pushes to main → goes live to production

  • Problem: No quality gate (nothing stops bad code)

    • Engineer: "I think this new prompt is better"
    • Testing: Local test only (1-2 examples, not representative)
    • Deployment: Merged automatically (no blocking)
    • Result: Bad agente deployed → customers see broken responses
    • Discovery: 2 hours later (customer complaint, support ticket)
    • Damage: Customers angry, negative feedback, potential churn
  • Your nightmare scenario:

    • Engineer changes prompt to be more "personality" (funny jokes)
    • Local test: Works great (seems funny)
    • Production: Agente now makes inappropriate jokes (customers offended)
    • Customer feedback: "Your bot is offensive, we're switching"
    • Your realization: "I shipped a bad agente and didn't know"

Your core problem:

  • Agente quality is subjective (hard to test automatically)
  • No quality gate (can't block bad PRs)
  • No automated testing (rely on manual testing)
  • No metrics (don't know if agente got better or worse)
  • Result: Bad agentes slip into production (undetected until customer complains)

Breaking signal (Amazon Bedrock + GitHub Actions):

  • AWS showed how to automate agente evaluation
  • Build CI/CD quality gate (test agente automatically)
  • Block PRs when quality drops (prevent bad deployments)
  • Lesson: "Agente should be tested like code (automated, metrics, gates)"

The agente deployment crisis (why manual testing fails)

Your current process (no quality gate)

Typical flow:

┌─────────────────────────────────────┐ │ Engineer edits agente prompt │ └──────────────┬──────────────────────┘ │ ▼ ┌─────────────────────────────────────┐ │ Local testing (5-10 examples) │ ◄─── Manual, not representative └──────────────┬──────────────────────┘ │ ▼ ┌─────────────────────────────────────┐ │ Push to GitHub (create PR) │ └──────────────┬──────────────────────┘ │ ▼ ┌─────────────────────────────────────┐ │ PR review (code review only) │ ◄─── Check logic, not quality └──────────────┬──────────────────────┘ │ ▼ ┌─────────────────────────────────────┐ │ Merge to main (automatic) │ ◄─── No blocking, always merged └──────────────┬──────────────────────┘ │ ▼ ┌─────────────────────────────────────┐ │ Deploy to production (automatic) │ ◄─── Zero friction, any code └──────────────┬──────────────────────┘ │ ▼ ┌─────────────────────────────────────┐ │ Customers see new agente (live) │ ◄─── Too late to rollback └──────────────┬──────────────────────┘ │ ▼ Customer complains (quality is bad)

Problems with this flow:

  1. Manual testing is incomplete

    • You test 5-10 examples (representative of 0.1% of real queries)
    • Real customers ask 10,000+ different variations
    • Edge cases slip through (untested)
    • Result: Quality issues discovered in production
  2. No metrics (can't measure quality)

    • "Is new prompt better or worse than old one?"
    • Unknown (no way to measure)
    • Result: Guessing (maybe it's better? maybe worse?)
    • Consequence: Deploy bad prompt without knowing
  3. No blocking (bad code always deploys)

    • PR review focuses on code logic (not agente quality)
    • No one checks: "Did quality drop?"
    • Result: Bad agente ships automatically
    • Consequence: Customers see broken responses
  4. Late discovery (customer finds bugs)

    • Agente deployed to production
    • Customers using it (seeing bad responses)
    • 2-4 hours later: Customer complains
    • You notice: "Oh no, we broke it"
    • Too late: Damage already done (reputation hit)

Real example (what goes wrong)

Scenario: E-commerce support agente (WhatsApp)

┌─ Engineer change ─┐ │ Old prompt: │ │ "You are a help │ │ ful support bot. │ │ Answer customer │ │ questions about │ │ products." │ └───────────────────┘

     │
     ▼ (engineer thinks: add personality)

┌─ New prompt ─────┐ │ "You are a funny │ │ support bot who │ │ makes jokes. Be │ │ sarcastic and │ │ witty. Answer │ │ customer qs." │ └───────────────────┘

     │
     ▼ (local test: "haha, funny!")

┌─ PR merged ───────────────────────────┐ │ No quality gate (auto-merged) │ └───────────────────┬───────────────────┘ │ ▼ (deployed to production)

    Customer interaction:
    ┌────────────────────────────────┐
    │ Customer: "Hi, my order #123    │
    │ is missing. Can you help?"     │
    └────────────┬───────────────────┘
                 │
                 ▼
    ┌────────────────────────────────┐
    │ Agente (sarcastic mode):       │
    │ "Oh no, another lost package?  │
    │  How ORIGINAL. Let me guess,  │
    │  it fell off a truck somewhere │
    │  in the Amazon rainforest.     │
    │  *dramatic sigh* Here's your   │
    │  tracking number: lol"         │
    └────────────┬───────────────────┘
                 │
                 ▼
    Customer reaction: 😡
    "This bot is rude! I'm unsubscribing!"

    Your discovery: 2 hours later (support ticket)
    Your response: "Oh crap, new prompt broke agente"
    Your action: Revert prompt (5 minutes)
    Your damage: Customers already left 😞

The solution: CI/CD quality gate for agentes

What is agent CI/CD? (like code CI/CD, but for quality)

Traditional code CI/CD:

Engineer writes code → Automated tests run → If tests pass → Deploy (unit tests, (PR blocks integration if tests fail) tests)

Agent CI/CD (what we need):

Engineer edits agente → Automated quality eval → If quality OK → Deploy prompt (test on 100+ queries, (PR blocks measure accuracy, if quality drops) compare with old)

Key differences:

  • Tests are quality metrics (not just "does it run")
  • Metrics are comparative (is new better than old?)
  • Blocking is automatic (if quality drops > threshold → reject PR)
  • Feedback is fast (1-2 minutes, not 2 hours)

How to implement (Bedrock AgentCore + GitHub Actions)

Architecture:

┌─────────────────────────────────────────────────────────────┐ │ Engineer pushes code (new agente prompt) │ └──────────────┬────────────────────────────────────────────┘ │ ▼ ┌─────────────────────────────────────────────────────────────┐ │ GitHub Actions triggered (automatically) │ └──────────────┬────────────────────────────────────────────┘ │ ▼ ┌─────────────────────────────────────────────────────────────┐ │ Step 1: Setup Bedrock AgentCore (test environment) │ │ └─ Deploy new agente to staging (isolated) │ └──────────────┬────────────────────────────────────────────┘ │ ▼ ┌─────────────────────────────────────────────────────────────┐ │ Step 2: Run quality evaluation (automated tests) │ │ ├─ 100+ test queries (representative of real usage) │ │ ├─ Measure: Accuracy (does it answer correctly?) │ │ ├─ Measure: Relevance (is response on-topic?) │ │ ├─ Measure: Safety (no offensive content?) │ │ ├─ Measure: Latency (response time acceptable?) │ │ └─ Measure: Consistency (same Q → same type of A?) │ └──────────────┬────────────────────────────────────────────┘ │ ▼ ┌─────────────────────────────────────────────────────────────┐ │ Step 3: Compare with baseline (old agente) │ │ ├─ New accuracy: 87% vs Old accuracy: 85% ✅ (improved) │ │ ├─ New latency: 1.2s vs Old latency: 1.0s ❌ (worse) │ │ └─ Decision: Does quality pass threshold? │ └──────────────┬────────────────────────────────────────────┘ │ ▼ ┌──────────────────────────┐ │ Quality gate decision │ └──────────┬───────────────┘ │ ┌──────────┴──────────┐ │ │ ▼ ▼ PASS ✅ FAIL ❌ Quality OK Quality below threshold threshold │ │ ▼ ▼ Approve PR Block PR (can merge) (can't merge) │ │ ▼ ▼ Deploy to Engineer production fixes prompt (retry)

Implementation details (code level)

Step 1: Setup test queries (representative data)

yaml

.github/workflows/agent-quality-gate.yml

name: Agent Quality Gate on: [pull_request] # Runs on every PR

jobs: evaluate-agent: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3

  # Step 1: Load test queries
  - name: Load test queries
    run: |
      cat > test_queries.json << 'EOF'
      [
        {"query": "How do I reset my password?", "expected_topic": "account"},
        {"query": "What's your return policy?", "expected_topic": "policy"},
        {"query": "My order is missing", "expected_topic": "support"},
        {"query": "Tell me a joke", "expected_topic": "out_of_scope"},
        ... (100+ more queries)
      ]
      EOF

Step 2: Run quality evaluation

yaml # Step 2: Deploy agente to staging - name: Deploy to Bedrock staging run: | aws bedrock-agentcore deploy
--agent-id ${{ secrets.AGENT_ID }}
--environment staging
--source ${{ github.head_ref }}

  # Step 3: Evaluate quality
  - name: Run quality evaluation
    run: |
      python evaluate_agent.py \
        --test-queries test_queries.json \
        --baseline-metrics baseline_metrics.json \
        --output evaluation_results.json

Step 3: Compare with baseline (decision logic)

python

evaluate_agent.py

import json import boto3 from bedrock_agentcore import AgentEvaluator

def evaluate_agent(test_queries, baseline_metrics): """ Run evaluation on new agente, compare with baseline """ evaluator = AgentEvaluator(agent_id=os.getenv("AGENT_ID"))

# Run tests on new agente
results = evaluator.evaluate_on_queries(test_queries)

# Extract metrics
new_metrics = {
    "accuracy": results["accuracy"],        # % correct answers
    "relevance": results["relevance"],      # % on-topic responses
    "latency_p50": results["latency_p50"],  # median response time
    "safety_score": results["safety_score"] # % safe responses
}

# Compare with baseline (old agente)
quality_gate_results = {
    "accuracy_delta": new_metrics["accuracy"] - baseline_metrics["accuracy"],
    "relevance_delta": new_metrics["relevance"] - baseline_metrics["relevance"],
    "latency_delta": new_metrics["latency_p50"] - baseline_metrics["latency_p50"],
    "safety_delta": new_metrics["safety_score"] - baseline_metrics["safety_score"]
}

# Decision logic
passed = (
    quality_gate_results["accuracy_delta"] >= -1 and  # Not worse by >1%
    quality_gate_results["relevance_delta"] >= -2 and # Not worse by >2%
    quality_gate_results["latency_delta"] <= 500 and  # Not slower by >500ms
    quality_gate_results["safety_delta"] >= 0         # No worse on safety
)

return {
    "passed": passed,
    "new_metrics": new_metrics,
    "deltas": quality_gate_results
}

Step 4: Block PR if quality drops

yaml # Step 4: Quality gate decision - name: Check quality gate run: | python check_quality_gate.py
--results evaluation_results.json
--threshold-config quality_thresholds.json # If quality drops below threshold, this fails (blocks PR)

  # Step 5: Comment on PR (feedback)
  - name: Post results to PR
    if: always()
    uses: actions/github-script@v6
    with:
      script: |
        const results = require('./evaluation_results.json');
        github.rest.issues.createComment({
          issue_number: context.issue.number,
          owner: context.repo.owner,
          repo: context.repo.repo,
          body: `## Agent Quality Evaluation\n
  • Accuracy: ${results.new_metrics.accuracy}% (${results.deltas.accuracy_delta:+}${results.deltas.accuracy_delta}%)\n- Relevance: ${results.new_metrics.relevance}% (${results.deltas.relevance_delta:+}${results.deltas.relevance_delta}%)\n- Latency: ${results.new_metrics.latency_p50}ms (${results.deltas.latency_delta:+}${results.deltas.latency_delta}ms)\n- Safety: ${results.new_metrics.safety_score}% (${results.deltas.safety_delta:+}${results.deltas.safety_delta}%)\n ${results.passed ? '✅ PASS: Quality gate approved' : '❌ FAIL: Quality gate blocked - Review changes'}\n` });

Benefits of CI/CD quality gate

Benefit 1: Catch bugs before customers see them

Before (no quality gate):

Engineer deploys bad agente → 2 hours later → Customer complains (too late, damage done)

After (with quality gate):

Engineer commits bad agente → Automated tests fail → PR blocked (1 minute, before deployment) → Engineer fixes → Resubmit → Tests pass → Deploy

Impact: Zero customer-facing bugs (prevent entirely)

Benefit 2: Faster deployment (confidence)

Before (no quality gate):

  • Engineer hesitant to deploy ("Is it better or worse?")
  • Manual testing takes time (1-2 hours)
  • Afraid to deploy (risk of breaking agente)
  • Result: Slow iteration (1 deploy per day, if lucky)

After (with quality gate):

  • Automated tests give instant confidence (1-2 minutes)
  • Engineer knows exactly if quality improved/declined
  • Safe to deploy (quality gate already checked)
  • Result: Fast iteration (10+ deploys per day)

Benefit 3: Data-driven decisions

Before (no quality gate):

  • "Is this change better?" → "I dunno, seems good?"
  • Decisions based on gut feeling (not data)
  • Result: Inconsistent quality

After (with quality gate):

  • "Is this change better?" → "Accuracy 87% → 89%, relevance 92% → 94%"
  • Decisions based on metrics (objective)
  • Result: Consistent improvement

Benefit 4: Prevent regression (never go backwards)

Before (no quality gate):

  • Old agente was good (90% accuracy)
  • New engineer changes prompt ("optimize for speed")
  • New agente is faster but worse (85% accuracy)
  • Deployed without noticing (quality regressed)
  • Result: Silent degradation

After (with quality gate):

  • Old agente: 90% accuracy (baseline)
  • New engineer changes prompt ("optimize for speed")
  • New agente: 85% accuracy
  • Quality gate: "Accuracy dropped 5% → BLOCKED"
  • Result: Can't regress (gate prevents it)

Implementation roadmap

Week 1: Setup

☐ Define test queries (representative of real usage) ├─ Export last 1,000 customer queries from production ├─ Filter to top 100 queries (most common) ├─ Add edge cases (uncommon but important) ├─ Add safety test queries (offensive, out-of-scope) └─ Total: 150-200 test queries

☐ Define quality metrics ├─ Accuracy: Does agente answer correctly? (manual grade 0-1) ├─ Relevance: Is response on-topic? (auto-check with keyword match) ├─ Latency: Is response fast? (median response time < 2 sec) ├─ Safety: Is response safe? (auto-filter for offensive words) └─ Consistency: Same Q → similar A? (embedding similarity)

☐ Establish baseline (current agente metrics) ├─ Run evaluation on current production agente ├─ Record: Accuracy, relevance, latency, safety ├─ This becomes your threshold (new code must match or improve) └─ Result: baseline_metrics.json

☐ Setup GitHub Actions workflow ├─ Create .github/workflows/agent-quality-gate.yml ├─ Triggers on every PR (before merge) ├─ Runs: Deploy → Evaluate → Compare → Decide └─ Time: 1-2 minutes per PR

Week 2-3: Implementation

☐ Implement evaluation script (evaluate_agent.py) ├─ Connect to Bedrock AgentCore (staging environment) ├─ Run test queries on agente ├─ Measure metrics (accuracy, latency, safety) ├─ Compare with baseline └─ Determine: Pass or Fail?

☐ Implement quality gate decision logic ├─ Define thresholds (how much worse is "too bad"?) ├─ Example: │ ├─ Accuracy: -1% max (can't be 1% worse) │ ├─ Relevance: -2% max │ ├─ Latency: +500ms max (can't be 500ms slower) │ ├─ Safety: 0% (can't degrade on safety) │ └─ All must pass (AND logic, not OR) └─ Result: Pass/Fail decision

☐ Setup GitHub Actions feedback ├─ Post results comment on every PR ├─ Show: Old metrics → New metrics → Delta → Decision ├─ If PASS: "✅ Quality gate approved, ready to merge" ├─ If FAIL: "❌ Quality gate blocked - accuracy dropped 3%" └─ Block merge if FAIL (GitHub branch protection)

☐ Test with real PRs ├─ Submit test PR (improve accuracy) ├─ Watch GitHub Actions run ├─ Verify: Tests run, metrics calculated, results posted ├─ If accuracy improved → Should show ✅ PASS └─ If passed test, enable enforcement (block bad PRs)

Week 4+: Optimization

☐ Tune quality thresholds ├─ First 2 weeks: Permissive (only block severe regressions) ├─ Monitor: False negatives (bad code that passed) ├─ Monitor: False positives (good code that blocked) ├─ Adjust thresholds based on observed patterns └─ Goal: Catch all real problems, block minimal good code

☐ Expand test coverage ├─ Add more test queries (grow from 150 to 500+) ├─ Add more metrics (toxicity, bias, consistency) ├─ Add A/B test capability (compare variant agentes) └─ Goal: Comprehensive quality coverage

☐ Integrate with team workflow ├─ Document: "How to read quality gate results" ├─ Training: Show engineers how quality gate works ├─ Feedback: Collect engineer suggestions (improve gate) ├─ Iteration: Improve gate based on feedback └─ Goal: Team adopts quality gate as normal process

☐ Monitor & maintain ├─ Weekly: Review quality trends (are agentes improving?) ├─ Monthly: Update baseline (quality should improve over time) ├─ Quarterly: Add new test queries (evolve with product) ├─ Quarterly: Revisit thresholds (still relevant?) └─ Goal: Quality gate stays effective as product evolves


Conclusion: Deploy with confidence (never ship broken agente)

The problem (without quality gate):

  • Agente quality is subjective (hard to measure)
  • No automated testing (rely on manual, incomplete testing)
  • No blocking (bad code always deploys)
  • Late discovery (customers find bugs first)
  • Result: Broken agentes slip into production (unnoticed until customer pain)

The solution (with quality gate):

  • Agente quality is measurable (metrics, thresholds)
  • Automated testing (100+ test queries, instant results)
  • Blocking enabled (bad code can't deploy)
  • Early discovery (tests catch bugs before production)
  • Result: Only good agentes deploy (zero customer-facing bugs)

Implementation path:

  • Week 1: Setup test queries + metrics + baseline
  • Week 2-3: Implement GitHub Actions + quality gate logic
  • Week 4+: Tune, expand, integrate with team
  • Result: 4-6 weeks to complete quality gate (ongoing benefit)

ROI:

  • Time to implement: 80-120 hours (engineering effort)
  • Time saved per incident: 2-4 hours (detect before customers)
  • Cost saved per incident: R$ 5K-20K (churn, support, reputation)
  • Incidents prevented per year: 5-20 (estimated)
  • Annual ROI: R$ 25K-400K (break-even in weeks)

At OpenClaw, we help SaaS teams implement agent CI/CD quality gates:

  • AUDIT: Current agente deployment process (baseline)
  • DESIGN: Quality metrics + thresholds (what matters?)
  • IMPLEMENT: GitHub Actions workflow + Bedrock integration
  • TEST: Validate quality gate catches real regressions
  • INTEGRATE: Team training + process adoption
  • MONITOR: Ongoing quality improvements + maintenance

Result: No more broken agentes in production. Deploy with confidence. Customers happy. Zero surprises.

Seu agente IA foi pra produção QUEBRADO (customers reclamaram)?

Você quer automated quality gate (bloqueia PRs ruins antes de deploy)?

Você quer deploy rápido + seguro (GitHub Actions + Bedrock CI/CD)?

Você quer métricas pra cada mudança (dados, não guess)?

Você quer nunca mais ship broken agente (quality gate ensures it)?

Se quer expert setup (audit processo, design metrics, implement GitHub Actions, test quality gate, integrar time, manter operacional):

Implementar Agent CI/CD Quality Gate AGORA (GitHub Actions + Bedrock, bloqueia PRs ruins, zero broken agentes em produção, deploy com confiança) →


Publicado em 9 de setembro de 2026

Leia também