agent-governance
v0.1.13
Published
JavaScript SDK for checking AI agent actions before they run.
Maintainers
Readme
agent-governance
Check AI agent actions before they run.
agent-governance is the JavaScript / Node SDK for Cerone.
It lets you give an agent a declared purpose and capabilities, then ask Cerone for a runtime decision before a tool call executes:
approvedflaggedrejected
Use it when your agent is about to do something real:
- read or write files
- call internal APIs
- query a database
- perform support, billing, or ops actions
- run tools on behalf of users
The npm package name is agent-governance for discoverability. The hosted
runtime behind it is Cerone.
Why Developers Install It
- validate agent tool calls before execution
- keep your own OpenAI, Anthropic, or other model key
- catch actions that do not fit the agent's declared purpose
- detect suspicious or unsafe action payloads early
- add identity, trust, and audit signals without replacing your stack
- start immediately from a hosted trial
Cerone is not a model proxy. It sits around agent actions, not between you and your LLM provider.
Install
npm install agent-governanceNode 18+ is required because the SDK uses built-in fetch and
AbortController.
Once The Trial Starts, Do This Next
Do not stop at trial bootstrap.
Go immediately to the first value path:
- Create your first agent with a real purpose and capability set.
- Validate one real action your app or tool wrapper actually wants to run.
- Inspect the decision:
approved,flagged, orrejected.
If you only acquire a hosted trial token but never create an agent or validate an action, you have not actually tested Cerone yet.
Quick Start
import { CeroneClient } from "agent-governance";
const client = new CeroneClient();
const agent = await client.createAgentForAction("file_read", {
workspaceTarget: "repository files such as README.md",
environment: "development",
});
const result = await client.validate(
agent.agentId,
"file_read",
{ path: "README.md" },
);
console.log("Agent:", agent.agentId);
console.log("Decision:", result.result);
console.log("Trust:", result.trustScore);What happens here:
- Cerone creates an agent identity with declared purpose and capabilities.
- Your app asks Cerone to validate a real action.
- Cerone returns a runtime decision before that action is executed.
A More Typical Example
import { CeroneClient } from "agent-governance";
const client = new CeroneClient();
const agent = await client.createAgent(
"Answer customer billing questions and look up billing records.",
["db_read", "billing_api"],
{ environment: "development" },
);
const result = await client.validate(
agent.agentId,
"database_query",
{ table: "billing", customer_id: "123" },
);
console.log(result.result, result.trustScore);The intended flow is simple:
approved-> continueflagged-> review or warn according to your app policyrejected-> block execution
Purpose Fidelity Matters
Cerone works best when the declared purpose actually matches what the agent is doing.
If you are wrapping common tools like file_read, avoid vague purpose text.
createAgentForAction(...) exists to help you get to a stronger first-run
agent profile more quickly.
import { CeroneClient } from "agent-governance";
const client = new CeroneClient();
const agent = await client.createAgentForAction("file_read", {
workspaceTarget: "repository files such as README.md",
environment: "development",
});If you already know exactly what the agent is for, pass an explicit purpose and capability set yourself.
Hosted Trial and Access
If you do not pass an API key, the SDK can bootstrap a hosted trial token automatically by calling:
POST /trial/session
That token is persisted locally at:
~/.cerone/trial_token
Protected API routes still use:
X-API-Key: sk_trial_...
Current access paths:
1. Hosted trial
- no manual signup required to begin evaluation
- designed for testing, demos, and first integrations
- if the trial is exhausted, contact us for persistent access
2. Persistent access
- use a provisioned key for POCs, pilots, and production environments
Support:
Hosted service terms:
What This SDK Does
This is a thin Node client for the hosted Cerone runtime. It can:
- create root agents
- create root agents from a real action with inferred purpose/capability framing
- spawn child agents
- validate actions
- validate action batches
- fetch usage
- issue delegated tokens
- verify and revoke delegated tokens
The goal is to keep the client side light while identity, validation, trust, and audit logic stay centralized in Cerone.
Single Validation vs Batch Validation
Start with validate(...) for one action. Use validateBatch([...]) only when
you already have multiple validation items to send together.
import { CeroneClient } from "agent-governance";
const client = new CeroneClient();
const results = await client.validateBatch([
{
agentId: "agt_123",
action: {
tool: "database_query",
parameters: { table: "billing", customer_id: "123" },
},
},
{
agentId: "agt_456",
action: {
tool: "refund_lookup",
parameters: { refund_id: "rf_789" },
},
},
]);
for (const item of results) {
console.log(item.agentId, item.result, item.trustScore);
}If you call validateBatch([]), the SDK raises a local error before making a
request.
API
Main exports:
CeroneClientAgentGovernanceClient(alias)CeroneErrorAuthenticationErrorValidationErrorLocalValidationErrorRateLimitErrorNetworkError
new CeroneClient([options])
Options:
apiKeybaseUrldefault:https://api.homersemantics.comtimeoutMsdefault:30000maxRetriesdefault:3retryNonIdempotentdefault:falseenableCachedefault:falsecacheTtlMsdefault:300000trialTokenPathintegrationIdoptional stable identifier for your host app or wrapperclientSessionIdoptional run/session correlation idtelemetryHookoptional callback for structured SDK lifecycle eventstelemetryMetadataoptional static metadata merged into emitted SDK events
Agent methods
createAgent(purpose, [capabilities], [options])createAgentForAction(action, [options])spawnAgent(parentId, purpose, [capabilities], [options])
Validation methods
validate(agentId, action, [parameters])validateBatch(validations)
Trial / health / usage methods
healthCheck()getUsage()ensureApiKey()
Delegated token methods
delegateToken(options)verifyToken(accessToken, [options])revokeToken(accessToken)
Telemetry and Local Errors
Optional SDK lifecycle events:
client_initializedhosted_trial_startedtrial_token_receivedagent_createdvalidation_attemptedvalidation_result_receivedbatch_validation_attemptedlocal_error
Structured local error categories include:
missing_tokenmissing_agent_idempty_batchserialization_errorinvalid_action_shapewrapper_misuseunsupported_path
These are surfaced through LocalValidationError and the optional
telemetryHook.
The SDK also sends stable request metadata headers such as:
User-Agent: agent-governance-node-sdk/<version>X-Cerone-SDK-NameX-Cerone-SDK-VersionX-Cerone-RuntimeX-Cerone-Client-SessionX-Cerone-Integration-Idwhen providedX-Cerone-Auth-Sessionafter an API key or trial token is activeX-Cerone-Request-SequenceX-Cerone-Client-IntentX-Cerone-Interaction-Mode
Bring Your Own Model Key
Cerone validates agent behaviour. It does not replace your inference provider.
You keep your own OpenAI, Anthropic, or other provider key and send model calls through your normal stack. Cerone checks intended actions and returns runtime decisions around those actions.
Other SDKs
Current Cerone SDK surfaces:
Node / JavaScript
- package:
agent-governance - repo: github.com/AnantDhavale/agent-governance-js
- package:
Python
- package:
cerone - repo: github.com/AnantDhavale/cerone_sdk
- package:
If you are building in Node:
npm install agent-governanceIf you are building in Python:
pip install ceroneNotes
- this package is for server-side Node code
- do not expose your Cerone API key in browser bundles
- for enterprise or persistent access, contact
[email protected]
