Guide2 min read

Audit Logging for AI Agent Actions

Audit logging for AI agent actions: one immutable trail per tenant user — who acted, what ran, approval outcome, and spend — from the gateway.

Read the docs →

/audit /audit /audit /audit /audit /audit /audit /audit /audit /audit
/audit /audit /audit /audit /audit /audit /audit /audit /audit /audit
/audit /audit /audit /audit /audit /audit /audit /audit /audit /audit
/audit /audit /audit /audit /audit /audit /audit /audit /audit /audit
/audit /audit /audit /audit /audit /audit /audit /audit /audit /audit
/audit /audit /audit /audit /audit /audit /audit /audit /audit /audit
/audit /audit /audit /audit /audit /audit /audit /audit /audit /audit
/audit /audit /audit /audit /audit /audit /audit /audit /audit /audit
/audit /audit /audit /audit /audit /audit /audit /audit /audit /audit
/audit /audit /audit /audit /audit /audit /audit /audit /audit /audit
/audit /audit /audit /audit /audit /audit /audit /audit /audit /audit
/audit /audit /audit /audit /audit /audit /audit /audit /audit /audit
/audit /audit /audit /audit /audit /audit /audit /audit /audit /audit
/audit /audit /audit /audit /audit /audit /audit /audit /audit /audit
Guide
TL;DR
  • AI agent audit logging must answer: who acted, for which end-user, under which policy, with what outcome across every primitive.
  • Naïve records every regulated tool call on the tenant user's activity log cards, email, connections, vault access, approvals.
  • Logs are a product of the governance gateway not something you bolt on by printf in the agent loop.
  • Approval events link to the frozen action: pending, approved, denied, and replay result.
  • Query logs per tenant user for customer support; query across users for operator compliance.
  • Combine audit with revoke one timeline shows what happened before you cut access.

When an agent charges a card, sends email, or connects an app, someone will ask what happened — a customer, your compliance team, or you at 2 a.m. after a runaway loop. Application console.log is not enough. You need an audit trail tied to agent identity, written on every regulated action.

Naïve records gateway-enforced calls on each tenant user's activity log. This post is the operational guide; The Governed Agent Profile explains why audit sits alongside caps, approvals, and revoke.

What gets logged?

CategoryExamples
MoneyCard issue, fund, charge, refund
CommsEmail send, SMS, voice
AuthConnection connect, tool execute
SecretsVault put, reveal (metadata — not the secret value)
PolicyApproval created, approved, denied, replayed
ControlAgent profile revoke, session revoke

Each entry includes who (tenant user + actor type), what (action/primitive), when, and outcome.

Query logs for one customer

const events = await naive.forUser(customerId).logs.query({
  limit: 50,
});

Use this in support consoles: "show me everything this customer's agent did today."

Tie audit to approvals

When a tool returns pending_approval:

  1. Log shows the frozen action with action in the immediate payload
  2. Human approves via dashboard or API
  3. Replay outcome appears on the approval record and in subsequent log entries

See how to add human approval for the UI loop.

Audit before revoke

Investigation pattern:

1. forUser(id).logs.query({ limit }) — review last N actions
2. sessions.revoke(id) — cut the agent's session access
3. logs.query again — confirm no new entries after revoke

DIY audit vs gateway audit

DIYGateway (Naïve)
Log only what you remember to instrumentEvery regulated primitive logged by default
Schema drift per integrationConsistent action types
Miss MCP/hosted tool pathsSame trail for BYO and hosted runtime

Where to go next

Frequently Asked Questions
What should an AI agent audit log capture?+
At minimum: tenant user ID, action type, primitive, timestamp, outcome (success, pending_approval, forbidden, budget_exceeded), and correlation IDs for approvals. Naïve's activity log records gateway-enforced calls so you get a consistent schema whether the agent used cards, email, connections, or vault — not ad-hoc log lines per integration.
Where are AI agent actions logged on Naïve?+
On the tenant user's activity log, accessible via the logs API and SDK. Every tool call that passes through the governance gateway generates an entry. Human-initiated dashboard actions and agent-initiated API/MCP calls are both recorded with actor type distinguished (per published docs).
Are approval decisions included in the audit trail?+
Yes. When an agent call returns pending_approval (HTTP 202), the log captures the frozen action. When a human approves or denies, the approval record updates and a replay outcome is recorded on approval. This gives you a complete before/after chain for regulated spend and sensitive operations.
Can I audit one customer's agent without seeing another's?+
Yes. Logs are scoped to tenant users. Query forUser(id).logs.query for a specific customer — Customer A's timeline never includes Customer B's events. This matches the same isolation boundary as forUser(id) on resources.
How is audit logging different from application logging?+
Application logs capture what your code printed. Gateway audit logs capture what the platform enforced — including calls your agent loop never explicitly logged because they ran through MCP or hosted tools. For compliance questions ('did this agent issue a card?'), trust the gateway trail.
How does audit relate to revoke?+
Before revoking an agent profile or MCP session, pull the activity log for that tenant user to see recent actions. After revoke, new entries stop — the historical log remains for investigation. See how to revoke AI agent access instantly for the cut-off step.
NT
Naïve Team

Building the agent-native backend.

Keep reading