---
title: "Agentic loop (3): security and governance"
description: "To work, the loop reads untrusted content into the context and has tools to act: that is its attack surface. Part 3 of 3: prompt injection and the lethal trifecta, why security lives in the harness and not the prompt, observability, and governance in the loop (least privilege, human-in-the-loop, runtime policy, audit)."
url: "https://www.noze.it/en/insights/agentic-loop-3-security-governance/"
lang: "en"
alternate: "https://www.noze.it/insights/agentic-loop-3-sicurezza-governance/"
published: "2026-07-10"
author: "Stefano Noferi"
keywords: "AI, Cybersecurity, Governance, Agentic, Prompt Injection, AI Governance, LLM, Compliance, On-Premise"
---

# Agentic loop (3): security and governance

To work, the loop reads untrusted content into the context and has tools to act: that is its attack surface. Part 3 of 3: prompt injection and the lethal trifecta, why security lives in the harness and not the prompt, observability, and governance in the loop (least privilege, human-in-the-loop, runtime policy, audit).

10 July 2026

![Diagram of agentic loop security: on the left the three conditions of the lethal trifecta (private data, untrusted content, ability to exfiltrate), in the centre the defence that lives in the harness and not in the prompt, on the right the six controls enforced at runtime and at the bottom the immutable audit trail](https://www.noze.it/images/insights/agentic-loop-3-en.svg)

The three conditions of the lethal trifecta and the controls that mitigate them, enforced in the harness at runtime on every tool call. Diagram based on Simon Willison’s analysis.

> **A 3-part series.** [(1) anatomy of the cycle](https://www.noze.it/en/insights/agentic-loop-anatomy/) · [(2) context, patterns and multi-agent](https://www.noze.it/en/insights/agentic-loop-2-context-and-patterns/) · **(3) security and governance**. This is the final part.

In the first two parts we built a capable agent: the [basic cycle](https://www.noze.it/en/insights/agentic-loop-anatomy/) and the [patterns](https://www.noze.it/en/insights/agentic-loop-2-context-and-patterns/) to make it last. That same agent, reading the world and acting, is an attack surface, and the mitigations sit in the harness that runs it.

## Security lives in the harness, not the prompt

To work, the loop **reads untrusted content into the context**: web pages, files, tool outputs, API responses. And here is the attack surface: that content can carry **instructions** which the model, unable to tell them apart from the rest, tends to follow. This is **prompt injection**, and in its agentic form it is especially insidious because the model has _tools_ to act with (the “confused deputy” using its own privileges on the attacker’s behalf).

The worst case is the combination [Simon Willison](https://simonwillison.net/2025/Jun/16/the-lethal-trifecta/) named the **“lethal trifecta”**: access to **private data**, exposure to **untrusted content**, and the ability to **exfiltrate** outward. If an agent has all three, an instruction hidden in a page can make it read sensitive data and send it out. The mitigations **are not in the prompt** (“ignore malicious instructions” is not a security control): they are in the harness.

- **Least privilege** on tools: the agent can do only what is needed, with minimal permissions.
- **Human-in-the-loop** on high-impact actions: explicit approval before an irreversible operation.
- **Sandboxing and isolation** of the execution environment.
- **Runtime-enforced policies** on tool calls (allow/block/redact), not left to the model’s goodwill.
- **PII redaction** before data reaches the model or leaves outward.
- **Kill switch** and budgets as the last line.

This is exactly the role of a framework like [Admina](https://www.noze.it/en/open-source/admina/): to sit between the model and the world, with an immutable audit trail, data redaction and bidirectional policies on every call and every tool.

## Observability: no trace, no debugging

A non-deterministic system that takes actions **must be traced**. Every loop step (input context, decision, tool call, arguments, result) must be recorded in a **replayable** way with an **immutable audit trail**. It is needed for debugging (reproducing a sampling-dependent behaviour is impossible without logs) and for compliance (proving what the agent did, and why). It is also the technical precondition for staying within requirements like NIS2 and the EU AI Act when the agent operates on regulated processes.

## Our take

The loop is a goal, four steps and a stop condition; making it **reliable, secure and governable** is where most of the engineering goes. And that work is not in the prompt nor in the choice of model: it is in the **harness**. That is where you apply context engineering, termination, retries, least privilege, policy, redaction and audit.

It is the reason we design agentic systems by putting governance **in the loop, not next to it**: the [Admina](https://www.noze.it/en/open-source/admina/) framework as the control point between model and tools, the four pillars of [OISG](https://www.noze.it/en/insights/oisg-paradigm-autonomous-ai/) as the criterion (Open, Intelligent, Secure, Governed), and **on-premise** execution when the agent touches data or actions you cannot afford to entrust to someone else’s switch: the same principle of owning the _operational floor_ we wrote about for [local inference](https://www.noze.it/en/insights/dwarfstar-4/).

## References

- [ReAct: Synergizing Reasoning and Acting in Language Models (Yao et al.)](https://arxiv.org/abs/2210.03629)
- [Reflexion: Language Agents with Verbal Reinforcement Learning (Shinn et al.)](https://arxiv.org/abs/2303.11366)
- [Anthropic: Building effective agents](https://www.anthropic.com/engineering/building-effective-agents)
- [Simon Willison: The lethal trifecta for AI agents](https://simonwillison.net/2025/Jun/16/the-lethal-trifecta/)

---

_Go back to [part 1: anatomy of the cycle](https://www.noze.it/en/insights/agentic-loop-anatomy/) or [part 2: context, patterns and multi-agent](https://www.noze.it/en/insights/agentic-loop-2-context-and-patterns/)._

---

[**Stefano Noferi**](https://www.noze.it/en/authors/stefano-noferi/), Founder and CEO/CTO of noze\
Tech Entrepreneur · AI Governance & Security Architect
