Showcase site · Recorded runs from a staged demoWatch recorded runs ↗Built byPravin Gadekar ↗

DesignWhat the AI can't change

02 of 05 · 2 min read

Why can't the AI change the store or the code by itself?

The service that talks to models has no GitHub write or shop-mitigation credentials. A separate service, action-runner, makes every change, and only for a plan a person approved. One more service to run, and the API still writes approvals.

ILLUSTRATIVE SEQUENCE01 / 05
Why can't the AI change the store or the code by itself?
triage-api · talks to models · no GitHub write or mitigation credentialswrite credentialsa person approvesa flagged line cannot support an actionread toolslogs · code · changesredactionsecrets removedinjection screenflagged → taintagentsdiagnosis · planbudgetreserved per callvalidationcatalog · citationsapproval gatedigest · 15-min expirywaiting for a personapprovedaction-runnerre-checks approvalGitHubstorefront-apiLimit: triage-api writes approvals, so if it were compromised it could forge one (ADR 0011).
triage-api · no GitHub or shop write keysread toolslogs · codebudgetper callredactionsecrets outinjection screen→ taintagentsdiagnosis · planvalidationcatalog · citationsapproval gatedigest · 15-min expirywaiting for a personapprovedwrite credentialsaction-runnerre-checks approvalGitHubstorefront-apiLimit: triage-api writes approvals;if compromised, it could forge one(ADR 0011).
triage-api · READ TOOLS

Agents read the evidence.

How this step works

Specialist agents call read-only tools. The service that runs them holds no GitHub write or storefront-mitigation credentials.

READ ONLY

Cloud Logging, GitHub (read), Cloud Run revisions

The knowledge index in AlloyDB

CODE · REDACTION AND SCREENING

Clean the evidence first.

How this step works

Code redacts secrets from tool output before it is stored or sent to a model, and screens it for prompt injection. A tainted line can never support an action.

BEFORE A MODEL SEES IT

Secrets are redacted before storage and before any model sees them

Text that looks like instructions marks a line tainted

AGENTS · BUDGET · VALIDATION

Propose within budget, then validate.

How this step works

Every model attempt, retries and fallbacks included, reserves budget before it is sent. validate_proposal checks the plan against the action catalog, the patch and the citations.

BEFORE A PERSON SEES IT

Every model attempt reserves budget first

validate_proposal checks the action catalog, patch and citations

APPROVAL GATE · A PERSON

A person approves the exact plan.

How this step works

An approver signs off on the exact plan. The decision is tied to the proposal's digest, a fingerprint of its content. Any change to the plan voids the approval. It expires after 15 minutes.

THE DECISION

Bound to the proposal's digest

Expires after 15 minutes

action-runner

A separate service makes the change.

How this step works

action-runner re-checks the approval before each action, then applies the mitigation and opens the pull request. It holds the write credentials and calls no model. Its limit: triage-api writes approvals, so a compromised triage-api could forge one (ADR 0011).

THE ONLY WRITER

Re-checks the approval before each action

Holds the GitHub and storefront write credentials

Calls no model

Steps appear in order. Evidence, review and outcomes remain visible.

Evidence / agent workWaiting for a personFailingRecovered

THE TRADEOFF

What we gained

A prompt injection or a wrong answer cannot change the store or the code without an approval. Every write needs an approval bound to the exact plan.

What it costs

One more service to run. triage-api writes the approvals, so if it were compromised it could forge one (ADR 0011).

The alternative: give the agents write tools directly. Fewer moving parts, but the process that talks to models would hold the keys.

ONE RESULT

Only action-runner holds the GitHub and storefront write credentials; the API that talks to models has none of them.

limitSecret access is set in Terraform; no staging test probes it. The API still writes its own database, including approval rows, so a compromised API could forge one; it holds no write credential for GitHub or the shop.

WHAT THIS DOES NOT CLAIM

  • That the audit log cannot be altered; the application can only add entries, but the log is not tamper-proof.
  • That screening catches every injection; a flagged line simply cannot justify an action.

All of this page's claims in the ledger →

MORE DETAIL

Sign-in and roles

SIGN-IN AND ROLES

Who can do what?

People sign in with Google through Firebase Auth. triage-api verifies the ID token on every request. Roles live in the database. The UI hides controls by role, and the API enforces them.

viewer

The role with the fewest permissions. Can view runs, but cannot start them, make approval decisions or administer the system.

operator

