Docs overview
Write your first APF rule, connect it to Claude Code or add a policy check to your own tool runner. Teams using Nodrail Cloud can connect agents to a shared approval queue.
Try APF locally · Integrate your own harness · Connect to Cloud
Start locally
Install the open-source engine with Node.js 22 or later. No account is needed.
npm i -g @nodrail/policy-engine
With pnpm, run pnpm setup once first, then pnpm add --global @nodrail/policy-engine.
Try APF locally walks you through a two-rule rules.yaml: check what it allows and denies, test it in CI and enforce it in Claude Code. The same file imports into Nodrail Cloud when your team needs it.
Add a playbook to a repository
nodrail is Nodrail's one command line. It adds ready-made policies to a repository, such as letting an agent open a draft pull request only after QA and review passed. nodrail policy runs the same commands as nodrail-policy.
npm i -g @nodrail/cli
nodrail add @nodrail/open-reviewed-pr
Playbooks (preview) walks you through giving the module its values, reviewing the permission changes, locking them and exporting one APF file for your agents.
Connect an agent to Cloud
- Create a workspace, or sign in.
- Open Agents → Connect an agent and choose the integration. Copy its Nodrail credential when shown and store it in your environment's secret settings.
- Follow the matching setup instructions. For Codex, enable the installed hooks before testing; installation alone does not activate them.
- Try a harmless covered call with no matching rule. Review the request in Approvals: Allow once allows it once, and Always allow… also adds a rule for exactly that request after you confirm it. Write broader rules for recurring work in Policies, or import the
rules.yamlyou tested locally. - Test an explicit denial and verify the underlying tool did not run. Check your integration's failure behavior before relying on it.
A TypeScript connection starts with:
npm install @nodrail/client
Set NODRAIL_CREDENTIAL in your runtime's secret settings. For an existing compatible tools collection:
import { guard } from "@nodrail/client";
const governedTools = guard(tools);
// Pass governedTools to your existing agent instead of tools.
This fragment assumes tools already exists. Do not put the credential in browser code or a public repository. The SDK is a Cloud connection; it is not the offline policy engine.
Choose an integration · SDK reference and examples
All documentation
Get started
- Try APF locally: install the engine, write rules, test them and connect Claude Code.
Policies
- Agent Policy Format (APF): YAML rules, outcomes, precedence and tests.
- Playbooks (preview): add ready-made policies to a repository, lock them and export one file.
- Rules reference: fields, lists, macros and overrides.
- Commands and tools: action mapping and command semantics.
- Runs, gates and budgets (preview): rules about what already happened in a piece of work, and the receipts agents end with.
Integrations
- Integrate your own harness: use the engine in your own tool runner.
- Claude Code and Codex: the Cloud plugins, what they check and how they fail.
- TypeScript SDK: guard the tools you pass to your agent.
Nodrail Cloud
- Using Nodrail Cloud: Overview, Approvals, Policies, Activity and Insights.
- Runtime API: ask Cloud for a decision over HTTPS from any language.
- Personal API (preview): your workspace from scripts, with a personal access token.
Reference
- CLI reference (nodrail): project, policy and Cloud commands.
- CLI reference (nodrail-policy): validation, evaluation, testing and execution gates.
- Security model: data flows, enforcement and bypass boundaries.
The client remains a developer preview before 1.0. Pin package versions in applications and check compatibility when upgrading. Local policy tests verify decisions; integration tests must also prove that blocked calls never invoke the underlying tool.