Skip to the page

Guides · Agents & copilots

Watching and stopping an agent

Inspect every write an agent makes, trace its source and measure its reach. Revoke a single grant, pause writes or lock down the project.

What you’ll build#

You will answer the three operational questions for any agent touching live data.

What the agent did
The change log records every commit stamped with caller kind and protocol source.
What the agent can reach
Value-blind per-type counts of the rows a service key or user identity can read, update and delete.
How to stop the agent
Halt a single grant, a service key, all writes or the entire endpoint in one command or delete.

Before you start#

Reading the change log requires a cluster with change logging enabled. napalm storage show <cluster> reports whether the log is active, and napalm storage enable <cluster> log turns it on. Reach counts evaluate your live schema rules and require an organization login (napalm login).

Read the change log#

Napalm stamps every write at commit with the caller class and ingress protocol. Only the database engine writes this stamp, so no caller can spoof or omit its provenance.

Ordered commit provenance in napalm changes and GET /changes

Every committed block records caller kind and protocol source (http, mcp, a2a, job, schedule). napalm changes inspects metadata without exposing values, while GET /changes streams policy-filtered row changes.

Your terminal
# The last hour's commits: when, what kind of caller, which types, how many rows.napalm changes notes --since 1h # The same as JSON, with each commit's source, to keep or to filter.napalm changes notes --since 1d --json
Kind of caller
A person’s session, a service key or Napalm’s own work.
Source
http for the API, mcp or a2a for agent protocols, job or schedule for queued work.
Changes
The mutated types and row counts per type. The CLI displays zero field values, keeping customer data inside your database.

Any commit stamped mcp or a2a originated from an agent. To inspect changed field values or follow commits live, read the change log via GET /changes, which filters every row under your credential’s access policies.

Record the last editor on each row#

The change log records caller class rather than individual user IDs. To stamp the exact person and connected assistant onto each row, declare schema rewrite rules. Mutation rewrites run inside every insert and update and override caller-supplied values.

dbschema/default.gel
type Note {  required title: str;  required author: Person;   # Who made the last change, and for an agent a person let in, the app's name.  changed_by: ext::auth::Identity {    rewrite insert, update using (global caller);  };  changed_through: str {    rewrite insert, update using ((global ext::napalm::ClientTokenAgentGrant).client_name);  };}
A person’s own edit
changed_by is the person, and changed_through is empty.
An agent a person let in
changed_by is still the approving user because the agent acts on their behalf, and changed_through records the app name shown at consent.
A service key
Both fields are empty. The change log still shows that a key made the change.

For a line per change instead of only the last change, write a history row from a trigger. Agent access & grants shows the trigger.

Count an agent’s reach#

Reach commands count accessible rows per type under your live access rules without exposing any field values, and log every person-scoped check to your organization’s audit trail.

Your terminal
# A key: each type's rows it can read, change and delete, and its files' bytes.napalm keys reach notes 0b6f1f5e-2a4c-4d7e-9f3b-8c1d2e3f4a5b # A person, and so any agent acting as them.napalm people reach notes ada@example.com # Why one record is or isn't theirs, rule by rule.napalm explain-access notes 8f2c1e64-0b7a-4f4e-9d2b-3a6c5e1f7d90 --as ada@example.com

Connected agents can also inspect their own active connection’s counts through the describe_reach tool when schema sharing is enabled.

A signed-in person sees every connected agent as an ext::napalm::AgentGrant row. Only a grant’s own person may read and delete that grant.

dbschema/queries/myAgents.edgeql
select ext::napalm::AgentGrant {  id,  client_name,  is_read_only,  create_time,  expire_time,}filter not exists .revoke_time

Stop an agent#

Because Napalm verifies credentials and grant rows against the database on every call, revoking a key, deleting an ext::napalm::AgentGrant or switching the endpoint mode halts access immediately.

Zero-cache revocation and endpoint kill switches

Delete an ext::napalm::AgentGrant row, run napalm keys revoke to sever a key and close its live streams, or flip --read-only / --disable across the entire project.

To stopDo thisTakes effect
An agent a person let inThe person deletes the agent’s grant. Your app can offer a button for the delete.Takes effectAt the agent’s next call.
An agent with a keynapalm keys revokeTakes effectAt the agent’s next call. The agent’s open live queries end.
An agent with a separate sign-inDelete the row that gives the agent a role, or the agent’s grant of records.Takes effectAt the agent’s next statement.
Every writenapalm endpoint --read-onlyTakes effectAt once for every caller.
Everythingnapalm endpoint --disableTakes effectAt once. Nothing is deleted.
dbschema/queries/revokeAgent.edgeql
delete ext::napalm::AgentGrantfilter .id = <uuid>$grant
Your terminal
# One key, at once.napalm keys revoke notes 0b6f1f5e-2a4c-4d7e-9f3b-8c1d2e3f4a5b # Every write, from every caller, while you look.napalm endpoint notes --read-only # Everything. Data and keys are kept, and --enable brings it back.napalm endpoint notes --disable

Check the change log#

Connect an agent, have it change one row and run napalm changes notes --since 10m. With --json, the commit shows mcp as the source. Revoke the key and ask the agent to update the row again. Napalm refuses the call, and the change log records nothing new.

Type a word or two to search every docs page.