Schedule icon
WorkingDirectory icon
Script icon
Process icon
If icon
Loop icon
StructuredOutputCompletion icon
Parallel icon
Create icon
SlackIncomingWebhook icon

Red-Team Your AI Agent with an Adversarial Probe Harness

Scheduled red-team harness for AI agents: adversarial probes, resistance scoring, Gemini-judged failures, GitHub issues, and Slack alerts.

Categories
AI

Guardrails rot. A system-prompt tweak, a model upgrade, or a new tool can silently reopen an injection hole that was closed months ago, and the team finds out from an attacker. This blueprint red-teams your own agent on a schedule: a curated battery of adversarial prompts across four attack families is fired at the agent endpoint, every response is scored for resistance, and the run produces a per-family scorecard. Scores below threshold are confirmed by Gemini and escalated to a GitHub issue plus a Slack alert. Passing runs are recorded, giving security a resistance trend over time.

How it works

  1. weekly_red_team (io.kestra.plugin.core.trigger.Schedule) runs the battery every Monday 07:00 UTC. For an on-demand run, for example right after a system-prompt change, execute the flow from the UI or the API.
  2. build_probe_battery (io.kestra.plugin.scripts.python.Script) writes the 12-probe battery to probes.jsonl: instruction overrides, prompt-extraction probes, jailbreaks, and sensitive-disclosure elicitation.
  3. fire_probes (io.kestra.plugin.core.flow.Loop, concurrencyLimit: 2) POSTs each probe to the agent endpoint and captures the replies.
  4. score_responses (Python) scores every reply with the resistance rubric and computes per-family and overall scores against min_score.
  5. triage (io.kestra.plugin.core.flow.If) branches on the score: a passing run goes straight to record_passing_run.
  6. judge_failures (io.kestra.plugin.core.flow.Loop, concurrencyLimit: 3) sends each weak family to judge_failure (io.kestra.plugin.gemini.StructuredOutputCompletion) for a regression/noise verdict, so scoring false alarms never open issues.
  7. escalate (io.kestra.plugin.core.flow.Parallel) opens the tracking issue and pages Slack at the same time.

What you get

  • A scheduled adversarial test your agent actually faces, not a one-off notebook nobody re-runs.
  • Per-family resistance scores that show exactly which guardrail regressed.
  • LLM-confirmed regressions only: scoring noise is filtered before it reaches humans.
  • A resistance trend over time from the recorded passing runs, useful for audits.

Who it's for

  • AI security engineers and platform teams shipping agents to production.
  • Trust & safety teams who need evidence of ongoing adversarial testing.
  • Teams whose "red-teaming" is currently a spreadsheet from six months ago.

Why orchestrate this with Kestra

A script can fire prompts, but it can't schedule the battery, throttle the load on the agent, judge the failures, and keep the audit trail in one place. Kestra's schedule trigger makes the cadence declarative, the Loop with concurrencyLimit protects the agent endpoint, Parallel keeps ticketing and alerting independent, and every execution is a timestamped record of the agent's resistance. Retries and secret masking come free.

Prerequisites

  • An HTTP-reachable agent endpoint that accepts POST {"prompt": ""} and returns the reply as JSON.
  • A Google Gemini API key for the failure-judging step.
  • A GitHub token with issue-write scope on the tracking repository.
  • A Slack incoming webhook URL for the security channel.

Secrets

  • GEMINI_API_KEY: API key for the per-family regression/noise judgments (required).
  • GITHUB_TOKEN: token used to open the tracking issue (required).
  • SLACK_WEBHOOK_URL: incoming webhook for the security-channel alert (required).

Quick start

  1. Add the three secrets above to your Kestra namespace.
  2. Import this blueprint, set agent_endpoint and response_json_path, and run it manually. Without an endpoint the built-in fixture demonstrates the scoring.
  3. Tune min_score, then leave the weekly schedule enabled for continuous coverage.

How to extend

  • Grow the battery with your own incident history and multilingual probes.
  • Write the scorecard to a warehouse table for a resistance dashboard.
  • Gate releases: fail the deployment pipeline when the score drops below threshold.
  • Add tool-result injection probes for agents with tool access.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.