Skip to main content

Approvals for agent tool calls

A Confirm-tier tool call waits for a person outside the agent conversation. An agent saying “approved,” a client-side prompt or an MCP progress message does not answer it. The server checks access grants independently of confirmation.

The database and AI Hive hold and resolve their own approvals. Use the API on the server that received the tool call; an approval ID from one is not an ID on the other. MCP servers explains discovery and execution.

Who can answer​

ServerCalling credentialAnswering credential
ekoDBJWT for the calling registered keyJWT for a different Person key belonging to the same recorded owner, or an authorized app-role identity representing that person
AI HiveAgent's MCP-scoped sessionFull session for the same signed-in user

For ekoDB, Agent keys, Role keys and keys without a recorded kind cannot watch or answer. A Person key resolves to its recorded owner; an app-role identity resolves to its authenticated subject. The calling key cannot answer its own call.

For AI Hive, an MCP token is refused on approval routes even though it can make the call needing approval. Keep human and agent credentials separate in storage, transport and logs.

Watching​

Run ekodb-cli approvals watch --server ekodb or ekodb-cli approvals watch --server claw in a terminal. Choose explicitly: the CLI defaults to AI Hive (--server claw). The watcher keeps the person's stream open and shows the tool, parameters, affected scope and remaining time before asking. watch requires an interactive terminal; --format does not apply to approval commands.

For database approvals, use ekodb-cli approvals key set --server ekodb --url <database-base-url> --api-key-file <person-key-file> to store the Person key behind OS-enforced per-use presence. ekodb-cli approvals key status --server ekodb reports availability. Supported mechanisms are the macOS Data Protection Keychain and Windows TPM protection. Without the required mechanism, including unsupported Linux or unsigned macOS builds, the CLI refuses before any network request or approval stream opens. Use an authorized human surface instead of the agent's key.

For AI Hive approvals, the watcher performs a fresh interactive sign-in and keeps its Full-session credential in memory. It does not reuse the stored MCP credential.

An HTTP surface holds GET /api/approvals/stream for ekoDB or GET /approvals/stream for AI Hive open with the authorized human credential. Polling the pending-list route does not make a person reachable. Without an attached surface, a call needing confirmation is refused immediately.

HTTP routes​

All routes require the server's valid answering credential in its authorization header. Paths are relative to that server's base URL.

PurposeekoDBAI HiveSuccessful response
List pending callsGET /api/approvalsGET /approvalsArray of pending approvals
WatchGET /api/approvals/streamGET /approvals/streamServer-sent event stream
AnswerPOST /api/approvals/{id}POST /approvals/{id}JSON with answered: true
List remembered grantsGET /api/approvals/grantsGET /approvals/grantsArray of grants
Revoke a grantDELETE /api/approvals/grants/{id}DELETE /approvals/grants/{id}JSON with removed: true

A pending approval has id, tool, params, requested_at and expires_at. Show the full operation and target scope to the person; do not ask them to approve only a tool name with arguments hidden.

The answer body has decision and an optional string note. Accepted decisions are allow_once, allow_always and deny. An answer acknowledges the person's decision, not completion of the tool. The original caller receives the execution result separately.

Stream events​

Both streams use named pending, resolved and snapshot events. A pending payload has approval; a resolved payload has id and outcome; a snapshot payload has approvals.

The encodings differ: ekoDB JSON has these fields without an event field; AI Hive JSON also includes event with the event name. ekoDB initially sends a connected SSE comment so the connection becomes visible before a pending call exists. Comments and keepalive messages are not pending calls.

Deduplicate pending calls by ID. On resolved, remove that ID; outcomes are allowed, denied, expired and cancelled. On snapshot, replace the entire local pending set, including an empty array. After reconnecting, consume the current state rather than replaying stale approval buttons.

Remembering and revoking​

allow_once applies to the pending call. allow_always is offered only when a remembered grant is eligible; it is not a permanent permission change.

  • ekoDB: a grant is scoped to the calling key and exact JWT, canonical tool, target/access scope and dry-run state, with chat scope where relevant. It expires with the calling token. Destructive and unclassified calls cannot be remembered. A replacement JWT does not inherit the grant.
  • AI Hive: a grant is scoped to the MCP sign-in, tool and shown target scope and ends with that session. Structural operations, batch_transaction, goal deletion and goal completion require a decision each time. Requesting “always” for a once-only action behaves as allow once.

Use ekodb-cli approvals grants --server <ekodb|claw> to inspect grants and ekodb-cli approvals revoke <id> --server <ekodb|claw> to revoke one. A subsequent matching call then needs approval again. Revocation does not undo a completed operation.

Refusals and races​

An unanswered call expires at expires_at. Denial, expiry, cancellation or loss of the calling credential prevents execution through that hold. Discard stale actions on resolved items. A tool or transport error is not permission to retry a write blindly.

For ekoDB, an agent/role/kindless key, the calling key itself, another person, an unknown ID and an expired or already answered ID all receive the same 404 on the answer route. Forbidden identities receive 403 on list, stream and grant routes. AI Hive refuses an MCP token on approval routes with 403; a Full session answering an unavailable ID receives 404.

Pending-cap limits can refuse additional holds. Follow the returned reason; do not open more streams or change credentials to evade it. Connect your coding agent covers registration and removal.