Running agents
Whose data an agent touched
Find which customers and records an agent read or changed, for an incident, a customer's question or a breach assessment, from the signed audit ledger.
When something goes wrong, such as a leaked token, an agent that did something odd, or a customer asking whether your AI saw their data, the first question is whose data was involved. lokra exposure answers it from the signed audit ledger, and checks the ledger has not been edited before it does.
Ask the question#
Everything one leaked token did, given the token or its id:
lokra exposure --token lokra1.eyJhZ2VudCI6…
Everything one agent did in a week:
lokra exposure --agent support-bot --since 2026-11-20 --until 2026-11-27
Everything that could have touched one customer's rows, when that customer asks:
lokra exposure --rows 42
| Flag | What it limits the report to |
|---|---|
--agent |
One agent. |
--since, --until |
A window, as a date such as 2026-11-20 or a time such as 2026-11-20T09:00, in local time. A date alone as --until includes that whole day. |
--token |
One token, by the token itself or its id. |
--user |
Requests on behalf of one person: the user on a login token, or --on-behalf-of on a Lokra token. |
--rows |
Requests that could touch one value of a row lock column, such as one account id. Agents without a row lock are included, because they could see every account. |
--json |
Structured output for your own tools, instead of text. |
You can ask the same questions in the dashboard and in Lokra Cloud; see in the dashboard and Lokra Cloud.
Read the report#
Whose data was touched
agent support-bot · from 20 Nov 2026 00:00 · until 28 Nov 2026 00:00
Ledger: verified, 1204 entries
account_id 42
14 reads returned 96 rows from customers, orders · 3 values masked
1 proposed write showed it 2 rows
1 write changed 2 rows
Records: customers id 7, 12, 19
Records: orders id 41, 57, 63, 70, 71, 88, 90, 104, 105, 112 and 4 more
2 reads did not return the table's primary key, so which records it saw is not known
for [email protected], [email protected] · by support-bot · 20 Nov 2026 09:12 to 27 Nov 2026 17:40
account_id 57
3 reads returned 11 rows from orders
Records: orders id 230, 231, 236
for [email protected] · by support-bot · 22 Nov 2026 14:03 to 22 Nov 2026 14:05
Writes that changed rows
w_377e8285 27 Nov 2026 17:40 support-bot orders id 41, 57 approved by dana
Blocked: 3 (2 refused by the SQL check, 1 refused by the database)
The report has one section for each set of rows the agent was held to, usually one customer:
- reads and the rows they returned, the tables read, and how many values were masked on the way out.
- proposed writes whose row preview showed the agent rows.
- writes that ran, and how many rows they changed.
- Records: the primary keys of the rows it saw or changed.
- who the requests were for, which agents made them, and when.
Two more sections appear when they apply:
- All rows lists agents without a row lock. They could see every customer, so any of their reads could include anyone's data.
- Not recorded lists entries written before Lokra 0.8.5, which did not record whose rows a request was held to.
Then come the writes that changed rows, with the exact keys, who approved each one, and whether it was undone. Last, the attempts Lokra blocked, which reached no data.
How exact it is#
| Question | How exact |
|---|---|
| Which customers | Exact for agents with a row lock: Postgres held every request to the values in its section. |
| Which records were read | Exact for a read of one table that returns its primary key columns under their own names. Other reads, such as joins, counts or reads without the key, are counted on the "did not return the table's primary key" line. |
| Which records were changed | Exact for every write with a row preview. Others show only their row count. |
| How many rows | A row read twice is counted twice. |
Keys are masked like any other value, so a table keyed by a masked column, such as an email, shows hashed or partial keys. The report covers only what agents did through Lokra. See what Lokra does not protect against.
In the dashboard and Lokra Cloud#
lokra dashboard has an Exposure view with the same filters: agent, dates, customer, person and token. It shows the same report, one card per customer, with each card's records, the writes that changed rows, and a Download JSON button. It reads the gate's own ledger, so it verifies the signatures, just as the command does.
Lokra Cloud has an Exposure page that does the same across every gate in your organisation. It adds a gate filter, and each card says which gates the customer's data passed through. A few things differ, because Cloud holds a copy of the ledger, not the signing key:
- It checks that consecutive entries from each gate still link by hash, as Activity does. It cannot check signatures. For a verified answer, run
lokra exposureon the gate. - It covers the history Cloud keeps: 7 days.
- It reads at most the newest 20,000 matching entries at a time, and says so when there are more. Narrow the dates, agent or gate to see the rest.
- It filters by token id, the one
lokra revoke-tokenprints, not by the token itself. - It shows customers and counts, not record keys. The keys of the rows an agent read or changed never leave the gate, so the Records lines only appear in the command and the dashboard.
It is only as good as the ledger#
The report verifies the ledger's hash chain and signatures first. If an entry was edited or removed, it says so at the top, and lokra exposure exits with status 1:
WARNING: the ledger does not verify (entry 52: contents were modified); entries from that point on cannot be trusted
Back up .lokra/ledger.jsonl with the rest of the state directory, and connect Lokra Cloud for a copy off the gate.
For a breach assessment#
Notification rules such as Australia's Notifiable Data Breaches scheme and the GDPR ask you to work out whose information was involved in an incident, and quickly. The report gives you the customers and record keys an agent reached, from a log that shows whether it was tampered with. Look the keys up in your own database to find the people behind them.
JSON output#
--json returns the same report as data:
| Field | What it holds |
|---|---|
filters |
The flags you passed. |
ledger |
verified, entries and the verification message. |
scopes |
One object per section: scope (a column and values, "all rows" or "not recorded"), reads, rows_read, unkeyed_reads, proposals, rows_shown, writes, rows_changed, masked, tables, records (each table's key and values), agents, people, first, last. |
writes |
Each write that ran: write_id, ts, agent, on_behalf_of, approved_by, rows, changed and undone_by. |
blocked |
Counts of blocked attempts by event. |