Can start runs and trigger faults.

In the app, the fault switch is on the admin Rehearsal page; operators switch faults from the command line.

approver

Can approve action plans. Can also verify, deprecate, re-verify or clear taint on knowledge.

admin

Everything above, plus user management and the environment reset.

User management is built. The environment reset is on the admin Rehearsal page and is also a command-line target.

Only Google sign-ins with a verified email are accepted. Email-link sign-in for guests without Google accounts is deferred.

Approvals bound to one proposal

APPROVALS

How is approval tied to the exact proposal?

Approval applies only to the exact proposal reviewed. If the proposal changes, the approval no longer applies. How the gate sits in the graph is on the Agent workflow page.

Built

At the gate

  • A decision is tied to a digest, a fingerprint of the exact proposal: the action kind, the evidence IDs, the mitigation, the patch and the base commit.
  • It is accepted only while the run is paused and the digest matches. Otherwise the endpoint returns 409 and records nothing. A second decision also gets 409, and the gate does not run again.
  • The server identifies the reviewer from the verified sign-in token. The client never supplies the reviewer's identity.

Built

Before each live action

  • One approval covers the whole action plan: the mitigation and the pull request.
  • The approval also records the base commit, and it expires 15 minutes after the decision.
  • Just before each action, code re-checks the digest, the run, the expiry and, with live tools, the deployed commit. action-runner checks the stored approval again. A failed re-check ends the run blocked before that action; an action that already ran stays applied.
The separate write service

THE WRITE SERVICE

Why can't an AI investigator change production?

GitHub and shop writes happen outside the process that talks to models. The AI-facing API holds no write credential for GitHub or the shop.

One service holds the write keys

action-runner holds the GitHub App key and the mitigation client, and makes every write. Cloud Run IAM lets only triage-api and the operator call it, and it checks the caller's email per route.

Separate database roles

Each service has its own database role. triage-api cannot write action-runner's write_operations table, and action-runner can only read approvals and runs.

Read-only model tools

Models get four read-only tools. They propose catalog actions with bounded parameters and find-and-replace edits to allowed files; code checks both before the gate and again before writing.

Pull requests, never merged

The app opens pull requests but never merges them.

The limit: triage-api still writes approval rows, so a compromised triage-api could forge an approval. The boundary is that it holds no write credential, and action-runner checks the stored approval against the exact proposal.

Audit and redaction

AUDIT AND REDACTION

What is recorded, and what is hidden?

Every run leaves a trail. We describe the log as append-only for the application, and we claim nothing stronger.

Audit log

  • A run writes run_started, gate_raised, decision_recorded and run_finished, with the approver's email on the decision.
  • A change to a person's role is audited too.
  • A blocked action and each flagged piece of evidence are audited too.
  • A database trigger refuses UPDATE, DELETE and TRUNCATE on the audit table. The trigger, not a grant, enforces this: the API's database role holds DELETE on every triage table, the audit table included.

An administrator can still disable the trigger. Successful writes are recorded in action-runner's own table, not as audit rows. Each run's Audit tab shows a span timeline; its staging proof is pending.

Redaction

Fixed text patterns remove secrets and personal data. The API applies them to incident text, operator notes and decision comments before any of it reaches ADK. The run's stored events are redacted too.

Tested

Built

Four secret types were planted for testing. None appeared in stored run data or model requests:

  • an API key
  • an email address
  • a password inside a connection string
  • an AWS key

Not scanned: the budget ledger and ADK's other tables. Only these four types were planted. A provider error containing password=... is also stored redacted; one pattern was tested.

Tool output

Built

Every fetched log line, code file and commit is redacted before it is trimmed and before any model sees it. With that in place, prompt and response content is logged to BigQuery on staging.

Prompt-injection screening of the same tool output is a separate control; see the OWASP table below.

Spend caps

BUDGETS

How is spend capped before a call?

Every model call reserves from the run's budget before it is sent, and that includes retries and fallbacks. If the run cannot afford the call, it is refused and the run ends budget_stopped with no model call.

Spend caps remain in place when a run pauses and resumes. Cloud Billing budgets provide backup alerts only.

Each attempt's cost is estimated from a versioned price table and stored, so a run's spend is measured. On staging, each run's summed cost matched its budget ledger. It is an estimate, not the provider's invoice.

OWASP agentic risks, all ten

OWASP AGENTIC TOP 10

How does it map to the OWASP Agentic Top 10?

