createCurb
functionSetupOne-call setup. Auto-provisions the audit + HCS-2 policy topics, defaults the store, publishes the starting policy, and returns ready-to-use Agent Kit hooks.
signature
createCurb(opts: CreateCurbOptions): Promise<Curb>The fastest way to govern an agent. With just `client` + `agentAccountId`, it creates an HCS audit topic and an HCS-2 policy registry (owner-only writes), defaults storage to in-memory, publishes your caps to the registry, and hands back the hooks you drop into the Agent Kit. Pass existing topic ids or a custom store to reuse them.
Parameters
NameTypeDescription
opts.clientreqClientA Hedera SDK operator client (creates topics + writes the audit trail).opts.agentAccountIdreqstringThe account the agent pays from (the governed account).opts.store= new InMemoryCurbStore()CurbStoreBring your own store (Redis/Postgres) for production.opts.auditTopicId= auto-createdstringReuse an existing HCS audit topic; omit to auto-create.opts.policyTopicId= auto-createdstring | falseReuse an HCS-2 registry, omit to auto-create, or pass `false` to skip versioning entirely.opts.currency= 'HBAR''HBAR' | 'USDC'Display currency for the policy.opts.perTask= 10numberMax value of a single payment.opts.perDay= 25numberRolling 24h spending cap.opts.autoUnder= 3numberPayments below this auto-approve.opts.approveUnder= 10numberAt/above this, an approval is flagged high-value.Returns
Promise<Curb>`{ hooks, config, store, auditTopicId, policyTopicId }` — drop `hooks` into the kit; reuse the ids/store later.
Example
example
import { createCurb } from 'hedera-curb';
const curb = await createCurb({ client, agentAccountId, perDay: 25 });
new HederaAIToolkit({ client, configuration: {
context: { hooks: curb.hooks },
}});- Auto-created topics cost a few cents in HBAR; pass existing ids to avoid re-creating.
- The HCS-2 policy topic is created with an owner-only submit key, so only you can change the rules.