Schedule icon
Script icon
Docker icon
If icon
SlackIncomingWebhook icon
Fail icon
Log icon

Watch AI Agent Configuration Changes in Git History

Daily watchdog over real GitHub commits that flags unapproved agent prompt, tool and MCP changes, records evidence, and alerts Security.

Categories
AI

An AI agent is defined by files a developer can edit in a normal commit: its system prompt, its tool allowlist, its MCP server configuration. When one of those files changes without review, the agent that runs tomorrow is not the agent that was approved yesterday. This flow watches that exact surface, using the live commit history of a real repository instead of sample data, and turns every unapproved change into a named, scored finding.

How it works

  1. daily_config_watch (io.kestra.plugin.core.trigger.Schedule, cron 0 6 * * *) runs the watchdog once a day. It ships disabled: enable it only after pointing the repository input at a real repository, setting a GitHub token, and setting approved_authors, then verifying a manual run.
  2. scan_repo_history (io.kestra.plugin.scripts.python.Script on python:3.12-slim, standard library only) lists commits on the configured branch since the lookback window through the GitHub commits API, then reads each commit detail to get the real changed files. The scan requires a GitHub token and fails closed without one instead of reading unauthenticated. A file counts only when its path starts with one of the watched_path_prefixes inputs, and each watched file is classified: tool surface (MCP, allowlist, allowed tools) at risk 90, prompt (prompt, instructions) at risk 70, other agent configuration at risk 50, other watched paths at risk 30.
  3. A commit is flagged when it touches a watched file and its author is not in approved_authors. Approval matches on the GitHub login only: a commit author name can be set to anything, so a name never approves a change. The verdict fails closed: BLOCKED when flagged changes exist and fail_on_unapproved is true, or when commits cannot be read and fail_on_inconclusive is true; REVIEW when findings exist but the matching fail-closed input is off; PASS only when nothing is flagged and everything was readable.
  4. alert_on_flagged (io.kestra.plugin.core.flow.If) posts the verdict, the commit count, the flagged count and the full per-commit evidence record to Slack whenever the watchdog does not pass, and logs the clean result otherwise. When the verdict is BLOCKED, the nested fail_when_blocked step fails the execution itself (io.kestra.plugin.core.execution.Fail), so an unapproved agent change is never signed off by a green run. The flow level errors handler reports a watchdog failure itself, because a watchdog that dies silently looks exactly like a clean repository.
  5. Flow outputs verdict and flagged_count let a downstream release or deployment gate branch on the result: promotion requires verdict PASS and flagged count zero.

What you get

  • Proof instead of trust: one evidence record per run showing the real commits, authors, files, classes and risk scores behind the verdict, not a summary that says the agent is fine.
  • A fail-closed default: unreadable repositories and unreadable commits block the run rather than passing quietly, unless an operator deliberately relaxes the matching input.
  • A named alert: Security learns exactly which commits, authors and files are flagged, instead of a generic agent drift warning.
  • A daily cadence: the same watchdog re-runs every morning, so a change merged late in the day is caught the next morning at the latest.

Who it's for

  • AI platform and security teams who own agent prompts, tool allowlists and MCP server configuration and need a review trail for every change.
  • Engineering teams shipping agents from a Git repository who want prompt and tool changes gated like production code changes.
  • Compliance teams who need a timestamped evidence record per repository, per run, for agent change control.

Why orchestrate this with Kestra

A script on one laptop has no schedule, no evidence trail and no alert when it fails, and a manual git log review depends on someone remembering to run it. Kestra gives the watchdog a daily schedule, one version controlled file holding the watched paths and the approved author list, a conditional branch that separates the alert from the all clear, and an execution history that proves the scan actually ran for each repository and each day.

Prerequisites

  • A Kestra worker with Docker access, the scan runs in python:3.12-slim with only the standard library.
  • A GitHub token with read access to the watched repository. The token is required for every scan: without it the scan fails closed instead of reading the repository unauthenticated.
  • A Slack incoming webhook for flagged change alerts and for watchdog failure alerts.

Secrets

  • GITHUB_TOKEN: token used to read commits and commit details from the GitHub API. Required: the scan refuses to run without it.
  • SLACK_WEBHOOK_URL: Slack incoming webhook URL for flagged change alerts and for watchdog failure alerts.

Quick start

  1. Add the secrets above to your Kestra namespace.
  2. Point repository, branch and watched_path_prefixes at your own agent repository (the shipped default is a placeholder, not a real repository), and set approved_authors to the GitHub logins allowed to change agent configuration.
  3. Run the flow once manually and confirm it reports the real commits of the last day, with verdict PASS when no watched file changed, and that a test commit by an unapproved author is flagged with the right class and risk.
  4. Only then enable the daily schedule, so the watchdog keeps running, and wire a downstream deployment gate to the verdict and flagged_count outputs.

How to extend

  • Add a watched path prefix for a new agent configuration location by adding one entry to watched_path_prefixes, keeping the same classification contract so the risk scores do not change meaning.
  • Add a check by adding one classification rule and one row in the evidence list, for example a rule that scores credential files or workflow files that invoke the agent.
  • Point the alert at PagerDuty instead of Slack on the critical path by swapping the webhook task for a PagerDuty notification.
  • Write the evidence record to S3 or a KV namespace by adding a storage task after scan_repo_history, using the evidence output as the record body.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.