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.

Commit provenance
The change log records every committed write stamped with caller class and protocol source.
Accessible row counts
Reach commands count the rows a service key or user identity can read, update and delete per type without returning field values.
Immediate revocation
Cut off 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#

Every committed write carries an engine-generated provenance stamp in the change log. Only the database engine writes that metadata, so no caller can spoof or omit how a call arrived.

Stamped commit provenance

Every commit records its caller class and protocol source in order.

Inspect recent commits from your terminal as a human-readable summary or as newline-delimited JSON:

Your terminal
# Summarize the last hour's commits by timestamp, caller kind, mutated types and row counts.napalm changes notes --since 1h # Emit JSON entries stamped with each commit's protocol source for filtering or archival.napalm changes notes --since 1d --json

Each entry reports three fields without printing sensitive row payloads to your terminal:

Caller class
Identifies a user session, a service key or an internal system task.
Source
Marks http for API calls, mcp or a2a for agent protocols, and job or schedule for background work.
Affected rows
Lists mutated types and row counts without exposing field values in CLI output.

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 user 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;   # Stamp the acting identity and OAuth assistant name on every insert and update.  changed_by: ext::auth::Identity {    rewrite insert, update using (global caller);  };  changed_through: str {    rewrite insert, update using ((global ext::napalm::ClientTokenAgentGrant).client_name);  };}

Those two rewrite fields distinguish direct user edits, OAuth assistants and backend keys:

Direct user edit
changed_by records the signed-in user’s identity and changed_through stays empty.
OAuth assistant edit
changed_by records the approving user’s identity while changed_through records the client name approved at consent.
Service key edit
Both fields stay empty, while the change log still attributes the commit to that service key.

To retain a full edit log rather than only the most recent editor, insert an audit row from a schema trigger. See Agent access & grants.

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
# Count accessible rows per type and total file bytes for a service key.napalm keys reach notes 0b6f1f5e-2a4c-4d7e-9f3b-8c1d2e3f4a5b # Count accessible rows for a user and any OAuth assistant acting on that user's behalf.napalm people reach notes ada@example.com # Trace policy evaluation on a single record for a user.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.

Signed-in users inspect their active OAuth connections as ext::napalm::AgentGrant rows, and built-in policies restrict each row’s read and delete access to its approving user:

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#

Pick the cutoff scope matching the incident, from disconnecting a single user’s assistant to taking the entire project endpoint offline:

TargetActionTakes effect
OAuth assistantDelete the user’s ext::napalm::AgentGrant row from your app UI.Takes effectOn the next request, closing live streams.
Service key agentnapalm keys revokeTakes effectOn the next request, closing live streams.
Agent identityDelete the agent’s role row or record grant row.Takes effectOn the next statement.
All writesnapalm endpoint --read-onlyTakes effectImmediately for every caller.
Entire endpointnapalm endpoint --disableTakes effectImmediately, preserving all data and keys.

Expose grant deletion as a deployed query so signed-in users can disconnect an OAuth assistant directly from your app:

dbschema/queries/revokeAgent.edgeql
delete ext::napalm::AgentGrantfilter .id = <uuid>$grant

Operators can revoke keys, freeze writes or disable traffic across the branch from the CLI:

Your terminal
# Revoke one service key immediately.napalm keys revoke notes 0b6f1f5e-2a4c-4d7e-9f3b-8c1d2e3f4a5b # Block writes from every caller while keeping reads online.napalm endpoint notes --read-only # Take the endpoint offline without deleting data or keys (--enable restores traffic).napalm endpoint notes --disable

Check the change log#

Connect an agent, modify one row and run napalm changes notes --since 10m. Passing --json shows mcp as the commit source. Revoke the key and ask the agent to update the row again to confirm that Napalm rejects the call and records zero new commits.

Type a word or two to search every docs page.