Guides

AI Agent Access Control and Audit Logs: A Practical Guide

How to give AI Agents their own identity, scoped permissions, approval gates and audit logs, so you know what each agent may do, what it did, and who is accountable.

The short answer: what is AI Agent access control?

AI Agent access control defines, for each agent, which data it may read, which tools it may call, which actions it may take on its own and which actions must wait for a person to approve. An audit log is the record that lets you answer later: which agent, acting for whom, did what, when, based on which data, and who approved it.

The two belong together. Permissions limit the damage when an agent misreads a request or is manipulated; logs let you detect, investigate and show customers, partners or regulators that people remain in control of the system.

This guide is for operations, IT and legal leads who are putting AI Agents into real workflows. It draws on public guidance from OWASP and NIST, and on the relevant provisions of Vietnam's 2025 Law on Artificial Intelligence and 2025 Law on Personal Data Protection.

Why AI Agents need their own approach to permissions

A chatbot only answers in text. An AI Agent calls tools: it looks up the CRM, edits orders, sends messages, creates accounts. Once it can act, a wrong answer can become a wrong operation on real data.

The OWASP Top 10 for LLM Applications (2025) calls this risk Excessive Agency (LLM06): damaging actions performed in response to unexpected, ambiguous or manipulated model outputs, whatever the cause of the malfunction. OWASP names three common root causes: too much functionality, too many permissions, or too much autonomy over high-impact actions.

The cause of a bad output might be a poorly written prompt, a weak model, or malicious instructions hidden in an email or document the agent reads (see What is prompt injection). You cannot remove all of these causes, so the practical answer is to narrow what an agent can do when it gets things wrong.

  • Too much functionality: the agent only needs to read email to summarise it, but its tool can also send and delete messages.
  • Too many permissions: the tool only needs to read a product table, but connects with a database account that can modify and delete every table.
  • Too much autonomy: the agent deletes documents or publishes content without asking the user first.

Step 1: give every AI Agent its own identity

A common mistake is letting an agent run under an employee's account or a shared admin account. The log then says "account X edited the order" with no way to tell whether a person or the agent did it, and you cannot revoke the agent's access without affecting the person.

OWASP recommends tracking user authorization so that actions taken on behalf of a user run in that specific user's context with the minimum privileges necessary, rather than through a generic high-privileged identity.

A service account per agent

Each agent should have its own service account, named after its role (for example agent-order-intake or agent-invoice-matching), with a named business owner and a named technical owner.

  • Keep an agent register: name, purpose, workflow served, systems accessed, permission level, owner, status (active, suspended, retired).
  • Be able to lock or revoke an agent account immediately without touching any human account.
  • Review agent permissions on a schedule, as you would for staff, and remove anything unused.

When an agent acts for a specific person

If an agent reads an employee's mailbox or documents, have that employee delegate access through a standard sign-in flow with the narrowest scope (OWASP's example is OAuth with the minimum scope required). The log should record both: which agent acted, and on behalf of which user.

Step 2: choose a permission model, RBAC or ABAC

RBAC (role-based access control) attaches permissions to roles, then assigns roles to people or agents. Most business software already works this way, and business teams find it easy to understand.

ABAC (attribute-based access control) is defined by NIST in SP 800-162 as a method where authorization is determined by evaluating attributes of the subject, the object, the requested operation and, in some cases, environment conditions against policy or rules. For AI Agents, ABAC helps when permission depends on context: amount, branch, data sensitivity, working hours.

In practice many organizations combine them: RBAC decides which role an agent has, and ABAC adds conditions for sensitive operations.

RBAC and ABAC compared for AI Agents
CriterionRBAC (role-based)ABAC (attribute-based)
How access is decidedThe agent gets the permissions of its roleAttributes of the agent, data, operation and context are evaluated against policy
Illustrative exampleRole "Customer support" may read orders and create ticketsMay issue a refund if the amount is under a threshold, for its own branch, during working hours
StrengthsSimple, easy to review, built into most softwareFlexible, fine-grained, context-aware
WeaknessesRoles multiply; conditions such as limits are hard to expressNeeds accurate attribute data and well-managed policies
Best whenThe agent's scope is stable and clearAccess depends on amount, sensitivity, location or time

Step 3: scoped tokens and checks in the downstream system

The token or API key an agent uses is its permission. If the token can read the whole CRM, the agent can technically export the whole CRM, whatever the system prompt says.

