Skip to main content
For AI agents: a documentation index is available at https://docs.coverbase.com/llms.txt. This page is also available in markdown by appending .md to the URL.
This guide is part of the User Guides collection. It covers the @coverbase/governor npm package. For what the governor decides and why, see the Governor product page. For Python, see the Python SDK guide.
The package is in early access. Until it is on npm, your Coverbase representative gives you the package to install. The imports and calls on this page do not change when it is published.
The SDK sends each action your agent takes to the governor before it touches a database, an API, AWS or a sandbox. The governor decides, runs the action with a credential scoped to it, masks the result and records the decision. Your agent never holds the target’s credential.

Before you start

  1. In Inspect › Governor › Targets, add the systems the agent may reach.
  2. In Policies, make sure a baseline lets the agent reach those targets.
  3. In Agents, select Register agent, select Register, and copy the key from the Connect an agent panel. It is shown once.
Connect panel with the TypeScript SDK snippet

Connect an agent, Code group, TypeScript SDK.

Install

The package has no runtime dependencies. It runs on Node 18 or later and on edge runtimes that have a global fetch. Install a framework only for the adapter you use: ai for the Vercel AI SDK, @langchain/core for LangChain.js, @openai/agents for the OpenAI Agents SDK.

Configure

Or pass options to the client:
On an edge runtime without process.env, pass key and baseUrl directly.

Your first governed query

Terminal output of the TypeScript quickstart

The agent lists its targets, reads invoices with emails masked, and is refused a DROP.

quickstart.mjs
The other request kinds:

Held actions

run and its shortcuts wait for a person when a policy holds the action, then send the identical request again with the approval:
Terminal output of a held update in TypeScript

The update is held, the agent waits, and it runs once a person approves.

held.mjs
To return at once instead of waiting, pass wait: false. The SDK throws ActionHeld with approvalId; pass it back as approvalId later. Pass an AbortSignal as signal to stop waiting; an aborted signal sends nothing.

Govern your agent’s tools

governorTools(gov) builds one tool per target the agent can reach, named and shaped like the governor’s MCP tools, plus governor_identity_token. A governed tool never throws for a policy outcome. It returns { status, message, ... } with status allowed, held, denied or failed, so the model sees why.
Terminal output listing governed Vercel AI SDK tools

governorTools for the Vercel AI SDK: one tool per reachable target.

ai-tools.mjs

Wrap a tool you already have

Each adapter exports governedTool. Give it your own arguments with parameters and build, or the governor’s standard arguments with kind:
Every governed tool also takes purpose, approval_id and delegation_id arguments, like the MCP tools. With onHold: 'return', a held tool returns at once and the model calls it again with approval_id once a person approves.

Drop-in clients

fetch

Terminal output of governedFetch

governedFetch returns a real Response with the governor's verdict in its headers.

fetch.mjs
Only the path, query and body are sent. The target’s address and credential live in the governor, and your Authorization and Cookie headers are dropped. A repeated query key is refused, because the governor’s request carries one value per key. Pass the function to any client that accepts a custom fetch.

Postgres (pg)

Terminal output of the pg drop-in

GovernedPool: the pg query API, with each statement governed.

pg.mjs
The governor approves and records the exact statement, so $1 values become quoted literals in the statement. Strings, numbers, bigints, booleans, null, Date, Uint8Array, arrays and plain objects (as jsonb) are supported, and negative numbers are wrapped in parentheses. Each statement is its own action, so there are no transactions across calls.

Act on behalf of a person

Identity tokens

Sign in with a workload identity

Troubleshooting