How to Configure OpenAI Agents SDK DynamoDB Audit Log

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up an openai agents sdk dynamodb audit log by turning on cloud trail logging for your table. Then you assign a dedicated role to your agent runtime so every request carries a clear identity. Many teams start by giving the agent a broad role with full table permissions. This fast setup lets the agent read and write any item across your tables. Broad permissions create big risks when an agent makes a mistake or runs a bad tool call. You need clear logs and strict rules to keep your data sa

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

You set up an openai agents sdk dynamodb audit log by turning on cloud trail logging for your table. Then you assign a dedicated role to your agent runtime so every request carries a clear identity. Many teams start by giving the agent a broad role with full table permissions. This fast setup lets the agent read and write any item across your tables. Broad permissions create big risks when an agent makes a mistake or runs a bad tool call. You need clear logs and strict rules to keep your data safe.

How to configure an openai agents sdk dynamodb audit log

First, you need to separate your agent identity from your human developer roles. Create a specific cloud role just for the OpenAI Agents SDK runtime. This role gives the agent its own identity in your logs. Next, you configure the database permissions for that specific role. Only allow the exact actions the agent needs for its job. If the agent only reads items, do not give it write permissions.

After you set up the role, you turn on data event logging in your cloud account. Standard cloud logs only show when someone creates or deletes a table. They do not show who reads or writes single items inside the table. You must turn on data events for your specific DynamoDB tables. Once active, every read and write call from the agent goes into your log storage. Each log entry records the agent role, the time, the action, and the table name.

What native logging solves and what it misses

Native data event logging tells you which role called the database and when it happened. It proves that your agent runtime made a specific API call at a certain time. This helps security teams track activity and check role usage after an incident. It also shows if a role tries to run an action that your rules block.

Still, native cloud logs leave a big gap in your daily operations. Cloud logs only show the database API call, not the agent prompt that caused it. You cannot see the full item payload or the exact values the agent read. Native roles also work on an all-or-nothing basis at the table or key level. Once the role logs in, the database returns all fields in the matching item. If an item holds emails, phone numbers, or card numbers, the agent gets them all. Native roles cannot rewrite matched fields in results before the agent reads the response.

Audit Log Integrity + DynamoDB Fine-Grained Access: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Why agent tool calls need field-level controls

AI agents build their database requests based on user input and model reasoning. A user might ask a question that tricks the agent into pulling extra records. If the agent role has permission to scan a table, the database will allow it. The audit log will record the scan, but the data is already out.

To fix this, teams must check requests and responses in flight. You need a way to link the user identity to the agent tool call. You also need data masking that rewrites sensitive fields like national IDs in results. Combining cloud logs with live data masking keeps your tables safe during agent runs.

Govern statements and responses across databases and APIs

Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.

First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.

Frequently asked questions

Does DynamoDB log item reads and writes by default?

No, the database only logs table management actions by default. You must turn on data event logging in your cloud settings to record item reads and writes.

How can I tell which agent made a database call?

Give each agent in the OpenAI Agents SDK its own unique cloud role. Every log entry will then show the exact role name that ran the command.

Do native audit logs show the data returned to the agent?

No, native cloud logs record the API action, the role, and the item key. They do not record the full item body or the text inside the fields.

The query runs. The emails stay hidden.