OWASP stresses two points: give the agent only the tools it actually needs, and enforce authorization in downstream systems rather than relying on the model to decide whether an action is allowed. Every request that goes through a tool should be checked against security policy.

  • Split permissions by verb: read, draft, write, send externally, delete. A summarising agent only needs read.
  • Prefer narrow tools such as "create support ticket" over open-ended ones such as "run any command" or "fetch any URL".
  • Use short-lived tokens issued per task where possible, and revoke them when the task ends.
  • Never put API keys in prompts or documents the agent reads; keep them in your infrastructure's secret store.
  • Rate-limit tools that change things (sending messages, editing data) to contain damage if an agent misfires in bulk.

Step 4: approval gates for irreversible actions

OWASP recommends human-in-the-loop control so that a person approves high-impact actions before they are taken. Build the gate into the tool that executes the action (for example, a "publish" tool that always waits for a person to approve), not just as a line in the prompt.

Vietnam's Law on Artificial Intelligence No. 134/2025/QH15, in force from 1 March 2026, sets out in Article 4(2) the principle that AI serves people and does not replace human authority and responsibility, and that human control and the ability to intervene in AI decisions and behaviour must be maintained. Article 7(4) prohibits obstructing, disabling or distorting the mechanisms for human supervision, intervention and control. See our analysis of the 2025 AI Law.

Approvers need enough to decide: the original request, the data the agent used, the proposed action and what remains uncertain. A lone "Approve" button tends to turn approval into a formality. Gate design is covered in more depth in Human-in-the-loop.

Illustrative example: tiering AI Agent actions
TierExample actionsSuggested control
DoRead, summarise, classify, draft internallyLog; sample reviews
Do and reportCreate a support ticket, update an internal status that can be revertedLog; allow undo; alert on anomalies
Approve firstSend information to customers, refund, change account permissions, delete data, sign or close a contractPause for an authorized person; log who approved, when and what
NeverChange its own permissions, disable logging, move money above a limitDo not grant the tool; downstream system refuses

Step 5: what an audit log should record

The OWASP Developer Guide asks that each log entry carry enough metadata (when, where, who, what) to reconstruct the timeline of an event, including timestamp, severity, account identity, trace ID, outcome and description. For AI Agents, add the tool calls and the approval.

How much content to log is a balance. OWASP warns against logging too much or too little, and its Logging Vocabulary advises avoiding full prompts and tool inputs and outputs, preferring usage measures, policy thresholds, request identifiers and the tool or model involved. If you must keep content for investigations, mask personal data and keep it for a shorter period than the metadata.

Fields an AI Agent audit log should contain
GroupFieldsNotes
WhoAgent ID, configuration or system prompt version, the user the agent acts forSeparates agents from people; shows which version ran when something failed
WhatAction name, affected object (order ID, customer ID)Use IDs rather than names or phone numbers where possible
WhenTimestamp with time zone, trace ID linking the steps of one taskKeep clocks synchronised across systems
InputRequest ID, data sources read, a summary or hash of the inputAvoid full text if it contains personal data
Tool callTool name, key parameters, result (success, failure, denied)Record denials by the downstream system too
OutputFinal result, data changes (before and after)Enough to undo if needed
ApprovalApprover, time, decision, reason if rejectedEvidence that people stay in control
ModelModel name and version, token usageUseful for incident analysis and cost control

Log retention and personal data

AI Agent logs will almost certainly contain personal data: customer names, message content, employee IDs. OWASP also notes that logs may contain personal and other sensitive information, and must be protected from unauthorized access, modification and deletion.

Vietnam's Law on Personal Data Protection No. 91/2025/QH15, in force from 1 January 2026 (with implementing Decree 356/2025/ND-CP, which replaces Decree 13/2023/ND-CP), states in Article 3(3) that personal data is stored for a period appropriate to the purpose of processing, unless the law provides otherwise. Article 14 lists when personal data is deleted or destroyed, including when the processing purpose has been fulfilled and when the legal retention period has expired. See the full checklist in our 2025 Personal Data Protection Law guide.

In short, you need a retention policy with reasons, not "keep everything just in case".

  • Define the purpose of each log type: incident investigation, business reconciliation, proof of approval.
  • Set separate retention periods for metadata and detailed content; keep the part with personal data shorter unless sector rules require longer.
  • Mask or encrypt sensitive fields; limit who can see full logs.
  • Delete on expiry through a recorded process, including in rotating backups.

