Audit Trails for Agent Decisions: Log Why the Action Was Allowed

This post is for security and platform leads who answer for what agents are allowed to do. After an agent incident, I’d expect the first question to be why the agent was permitted to act. Your cloud’s audit logs record API activity, with coverage that depends on the service and the log types you enable. Alone, they can’t establish which application policy allowed a particular agent action or whether a human signed off. Log that decision yourself, where each tool call is authorized. Design that record before the agent gets production access.

What the platform already gives you

On Google Cloud, Cloud Audit Logs are built to answer “who did what, where, and when?” across your resources. Admin Activity audit logs record configuration and metadata changes, such as changes to IAM permissions, and you can’t disable them. Policy Denied audit logs are generated by default when a service refuses access because of a security policy violation. Google Cloud MCP servers write Data Access audit logs. You enable them by turning on audit logging for mcp.googleapis.com in the IAM AuditConfig object.

Two details matter for agents. First, Data Access audit logs are disabled by default for every service except BigQuery, and enabling them can add log charges. Without them, your audit logs hold no record of what an agent read from those services. I’d enable them on every project an agent’s service account can read from. Second, the Logs Viewer role can’t read Data Access audit logs in the _Default bucket. That takes Private Logs Viewer (roles/logging.privateLogViewer). Check that whoever will investigate an incident holds it.

Even with every log type enabled, these are records of API calls against cloud resources. Alone, they can’t establish which rule your code checked before a call, which version was in force, or whether a human approved it. That gap is yours to fill.

The decision record

I’d emit one structured event for every consequential agent action. Write it at the authorization boundary, where your code decides whether a tool call goes ahead. Don’t reconstruct it afterward from what the model said it did. These are the fields I would not ship without:

I would not treat the model’s narrated reasoning as the audit record. Keep it for debugging if it helps. But a fluent account of why the model acted is not a record of which rule allowed it. Only the second holds up when someone outside engineering reviews it.

Store these events where the agent’s own credentials cannot modify or delete them. If an agent can edit the log, the log settles nothing about what the agent did. I’d route them to a separate project with its own access controls.

Why now, and when this is overkill

The regulatory direction is clear, even though the deadlines are not close. Under Article 12 of the EU AI Act, high-risk AI systems must technically allow for the automatic recording of events (logs) over the lifetime of the system. Those logs must support traceability appropriate to the system’s intended purpose. According to that page, the requirement comes into force on December 2, 2027 for high-risk systems under Annex III, and on August 2, 2028 for those under Annex I. In the US, the NIST AI Risk Management Framework, released January 26, 2023, is intended for voluntary use and is being revised as part of the White House AI Action Plan. Neither source gives you a field-level schema, so the design work falls to you either way. I’d do it while you have only a few agents rather than retrofit it across many.

The point does not apply to every agent. Take an agent that only answers questions, with no tools, no write access and no access to user data. For that agent, prompt and response logs plus the platform’s audit logs are enough, and I wouldn’t build a decision record. The calculation changes once the agent can change something or read data on someone else’s behalf. From then on, someone will eventually ask why an action was allowed, and you need a stored answer.

So pick the agent with the broadest write access. Turn on Data Access audit logs for the projects it touches, and add the decision event at its authorization check. Then choose one of its actions from last week. See whether the records alone tell you who it acted for, which policy version allowed it, and what changed. If they don’t, fix that before you give the agent more access.