Agents & safe copilots

Agents act as the signed-in user and preview writes before anything commits.

Every project exposes your deployed queries over MCP and A2A. Limit a background task to chosen rows until a deadline, and review proposed row diffs before saving changes.

Read the copilot guide
Replaces
  • Custom MCP wrapper servers
  • External RAG vector sync
  • Prompt-only write guardrails
  • Ad-hoc agent queue glue

Record grants

Tie an agent session to chosen rows and an expiration time.

Insert an AgentGrant row naming the records an agent may touch and when access ends. PostgreSQL checks both the target link and datetime_of_statement() on every MCP, A2A and HTTP call.

Agent access and grants
dbschema/queries/grantAgent.edgeql
insert AgentGrant {  person := (select Person filter .identity = global caller),  agent := identity_by_id(<uuid>$agent),  notes := (select Note filter .id in array_unpack(<array<uuid>>$notes)),  expires := datetime_of_statement() + <duration>'168 hours',}

Scoped search

Search filters out private documents during index scoring.

Hybrid vector and keyword search runs under the caller’s session token. The index scan skips unreadable records, so private notes never enter the prompt or crowd out valid matches.

POST /search
curl https://notes.napalmdata.com/search \  -H "Authorization: Bearer $SESSION" \  -H "Content-Type: application/json" \  -d {    "type": "Note",    "query": "launch timeline and milestones",    "limit": 5  }
In-app AI copilots

MCP and A2A setup

Claude Code and Cursor connect straight to your project URL.

Every project serves Streamable HTTP MCP and A2A 1.0 without a wrapper server. Before handing an agent a key, run napalm keys reach to count how many rows per type that credential can read or change.

Terminal
claude mcp add --transport http napalm https://<label>.napalmdata.com/mcp \  --header "Authorization: Bearer $NAPALM_AGENT_KEY" napalm keys reach research agent-researcher
MCP server reference

Write approvals

Preview proposed row changes before an agent saves anything.

Call napalm.ask with isDryRun: true under the user’s session token. Read questions return answers right away, and write requests return the compiled EdgeQL query and before-and-after diffs for confirmation.

Previewing copilot changes
app/api/assistant/route.ts
import { NapalmClient } from 'napalm-client' const napalm = new NapalmClient('https://notes.napalmdata.com', { token: userSession })const asked = await napalm.ask(message, { isDryRun: true }) if (asked.proposed) {  return Response.json({    query: asked.proposed.query,    changes: asked.proposed.dry_run?.changes ?? [],  })}return Response.json({ answer: asked.answer, rows: asked.data })

Revoking access

Deleting a grant stops a running agent on the same commit.

Delete the AgentGrant row or run napalm keys revoke from the terminal. Open live streams, pending tool calls and A2A tasks lose access immediately because Napalm never caches permissions.

dbschema/queries/revokeAgent.edgeql
delete AgentGrantfilter .agent.id = <uuid>$agent
Agent access and grants

Audit trail

Every agent write records both the person and the client app.

Schema rewrite rules fill in global caller and the agent’s client_name inside PostgreSQL on every insert and update. Neither the app nor the agent can omit or spoof those fields.

dbschema/default.gel
type Note {  required title: str;  changed_by: ext::auth::Identity {    rewrite insert, update using (global caller);  };  changed_through: str {    rewrite insert, update      using ((global ext::napalm::ClientTokenAgentGrant).client_name);  };}
Agent audit trail