Guides
GuidesDefine a policy
Author a private policy and register its commitment — with the SDK or the CLI.
A policy sets the rules an agent must prove it followed. Define one in code or from the terminal.
const policy = zentra.createPolicy({
name: 'vendor-payouts',
maxAmount: 200_000_000n, // 20 XLM per invoice
dailyLimit: 1_000_000_000n, // 100 XLM per epoch
approvedRecipients: [vendorA, vendorB],
});
// register the commitment + recipient root on-chain
await zentra.commitPolicy(agent, policy);zentra policy create vendor-payouts \
--max-amount 20 \
--daily-limit 100 \
--allowlist ./vendors.json \
--asset native
zentra policy commit ./policies/vendor-payouts.jsonEither path produces the same on-chain result: a Poseidon commitment and a recipient Merkle root. The thresholds and the vendor list stay private.
Keep the policy file and its secret salt safe — they're needed to prove against the commitment later, and the salt is what keeps the policy hidden.