Docs/API/buildCurbHooks

buildCurbHooks

functionSetup

The ordered policy + audit stack, if you want to wire things up yourself instead of using createCurb.

signature
buildCurbHooks(deps: CurbDeps): (AbstractPolicy | AbstractHook)[]

Returns the six hooks Curb runs, in order: a RejectToolPolicy (hard-disables account-mutating / allowance tools), the counterparty allowlist, the spend-limit policy, the approval-tier policy, the Curb audit hook, and the kit’s HCS audit-trail hook. Drop the array into `configuration.context.hooks`.

Parameters

NameTypeDescription
deps.cfgreqCurbConfigCaps, currency, agent account id, and the audit topic id.
deps.storereqCurbStoreThe state backend (spend, allowlist, approvals).

Returns

(AbstractPolicy | AbstractHook)[]

The ordered array of Agent Kit policy/hook instances for `configuration.context.hooks`.

Example

example
import { buildCurbHooks, InMemoryCurbStore } from 'hedera-curb';

const store = new InMemoryCurbStore();
store.allowAccount(AGENT_ID, PROVIDER_ID);
const cfg = { agentAccountId: AGENT_ID, auditTopicId: TOPIC_ID,
  currency: 'HBAR', perTask: 10, perDay: 25, autoUnder: 3, approveUnder: 10 };

context: { hooks: buildCurbHooks({ cfg, store }) }
Notes
  • Order matters — the kit short-circuits on the first policy that blocks.
VERIFIABLE SPEND-CONTROL   ·   ENFORCED ON-CHAIN   ·   AGENTS CAN PAY — NOW THEY CAN’T OVERSPEND   ·   CURB × HEDERA   ·   VERIFIABLE SPEND-CONTROL   ·   ENFORCED ON-CHAIN   ·   AGENTS CAN PAY — NOW THEY CAN’T OVERSPEND   ·   CURB × HEDERA   ·