Tamper-evident logs, explained plainly

A log is only worth something if readers trust it was not edited after the fact. OWASP Top 10:2025 recommends that every transaction has an audit trail with integrity controls against tampering or deletion, such as append-only database tables.

Think of the log as a bound notebook with numbered pages. You can add new pages, but tearing out or rewriting an old page leaves a mark. Common techniques are:

  • Append-only: the application and agent accounts cannot edit or delete earlier entries.
  • Chained fingerprints: each entry includes a hash (a digital fingerprint) of the previous entry. Changing an old entry breaks the chain after it, so the change is detectable.
  • Separate storage: ship logs to a store that the application's own administrators cannot quietly delete from.
  • Alert when logging stops: OWASP recommends processes to detect that logging has stopped and to spot unauthorized access or deletion.
  • Never give an agent a tool to read all logs or modify its own log.

Implementation checklist and how EYC works

You do not need a large platform to start. Most of the steps below can be done with the identity system, database and log store you already have.

  • Keep an AI Agent register: purpose, owner, systems accessed, permission level.
  • One service account per agent; never share a human account.
  • Use RBAC for roles and add ABAC conditions for operations with limits.
  • Narrow, short-lived tokens; permissions checked in the downstream system.
  • Tier actions; build approval gates into the tools for irreversible actions.
  • Logs with who, what, when, input, output, tool call and approval.
  • Purpose-based retention; mask personal data.
  • Append-only, separately stored logs with an alert when logging stops.
  • Review agent permissions and rehearse revoking agent access regularly.

What EYC applies

EYC operates internal processes for access control, audit logging, backup and incident response. When we build AI & Automation solutions for clients, we design separate agent identities, narrowly scoped tools, approval points for important actions and reviewable logs. Log retention, support levels and other operational commitments are set out in each project's contract.

Frequently asked questions

Should an AI Agent share an account with an employee?

No. A shared account means the log cannot tell whether a person or the agent acted, and you cannot revoke the agent's access without affecting the person. Give each agent its own service account; when it acts for a person, use delegated access with a narrow scope and record both identities in the log.

Should I use RBAC or ABAC for AI Agents?

RBAC is enough for agents with a stable, clear scope. When access depends on context such as amount, branch or data sensitivity, add ABAC-style conditions. Many organizations combine the two.

Can I just tell the agent in its system prompt not to delete data?

You can, but it is not enough. OWASP recommends enforcing authorization in downstream systems rather than letting the model decide. If the agent does not need to delete, do not give it a tool or token that can delete.

Do AI Agent logs need to store every prompt and response?

Not necessarily. OWASP guidance advises avoiding full prompts and tool inputs and outputs, and logging request IDs, tools, models and usage instead. If you need content for investigations, mask personal data and keep it for a shorter period.

How long should AI Agent logs be kept?

Vietnam's 2025 Personal Data Protection Law requires personal data to be stored for a period appropriate to the purpose of processing, unless the law provides otherwise. Set retention by the purpose of each log type and check any sector rules that apply to you.

Share article:
Key point

Access control and audit logs do not slow AI Agents down; they are what make it possible to trust agents with real work. Start with an agent register and a list of irreversible actions, then widen permissions gradually as the logs show the agent behaving correctly. This article is for information only and is not legal advice.

Sources

  1. LLM06:2025 Excessive Agency — OWASP Top 10 for LLM Applications
  2. SP 800-162, Guide to Attribute Based Access Control (ABAC) Definition and Considerations — NIST
  3. Logging Cheat Sheet — OWASP Cheat Sheet Series
  4. Logging Vocabulary Cheat Sheet — OWASP Cheat Sheet Series
  5. Implement Security Logging and Monitoring — OWASP Developer Guide
  6. A09:2025 Security Logging and Alerting Failures — OWASP Top 10:2025
  7. Law No. 134/2025/QH15 on Artificial Intelligence — Government of Vietnam Portal
  8. Luật Trí tuệ nhân tạo 2025 chính thức có hiệu lực từ ngày 01/3/2026 — Thư Viện Pháp Luật
  9. Luật Trí tuệ nhân tạo chính thức có hiệu lực từ 01/3/2026 — Cổng thông tin ICT Ninh Bình
  10. Law No. 91/2025/QH15 on Personal Data Protection — Government of Vietnam Portal
  11. Luật Bảo vệ dữ liệu cá nhân số 91/2025/QH15 (full text) — LawPlayer