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 Python package. For what the governor decides and why, see the Governor product page. For the TypeScript package, see the TypeScript SDK guide.
The package is in early access. Until it is on PyPI, your Coverbase representative gives you the wheel to install. The import paths 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. Each one is a target, for example prod-db for a Postgres database or billing-api for an HTTP API.
  2. In Policies, make sure a baseline lets the agent reach those targets. An agent can see and act on only the targets a baseline lets it reach.
  3. In Agents, select Register agent, name it after your agent and select Register. The Connect an agent panel shows the key once. Copy it.
Register agent drawer with name and sign-in fields

Register agent: name the agent, choose how it signs in, and save.

Connect panel with the Python SDK snippet

Connect an agent, Code group, Python SDK: the install command and a first query for this agent.

Install

The package needs Python 3.10 or later and depends only on httpx. Install an extra for each framework you use:

Configure

Set the key where the agent runs. The SDK reads it from the environment, so it never lands in your source.
COVERBASE_GOVERNOR_URL defaults to https://api.coverbase.app. A key created before the governor was renamed also works as COVERBASE_BROKER_KEY. You can also pass everything to the client:

Your first governed query

Terminal output of the Python quickstart

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

quickstart.py
A target is named by its name or its id (cbbtgt_...). The SDK looks names up once through whoami and caches them. An exact name wins; a name that differs only in letter case resolves only when one target matches. sql, http, aws and code cover the four request kinds:
Each returns a Decision with verdict, note, risk_score, intents, result, masked and audit_seq. decision.rows holds SQL rows as dictionaries.

Held actions

A policy can hold an action until a person approves it in Inspect › Governor › Approvals. The SDK handles the wait:
  1. It calls on_hold with the held decision, so you can tell your user.
  2. It checks the approval until a person decides.
  3. When the person approves, it sends the identical request again with the approval and returns the result.
Terminal output of a held update that runs after approval

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

held.py
Approvals queue with a held action selected

Inspect › Governor › Approvals: the person sees the exact statement. Approve once runs only that statement.

Approve once covers only the exact call that was held, for the same person the agent acted for. The SDK keeps a copy of the request and sends exactly that copy again, so a change to your own data while it waits does not change what runs. Approve equal actions for a window covers any statement of the same shape until it closes. To return at once instead of waiting, pass wait=False. The SDK raises ApprovalPending with the approval id. Pass the id back later to resume:

Errors

Every error’s message is written so a model can pass it to its user.

Govern your agent’s tools

Every target as a tool

governor_tools builds one tool for each target the agent can reach, with the same names and arguments as the governor’s MCP tools, plus governor_identity_token. A governed tool never raises for a policy outcome. It returns the status (allowed, held, denied or failed) and a message, so the model sees why and can tell the user.
Terminal output listing governed LangChain tools

governor_tools: one tool per target this agent can reach, plus the identity token tool.

langchain_tools.py
Terminal output listing governed OpenAI Agents SDK tools

The same tools for the OpenAI Agents SDK.

openai_tools.py

Wrap a tool you already have

governed_tool wraps a function that builds an action. It keeps the function’s name, docstring and signature, so each framework reads the tool’s schema from it.
to_openai_agents and to_crewai do the same for the other frameworks. By default a held tool waits for the person. With on_hold="return", it returns {"status": "waiting_for_approval", "approval_id": ...} at once, and the model can tell the user. When the model calls the tool again with the same arguments, the SDK sends the request it built the first time, with the approval, so the approved call runs.

Drop-in clients

To route existing code through the governor, change the line that opens the connection.

Postgres

Terminal output of the Postgres drop-in

The Postgres drop-in: a DB-API cursor whose statements go through the governor.

dropin_postgres.py
The governor approves and records the exact statement, so the drop-in puts each parameter into the statement as a quoted literal instead of sending it separately. It uses psycopg’s quoting when psycopg is installed. Each statement is its own action, so there are no transactions across statements, and rollback() is not supported. Use dialect="mysql" for a MySQL target.

HTTP with httpx or requests

Terminal output of the httpx drop-in

The httpx transport: the refund is held, approved, and the response comes back as a normal httpx response.

dropin_httpx.py
The host in your URL is ignored. The governor calls the target’s own address with its own credential, and your code’s Authorization and Cookie headers are dropped. AsyncGovernedTransport does the same for httpx.AsyncClient.

Act on behalf of a person

When a person delegates a task to the agent, pass the delegation. Rules that need a delegation then apply, the agent can reach only the targets that person delegated, and the person is recorded on every decision.
A one-time approval is tied to the delegation it was asked under.

Identity tokens for your own services

An agent can get a short-lived signed token that names it, and the person it acts for, for a service that checks your organization’s published keys. See Agents as an identity provider.
Terminal output of an identity token request

An identity token for one audience, valid for five minutes.

identity_token.py

Sign in with a workload identity

An agent running in GitHub Actions, Kubernetes or another OIDC issuer can sign in with its workload token instead of a key. Set up the agent’s federation rule in Inspect › Governor › Agents, then pass a function that returns a fresh token and the agent’s id:

Async

AsyncGovernor has the same methods as coroutines:

Check the results in Coverbase

Every call appears in Inspect › Governor › Activity with its verdict, the rule that matched, the risk and the masked fields. Open a decision to see each step of the decision path.
Activity view with a decision opened

Inspect › Governor › Activity: each decision the SDK caused, with the steps the governor took.

Troubleshooting