How the controls above map to the OWASP Top 10 for Agentic Applications 2026. Addressed means the main routes into this app are covered and tested; anything listed as still open is bounded by another control. Partly means a known route stays open that no control bounds, and the last column says which.

Each OWASP agentic risk, its coverage, the controls and what stays open
RiskCoverageHow Beagle addresses itStill open
ASI01 Agent Goal HijackPartlyTool output and incident text are screened for injection, and flagged items are labelled as data. A proposal that cites flagged evidence as support fails validation. The graph is fixed, and a person approves every action.
Details
  • Every tool result (log lines, code, commit messages) is screened just before it is registered as evidence. The incident text and the operator note are screened when a run is admitted.
  • A flagged item reaches every later agent with a label saying it is data, not instructions. Each flag is written to the audit log and shown at the approval gate.
  • The taint check fails a proposal that cites flagged evidence as support for a standing hypothesis, or as the change a revert undoes. The run then ends unresolved instead of reaching the gate.
  • Code nodes do the routing on a fixed graph, so no agent can change where the run goes next.
  • Two golden eval cases test the flow: a planted log line that the model ignores, and one that it cites.
Screening uses five regular expressions (text patterns); paraphrased instructions get past them. Specialists' findings are not screened again.
ASI02 Tool Misuse and ExploitationAddressedModels get four read-only tools with validated arguments. Mitigations are catalog actions with bounded parameters. Every model attempt reserves budget first.
Details
  • The four tools read logs, code, recent changes and the knowledge base. Each specialist gets one; the follow-up agent gets all four. The synthesizer, critics, reviser and postmortem agent get none.
  • Arguments are validated before a tool runs: allowed services and corpora, bounded time ranges, and file paths under app/ or config/ with no parent-directory steps.
  • The follow-up agent's limit of three tool calls is enforced in code, not only in its prompt.
  • Mitigations come from a catalog with bounded parameters and a rollback held in code. action-runner checks them again before it writes.
  • Retries, fallbacks and repairs each reserve budget before they are sent. Tool arguments are redacted before they are stored.
Specialists are told their call limits in prompts. Deadlines and budgets constrain their calls.
ASI03 Identity and Privilege AbusePartlyOnly action-runner holds GitHub and shop write credentials, and each service has its own database role. People sign in and hold roles. Approvals are bound to the exact proposal and re-checked.
Details
  • Only action-runner's service account can read the GitHub App key and its own database credential. triage-api gets a read-only GitHub token.
  • triage-api's database role cannot write action-runner's table and has no access to the shop's data. action-runner can only read approvals and runs. A test connects as each role to check this.
  • Only triage-api and the operator may call action-runner, enforced by Cloud Run IAM and again by a per-route check of the caller's email.
  • Also open: the GitHub App can write to main, though only through an operator-only demo route that no model can reach. A compromised triage-api could forge an approval row (see the write service above).
Agents share triage-api's identity. The person who started a run can also approve it.
ASI04 Agentic Supply Chain VulnerabilitiesPartlyDependencies install from hash-locked lockfiles. No tools or MCP servers are loaded at runtime. The model registry is checked at startup, and knowledge files are admitted one by one.
Details
  • Python dependencies are hash-locked and installed with a frozen sync in CI and in the container build. The ADK version is pinned exactly. The frontend and site install from their lockfiles.
  • There are no MCP toolsets, plugin entry points or exec and eval calls. The tool set is fixed in code.
  • The model registry is checked at startup, including which models may see which class of data.
  • A knowledge file matching a secret pattern is quarantined and never loads. A file matching an injection pattern loads but is marked as tainted (flagged content) and excluded from search.
  • Also open: most dependencies specify version ranges; only the lockfile fixes their exact versions.
No dependency or secret scanning in CI, and no SBOM. Actions and the base image are not pinned by digest.
ASI05 Unexpected Code Execution (RCE)PartlyModels have no code-execution tool in Beagle. They propose bounded find-and-replace edits to allowed files, and changes ship as pull requests that the app never merges.
Details
  • There is no code executor in Beagle, and no shell call a model can reach.
  • Edits touch at most three files and six places. Each search text must match exactly once in the file at the deployed commit.
  • action-runner re-checks the paths and rebuilds the change from the base commit before it writes anything.
  • The storefront repo's own CI runs on the pull request. Beagle shows the result as a badge, and that badge cannot act.
  • Mitigations are fixed calls to the storefront's admin API with values from the catalog, never shell commands.
