Security teams should keep agent code limited to goal, reasoning, and output, while the runtime owns credentials, retries, state, sandboxing, observability, and tool dispatch. This reduces code drift, makes controls testable in one place, and prevents secrets from flowing through agent files. A narrow interface such as call_tool, llm, and save_state gives teams a clearer control boundary.
Why This Matters for Security Teams
Separating agent logic from runtime concerns is not a code style preference. It is the control boundary that keeps autonomous behaviour from inheriting credentials, state handling, and tool permissions from scattered application logic. When agent code can reach secrets directly, security teams lose the ability to rotate, revoke, sandbox, and observe access in one place. That creates drift, and drift is where production failures usually begin.
This boundary matters even more in agentic systems because the runtime, not the prompt or model, should own enforcement. Current guidance from the OWASP Agentic AI Top 10 and NIST AI Risk Management Framework both point toward runtime governance, because agent behaviour is dynamic and cannot be safely hardcoded into application files. NHIMG research on The State of Secrets in AppSec shows why this separation is urgent: 43% of security professionals are already concerned about AI systems learning and reproducing sensitive information patterns from codebases.
In practice, many security teams discover the boundary problem only after a leaked token, unsafe tool call, or brittle retry loop has already escaped into production.
How It Works in Practice
The cleanest production pattern is to keep agent logic limited to intent, reasoning, and output selection, then move all execution concerns into a dedicated runtime service. The agent decides what it wants to do. The runtime decides whether that action is permitted, which identity it uses, which secrets are issued, how long they live, where state is stored, and what gets logged. This is consistent with CSA MAESTRO agentic AI threat modeling framework and the emerging best practice described in the OWASP Top 10 for Agentic Applications 2026.
A practical runtime usually centralises four functions:
-
Credential issuance: short-lived secrets are minted per task instead of embedding static keys in prompts, code, or agent memory.
-
Tool dispatch: the runtime brokers calls to APIs, databases, and internal systems through a narrow interface such as call_tool.
-
State management: checkpoints, conversation history, and workflow state are stored outside the agent so they can be audited and redacted.
-
Policy enforcement: access decisions are evaluated at request time rather than baked into static role mappings.
That model works best when the runtime also issues workload identity, such as OIDC-backed identities or SPIFFE-style cryptographic proof of what the agent is, not just what secret it holds. It also supports better isolation because retries, sandboxing, and observability stay consistent across models and tasks. NHIMG’s LLMjacking analysis is a reminder that exposed credentials are quickly abused, which is why runtime-issued, short-lived access is safer than long-lived static credentials.
These controls tend to break down when developers let the agent import SDKs directly or cache secrets in local memory, because the runtime can no longer guarantee revocation or traceability.
Common Variations and Edge Cases
Tighter runtime isolation often increases operational overhead, requiring organisations to balance agility against control boundaries. That tradeoff is real, especially in high-throughput systems where teams want minimal latency and fewer service hops. There is no universal standard for this yet, so current guidance suggests choosing the narrowest boundary that still allows independent policy enforcement, revocation, and auditability.
Some environments need a hybrid approach. A read-only assistant may only need scoped retrieval and logging, while a task-executing agent may require JIT credentials, per-action approval, and sandboxed tool use. In multi-agent pipelines, the runtime should also prevent one agent from inheriting another agent’s state or token set. That is especially important in environments exposed to prompt injection, chained tool abuse, or autonomous lateral movement, as seen in NHIMG coverage of Gemini AI Breach and Replit AI Tool Database Deletion.
Edge cases also appear when teams try to treat agent access like human RBAC. Static roles can work for admin consoles, but they usually fail for autonomous systems with changing goals, branching workflows, and tool chaining. The safer pattern is runtime policy evaluation using context from task intent, data sensitivity, and environment state, aligned with NIST AI Risk Management Framework and the CSA MAESTRO agentic AI threat modeling framework.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP Agentic AI Top 10, CSA MAESTRO and OWASP Non-Human Identity Top 10 address the attack and risk surface, while NIST AI RMF and NIST Zero Trust (SP 800-207) set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP Agentic AI Top 10 | A2 | Runtime isolation and tool control reduce agent misuse and unsafe execution paths. |
| CSA MAESTRO | TA-3 | MAESTRO emphasizes runtime boundaries, orchestration, and agent isolation. |
| NIST AI RMF | GOVERN | AI RMF governance supports accountable separation of model logic and operational controls. |
| OWASP Non-Human Identity Top 10 | NHI-03 | Separation reduces secret sprawl and keeps credentials out of agent code. |
| NIST Zero Trust (SP 800-207) | PR.AC-4 | Zero trust requires runtime authorization rather than trust in agent code paths. |
Issue short-lived secrets at runtime and prohibit secrets in prompts, memory, or source files.
Related resources from NHI Mgmt Group
- How should security teams limit the risk from AI agents that have access to production systems?
- How should security teams govern AI agents that can access enterprise systems?
- How should security teams handle AI agent visibility?
- How should security teams monitor AI agent activity without disrupting developers?