AI Agent Security: From Output Risk to Action Risk
As AI systems move from generating content to executing tasks, security must address not only what models produce but also what agents can do. This article examines the risks introduced by tool access, persistent memory, autonomous planning, and external dependencies, and outlines defenses based on least privilege, sandboxing, end-to-end auditing, human approval, and cloud-native security.
A question is becoming increasingly important in cybersecurity: are we more concerned about what AI says wrong, or what AI does wrong? The distinction may sound subtle, but it changes how security must be designed.
Large language models have sparked extensive debate about data privacy, content accuracy, and algorithmic bias. Researchers, regulators, and ethicists have largely focused on model outputs: what a system says, generates, or predicts.
These concerns remain valid, but they often rest on an implicit assumption: whatever the AI produces, a human ultimately decides whether to act on it. As agent platforms mature, that assumption no longer consistently holds.
When AI evolves from a content generator into an action executor, the nature of risk changes. Security must extend beyond reviewing responses to controlling the operations those responses can trigger.
1. From Generating Content to Executing Actions
In the first phase of large language model adoption, security discussions primarily centered on content. Did training data infringe copyright? Were generated responses biased? How could misinformation be identified and contained?
These issues shared a common boundary: the AI system’s direct role largely ended at information output. Within that framework, regulatory approaches focused on governing training data, requiring accuracy and fairness, implementing content moderation, and improving transparency and explainability. Many AI ethics guidelines and regulations were developed around these priorities.
That framework addressed an important stage of AI development, but a new generation of systems is challenging its assumptions.
An AI agent is more than a conversational model. It is a system capable of acting through four core capabilities:
- Reasoning and planning: Breaking a goal into tasks and determining an execution path.
- Tool use: Operating file systems, browsers, and external APIs.
- Persistent memory: Retaining context and state across sessions.
- Autonomous execution: Continuing to operate under predefined conditions without ongoing human intervention.
Together, these capabilities move AI beyond an advisory role. In an agent workflow, there may be no human decision point between receiving an instruction and producing a consequential change.
That missing buffer is why action risk demands attention beyond conventional output safety.
2. What Makes Agent Actions Risky?
Agents do not introduce a mysterious new category of actor. Instead, they expose a longstanding reality of digital systems: the consequences of behavior depend not only on the component making decisions, but also on the permissions surrounding it.
Three areas are particularly important.
Overbroad Permissions and Unauthorized Execution
Traditional software uses identity and access management (IAM) to define permission boundaries. Agents handling complex tasks, however, may receive broad initial access so they can invoke multiple tools.
If access controls are too coarse, a multistep workflow can lead to operations outside the intended authorization scope. For example, an agent assigned to query data might be induced to invoke a data-deletion tool instead.
The problem is not simply an incorrect response. It is an incorrect decision combined with the authority to execute it.
Memory Hijacking and Context Contamination
Persistent memory helps agents maintain continuity across sessions, but it also creates an attack surface.
An attacker may introduce malicious instructions during an earlier interaction and cause them to be retained in long-term memory. When a later interaction meets a particular trigger condition, the contaminated context may influence the agent to perform an unintended, destructive operation.
The security implications therefore extend beyond the current prompt. Stored context can affect future actions.
Unpredictable Behavior and Supply Chain Risk
Multistep planning creates dynamic execution paths that are difficult to anticipate fully through static rules.
Agents also depend on external tools and interfaces, which form part of their software supply chain. If a third-party tool is compromised or contains a vulnerability, malicious content can enter through the tool-call chain, influence the agent, and potentially affect the host system.
Agent security must therefore account for both changing execution behavior and the trustworthiness of external dependencies.
3. Engineering Defenses for AI Agents
The shift from output review to behavioral control requires security to be built into agent architecture rather than added only at the response layer.
Apply Least Privilege and Sandbox Isolation
Agent permissions should follow the principle of least privilege. Execution environments should also be confined to isolated sandboxes.
Cloud-native technologies such as container platforms can provide a separate, resource-limited container instance for each agent task. This helps constrain file-system access and network communication and isolate task execution.
The following pseudocode illustrates a permission check before a tool call:
# Pseudocode: check tool permissions before executiondef execute_tool(agent_id, tool_name, params):# Retrieve the agent's authorization scope for the current taskallowed_tools = get_agent_policy(agent_id)if tool_name not in allowed_tools:log_security_event(agent_id, "Unauthorized tool access", tool_name)raise PermissionError("This agent is not authorized to invoke this tool")# Execute the operationreturn tool_registry[tool_name].run(params)
The central requirement is that tool execution remain subject to authorization controls, rather than relying solely on the agent to choose an appropriate action.
Establish End-to-End Auditing and Observability
Traditional logs often emphasize inputs and outputs. In agent systems, intermediate planning steps and tool-call sequences are also important sources of risk.
End-to-end auditing should capture observable execution steps, API calls, and returned results through logging and monitoring systems. This provides a record of how an agent moved from an instruction to an action.
Monitoring should also detect anomalous patterns. For example, repeated attempts to perform high-risk operations within a short period should trigger an alert.
Use Human-in-the-Loop Circuit Breakers
Autonomy does not require removing every human control point.
High-risk operations—such as modifying sensitive data, transferring funds, or making system-level changes—should require human approval. At these points, the agent should pause, generate an operation summary, and submit it for review.
If approval is not received within the specified period, or if the system detects an abnormal retry frequency, a circuit breaker should stop task execution.
This preserves autonomous operation for routine work while retaining explicit control over consequential actions.
Build Defense in Depth with Cloud-Native Security
Secure agent systems require mature infrastructure as well as application-level controls.
Cloud-native security capabilities, including those offered by providers such as Baidu AI Cloud, can support layered defenses across network isolation, identity authentication, data encryption, and application protection. Any use of a particular provider must be evaluated against the relevant service availability and deployment requirements.
Managed security services can help scan interfaces used by agents for vulnerabilities and intercept malicious injection traffic. These capabilities reduce the burden of underlying security maintenance, allowing developers to focus more attention on agent workflows and business logic.
Infrastructure defenses complement agent-level controls; they do not replace careful permission design, execution auditing, or approval mechanisms.
Conclusion
AI agents can change the state of digital systems and, through connected systems, affect the physical world. That capability changes the rules of attack and defense.
Security can no longer focus only on the text displayed on a screen. It must also govern the authority to execute actions.
Least-privilege permissions, isolated execution environments, end-to-end observability, human approval for high-risk operations, and cloud-native defense in depth provide the foundation for keeping agent behavior under control while enabling useful autonomous execution.
