Quickstart
Get from install to your first authorization decision in under five minutes.
You need Node.js 18+ and npm or pnpm before starting.
Install the CLI
This installs the shotoku command globally. The core library (@shotoku/core) is also available separately if you want to call authorize() directly from your agent code.
Initialize
This creates three things in your current directory:
shotoku.config.json— runtime config (policy path, ledger path)policy.yaml— your authorization rulesdata/— directory where decisions are stored locally
Define your policy
Open policy.yaml and define which resources your agents are allowed to access. Anything not on the allowlist goes to pending_approval. Anything that exceeds a limit is denied.
The daily limit is computed from the rolling 24-hour window in the local ledger — not a calendar day.
Call authorize() in your agent
Before your agent takes an action, call authorize(). It evaluates the request against your policy and the local ledger, writes the decision, and returns the result.
Shotoku fails closed. If the policy file is missing or the request is malformed, the response is denied — it never defaults to approved.
Try it from the CLI
You can also authorize directly from the terminal — useful for testing policies before wiring them into agent code.
Handle pending approvals
When an agent tries to reach a resource not on your allowlist, Shotoku records it as pending_approval and waits for a human decision.