Model-written code runs in the storefront's pull-request CI before anyone reviews it; that CI's isolation is not assessed here.
ASI06 Memory and Context PoisoningAddressedKnowledge is screened on load. Search returns only stable, untainted documents: bundle documents are reviewed in Git, and a run's postmortem is searchable only after an approver verifies it. Each run pins its index version.
Details
  • Postmortems created by runs are stored as drafts without a search index. Search cannot find them until an approver verifies them. Verification rejects tainted drafts and is audited.
  • An approver can clear taint only on a draft created by a run. A tainted document from the reviewed bundle is fixed in Git.
  • A run keeps the index version it first searched, so a reload during the run cannot change what it sees.
  • Each run has its own ADK session. There is no shared agent memory across runs.
  • Two routes carry text between runs on purpose: Continue passes a rejected run's reviewer comment, fenced as data, and replay reuses a run's recorded tool outputs.
The same regex screen as ASI01.
ASI07 Insecure Inter-Agent CommunicationPartlyAll agents run in one process and one fixed graph. Every call between services carries a Google ID token checked per route, and GitHub webhooks are signed.
Details
  • There are no agent-to-agent network calls, transfers or sub-agents. Every agent except the four specialists returns structured output.
  • Cloud Tasks reaches the run executor with an OIDC token from its own account. Alerts arrive as a Pub/Sub push with an OIDC token from the alert account.
  • GitHub webhooks are checked with HMAC-SHA256 and only record CI results; they never change a run.
  • action-runner checks the stored approval itself rather than trusting the caller.
Specialists pass findings to the synthesizer as free text, with no required structure or second screening. An instruction in a finding could influence the proposal.
ASI08 Cascading FailuresAddressedAtomic budgets, an attempt cap, per-specialist deadlines and at most one revision round. An executor that lost its lease cannot finish or pause the run.
Details
  • A run that cannot afford its next model call ends budget-stopped, with no call made.
  • A run that keeps failing stops after five attempts, and that is audited. A slow specialist is cut off at 60 seconds (90 for the code specialist) so the others carry on.
  • The critique allows at most one revision round; if the second critic still objects, the run is unresolved. An invalid structured answer gets one repair, and a rate-limit error is retried at most twice.
  • A failed re-check ends the run blocked before that action is sent; an action that already ran stays applied.
  • A run built on an older workflow version fails closed. A repeat alert joins the active run, and the task queue is rate-limited.
Spend is capped per run, not per day; Cloud Billing budgets only alert.
ASI09 Human-Agent Trust ExploitationPartlyThe gate shows the checked proposal: its checks, cited evidence, diff, critic objections, confidence and any flags. Citations must be evidence issued to the run. Approvals expire.
Details
  • The screen shows what code checked, not the model's own summary. A made-up reference fails, because citations must be evidence issued to this run.
  • Proposals below a confidence of 0.5 do not reach the gate.
  • An unresolved run shows its open objections and failed checks instead of a confident answer.
  • Making a decision requires the approver role. The decision is tied to the proposal on screen; a changed proposal gets a 409.
Checks show a proposal is well formed and cited, not that it is right. No separation of duties.
ASI10 Rogue AgentsPartlyNo agent is long-lived or self-starting; every run is bounded. The audit log is append-only for the application. Golden evals test the controls.
Details
  • Each run is started by the console, an alert or Continue, and is bounded by its budget, the attempt cap and deadlines.
  • Triggers refuse UPDATE, DELETE and TRUNCATE on the audit log. It records run start with its versions, taint flags, the gate, the decision, blocked actions and run end. Model calls and write results are kept in their own tables.
  • Golden evals check the controls with scripted models; a paid quality tier checks model behaviour. Both run only when the owner starts them.
  • Today a person can stop an action by rejecting it at the gate, and real writes can be switched off at deploy time.
  • Also open: the model-call table has no append-only trigger, and the audit log is not tamper-proof against an administrator.
A run in progress cannot be cancelled. There are no alerts on agent behaviour.

Checked against the code on 2026-10-06. No third-party governance toolkit is used.

What is not built

NEXT

Compare the other ways to build it.

The architecture alternatives page sets three Google Cloud paths side by side: ADK on Agent Runtime, ADK on Cloud Run and LangGraph on Cloud Run. Each cell explains who handles a production requirement and links to its source.

Next: Why ADK on Cloud Run →