All posts

Audit logging for AI agents on Okta

The fastest way to get real audit logging for an AI agent governed by Okta is to route its first connection to infrastructure through a gateway that already knows the agent's Okta identity. You do not build a logging system. You put the agent's traffic through a point that sees both the verified identity and the commands, and you let it write the record. This is a minimal first-connection walkthrough, start to finish. One thing to fix in your head before the steps: Okta is the identity provider

Free White Paper

K8s Audit Logging + AI Audit Trails: The Complete Guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free. No spam. Unsubscribe anytime.

The fastest way to get real audit logging for an AI agent governed by Okta is to route its first connection to infrastructure through a gateway that already knows the agent's Okta identity. You do not build a logging system. You put the agent's traffic through a point that sees both the verified identity and the commands, and you let it write the record. This is a minimal first-connection walkthrough, start to finish.

One thing to fix in your head before the steps: Okta is the identity provider, and the System Log inside Okta records authentication events. That is not the same as audit logging of what the agent did to a database or a host. Okta can tell you the agent signed in. It cannot tell you the agent ran a delete. For that, the log has to be written where the connection happens.

The first connection, end to end

  1. Point the gateway at Okta as the identity provider. Configure the access gateway as the OIDC relying party for your Okta org. It will verify tokens Okta issues. It does not call Okta's admin API.
  2. Have the agent authenticate. The agent signs in against Okta as its own identity and receives a token with its group claims.
  3. Register one connection. Add a single target, say a Postgres database, and map the Okta group that should reach it.
  4. Make the connection. The agent requests the database through the gateway. The gateway verifies the Okta token, confirms the group mapping, and brokers the connection. The agent never holds the database password.
  5. Read the log. Pull the session record. It shows the Okta identity, the group that authorized it, the commands run, and the timestamps, written on the gateway side.

That is audit logging that answers who, what, and why on the first try. The "who" is the verified Okta identity, the "why" is the group mapping that authorized the connection, and the "what" is the recorded session.

Why the record has to live outside the agent

Speed is not the only reason to record at the gateway. It is the only place the record is trustworthy. If the agent writes its own audit log, a compromised agent edits it, and the log becomes a claim rather than evidence. Audit logging only counts when the logger sits outside the thing it logs and the thing cannot turn it off.

That requirement is what hoop.dev is built to. hoop.dev is a Layer 7 access gateway between identities and infrastructure. It verifies the Okta token as the relying party, reads group membership to authorize a connection to the database, SSH host, or cluster, and records each session on the gateway side where the agent cannot reach it. Okta proves identity, hoop.dev brokers and records the access. The getting-started docs walk the Okta setup, and the learn pages show what each session record captures.

Continue reading? Get the full guide.

K8s Audit Logging + AI Audit Trails: Architecture Patterns & Best Practices

Free. No spam. Unsubscribe anytime.

Pairing the two logs

Keep both sources and know what each answers. Okta's System Log answers "did this identity authenticate, from where, and when." The gateway's audit logging answers "what did this Okta identity then do to which system, under which authorization." An investigation usually starts at the gateway record and drops to Okta's log to confirm the sign-in. Neither depends on the agent telling the truth about itself.

A quick verification

Run one task through the new connection, then run a task that asks for a system the agent's Okta group is not mapped to. Confirm the second is denied and that the denial is still in the audit log. A log that records only successful, in-scope access is missing the events an incident review needs most.

FAQ

Isn't Okta's System Log enough for audit logging?

Okta's System Log is strong for authentication events, but it records sign-ins, not the commands an agent runs against a database or host afterward. Audit logging at the gateway captures the action and ties it to the verified Okta identity.

How long does this first connection take to stand up?

One connection: configure the gateway as the Okta relying party, register a single target, map a group, and connect. The log appears with that first session.

hoop.dev is open source. To set up audit logging with Okta as the identity provider in front of your infrastructure, start with the repository on GitHub.

Open source

Save the open-source gateway for agent data access

Hoop is MIT-licensed infrastructure for controlling how AI agents reach production data. Star hoophq/hoop so you can inspect it, deploy it, or share it when your team starts governing agent access.

Star and save the repo →More posts