Agentic AI Security: Rebuilding Defense from Output Risk to Action Risk

    This article examines how AI agents shift the security center of gravity from what a model says to what it actually does. It explains why action risk is more dangerous than output risk, breaks down five mechanisms that generate action risk, outlines four changes to the offense-defense rules, and presents a five-layer control framework covering identity and least privilege, sandboxing, a unified policy enforcement point, human-in-the-loop gates, and full-chain auditing. It also covers a data trust-level scheme for containing prompt injection and four metrics for making security operational. Security engineers and platform builders will find a practical, engineering-oriented approach to keeping agent autonomy within verifiable boundaries.

    ## 1. A Historic Shift in Risk: From “What It Says” to “What It Does”

    For the past few years, security discussions around large models have concentrated almost entirely on the output layer: whether training data is compliant, whether generated content carries bias, and how misinformation can be identified and contained. These issues matter, but they share an implicit assumption—no matter what the model outputs, the human is still the one who ultimately presses the execute button. The human is a natural buffer and the anchor for accountability.

    Regulatory frameworks are built on the same assumption: governing data sources, requiring accurate and fair output, and establishing content moderation and transparency mechanisms. AI legislation and ethics guidelines in some jurisdictions largely follow this path. The logic is internally consistent, but it presupposes a world where “AI only produces text.”

    The emergence of production-grade agent platforms breaks that assumption. Common agent security frameworks in the industry typically define an agent as “a system that can act,” with four core capabilities:

    • Reasoning and planning: automatically decomposing high-level goals into executable subtasks and paths;
    • Tool invocation: directly operating file systems, browsers, code repositories, and internal APIs;
    • Memory persistence: retaining context, state, and preferences across sessions;
    • Autonomous execution: running in loops for extended periods without human intervention under preset conditions.

    The combination of these four capabilities marks a role shift: from “advisor” to “executor.” The buffer of human decision-making between receiving an instruction and producing real consequences is compressed or even eliminated. This is the fundamental reason action risk deserves more vigilance than output risk—output errors can be intercepted in review, while execution errors are often discovered only after the fact.

    2. Dissecting the Danger: Five Mechanisms That Generate Action Risk

    1. Excessive privilege grants. To make an agent “get work done,” engineering practice often reuses high-privilege identities or long-lived credentials. The agent’s privilege boundary therefore far exceeds what a single task actually needs, and once it is induced, the blast radius is uncontrollable.

    2. Untrusted data channels and prompt injection. The web pages, documents, tickets, and code comments an agent reads are all externally controllable data. An attacker does not need to break the model—only to embed instructions in the data so that “data” is executed as a “command.” This is the most typical entry point for action risk.

    3. The privilege-union effect of toolchains. A single tool may seem harmless, but combined they can form a complete attack chain: read a file → assemble an internal address → initiate an outbound connection → write a persistent configuration. The risk lies not in any single point but in the reachability of the combination.

    4. Memory poisoning and state drift. Poisoned memory persistently influences decisions across sessions, creating “inject once, bias for the long term.” At the same time, long-running operation gradually drifts the agent’s actual behavior away from the original authorization intent.

    5. Missing rollback and audit. Traditional application changes have versioning and rollback; an agent’s operation sequences often lack equivalent snapshot and replay capabilities, making incident post-mortems difficult.

    3. Four Changes to the Offense-Defense Rules

    Dimension Output Era Action Era
    Control target Content compliance Privileges and reachability
    Defense boundary Network perimeter Identity and authorization
    Detection granularity Point content moderation Full-chain behavioral observability
    Decision mode Manual review Policy engine + human-in-the-loop at key nodes

    The conclusion: the governance focus must shift from “controlling what the model says” to “controlling what the agent can reach.”

    4. A Five-Layer Control Framework

    Layer 1: Identity and least privilege. Use independent, short-lived credentials for each task, granting authorization per task rather than per person; prohibit reuse of administrator identities.

    Layer 2: Sandboxing and isolation. Run the agent in a container or lightweight virtualization sandbox, with the file system mounted read-only by default, outbound traffic routed through an allowlist proxy, and write operations confined to a dedicated working directory.

    Layer 3: A unified policy enforcement point. Route all tool invocations through the same gateway for policy decisions, rather than writing a separate set of checks in each tool. An illustrative policy (pseudocode):

    1. policy:
    2. - tool: file.read
    3. allow_paths: ["/workspace/task/**"]
    4. deny_patterns: ["**/.env", "**/credentials*"]
    5. - tool: http.request
    6. require: domain_in_allowlist
    7. max_response_bytes: 65536
    8. - tool: shell.exec
    9. require: human_approval
    10. timeout_seconds: 120
    11. - tool: memory.write
    12. require: content_trust_level >= "verified"

    Layer 4: Human-in-the-loop gates at key points. Irreversible or high-impact actions (deletion, transfers, external publishing, privilege changes) require mandatory human confirmation, and the pending context should be compressed into a human-readable diff view to avoid approval fatigue.

    Layer 5: Full-chain audit and observability. Record the complete trace of “goal—plan—tool invocation—parameters—result,” support replay by session, configure monitoring and alerts for anomalous sequences (high-frequency outbound connections, out-of-bounds path access, abnormal credential use), and connect to a unified logging service for long-term retention.

    When deploying on the cloud, these capabilities map to a combination of common product categories: a container platform hosts the sandbox runtime, a key-management service holds short-lived credentials, logging and monitoring/alerting services carry auditing and anomaly detection, and a message queue is used to make the human approval flow asynchronous. General cloud infrastructure from providers such as Baidu AI Cloud can be organized along these layers as well; the key is to standardize the control points rather than depend on any single product.

    5. Trust-Level Classification: Caging Untrusted Data

    Classifying the information an agent touches by source is the most effective means of suppressing prompt injection:

    • L0 Trusted: direct instructions from the task initiator;
    • L1 Internal: returns from controlled internal systems;
    • L2 External: web pages, emails, third-party documents;
    • L3 Untrusted: user uploads, publicly writable content.

    The rule is simple: L2/L3 content must never be elevated to instructions, must never trigger privilege changes, and must never be written into the high-trust partition of memory. In implementation, source labels can be explicitly annotated during prompt assembly, and on the policy-gateway side, sensitive tool invocations “triggered by low-trust content” can be rejected outright.

    6. Measurement: Making Security Operational

    It is advisable to continuously track four metrics: privilege redundancy (the proportion of actually unused privileges), the human-confirmation rate for sensitive operations, the injection interception and false-positive ratio, and mean time to detect/locate incidents (MTTD/MTTR). Security designs without measurement rapidly decay as iterations proceed.

    7. Conclusion

    Agents have not created a new subject; they have merely put a long-overlooked fact on the table: what determines the consequences of behavior is not the cognitive unit itself but the privilege structure built around it. Agent security is therefore not about adding a filter layer to the model, but a return to an engineering paradigm—using mature means such as identity, isolation, policy, and audit to keep autonomy within verifiable boundaries.