Your first policy
Define a generic rule as code, test allow and deny cases, then publish it.
Policies are rules that decide which agents, acting for which subjects, may perform which actions. This guide writes
one as a file, tests it locally with the CLI, and publishes it to your sandbox. You need @reqlo/cli 0.2.0 or later
(npm install -g @reqlo/cli), and the document resource type and documents.read action from the
Quickstart.
Also register documents.publish under Actions & resources → Register action, on the document resource
type, with these context attributes (switch the attribute editor to JSON to paste them):
{
"document_classification": { "type": "enum", "values": ["public", "internal", "confidential"], "required": true },
"requested_visibility": { "type": "enum", "values": ["team", "company", "public"], "required": true, "provenance": "caller" }
}Optional dashboard templates
Policies apply to your registered tools and resource schemas. The document example below is one use case; the same engine can govern code changes, infrastructure, communications, financial actions or your own workflows.
In the updated checkout dashboard, open Policies → Create policy. The default is a Custom policy. Optionally choose a starting pattern:
| Template | Pattern |
|---|---|
| Documents & records | Allow selected actions when a chosen resource attribute matches subject.id |
| Code changes | Require approval for a protected branch or target; allow other target values |
| Infrastructure | Require approval in the chosen protected environment; allow other environment values |
| Communications | Require approval when a chosen boolean marks an external destination |
| Finance & usage limits | Require approval above a chosen integer limit, in your attribute's units |
Choose your actual actions, an agent (or explicitly all agents), and compatible attributes. The attribute picker shows fields available on every selected action; it does not guess permissions from tool names or create a new catalog. Enum choices must be valid for every selected action. Numeric templates currently use integer fields; use custom rules for other numeric representations.
For infrastructure, ReQlo environment means ReQlo's Sandbox/Production scope. To inspect the environment of a system being changed, choose your own registered target attribute and supply its authoritative value from your backend. Identity and security-sensitive attributes must come from trusted sources.
Review the generated conditions, then select Add template rules. Existing rules and entered policy details are preserved; new rules remain editable. Missing attributes do not satisfy the generated allow conditions. Other published policies still apply, including their allow or deny rules. Save a draft, use Policies → Test a decision, and have an owner or admin publish it when ready. These editor additions require deployment of the updated dashboard.
1. Point the CLI at your sandbox
Copy the Environment ID from the API keys page in the dashboard (with Sandbox selected) into a
reqlo.config.yaml at the root of your repository:
environment: <SANDBOX_ENVIRONMENT_ID>Then sign in once with reqlo login. You can also find the ID with reqlo env list and set it with
reqlo env use <id>.
2. Write the policy
Each file is one policy. The id links the file to the policy in ReQlo. Policy IDs are unique across ReQlo, so
generate a new one for each policy and keep it:
node -e "console.log('POL_' + require('crypto').randomBytes(8).toString('hex'))"Put the printed ID in place of <YOUR_POLICY_ID> below.
id: <YOUR_POLICY_ID>
name: Document access
description: Who may read and publish workspace documents.
rules:
- id: allow-own-documents
description: Assistants may read documents the user owns.
effect: allow
actions: [documents.read]
agents: { tags: [assistant] }
subjects: { kinds: [user] }
condition: resource.attributes.owner_id == subject.id
- id: approve-external-publish
description: Publishing outside the team needs a human sign-off.
effect: require_approval
actions: [documents.publish]
condition: context.requested_visibility == "public"
approval: { expires_in_seconds: 3600 }
- id: deny-confidential
description: Agents never touch confidential documents.
effect: deny
actions: ["documents.*"]
condition: context.document_classification == "confidential"Tag your agent assistant in the dashboard (open the agent, select Edit) so the first rule applies to it.
3. Write tests for allow and deny
cases:
- name: reads own internal document
agent: { id: agt_assistant, tags: [assistant] }
subject: { id: usr_94, kind: user }
action: documents.read
resource: { type: document, id: doc_1, attributes: { owner_id: usr_94 } }
context: { document_classification: internal }
expect: allow
- name: cannot read someone else's document
agent: { id: agt_assistant, tags: [assistant] }
subject: { id: usr_94, kind: user }
action: documents.read
resource: { type: document, id: doc_2, attributes: { owner_id: usr_12 } }
context: { document_classification: internal }
expect: deny
reason_code: no_matching_policy
- name: confidential is always denied, even when owned
agent: { id: agt_assistant, tags: [assistant] }
subject: { id: usr_94, kind: user }
action: documents.read
resource: { type: document, id: doc_3, attributes: { owner_id: usr_94 } }
context: { document_classification: confidential }
expect: deny
reason_code: policy_denied
- name: public publishing needs approval
agent: { id: agt_assistant, tags: [assistant] }
subject: { id: usr_94, kind: user }
action: documents.publish
resource: { type: document, id: doc_1, attributes: { owner_id: usr_94 } }
context: { document_classification: internal, requested_visibility: public }
expect: approval_required4. Validate and test
reqlo policies validate
reqlo policies testBoth run offline with the same evaluation engine the API uses. Nothing is sent to ReQlo.
✓ reads own internal document
✓ cannot read someone else's document
✓ confidential is always denied, even when owned
✓ public publishing needs approval
4 passed, 0 failed.5. Publish to the sandbox
reqlo policies diff
reqlo policies push --publishEach publish creates a new version. If something goes wrong, see the versions and roll back (owners and admins), or use the History tab on the Policies page:
reqlo policies versions
reqlo policies rollback 2026-11-09.1How rules combine
- Rules match on action, agent, subject kind and (optionally) a condition.
- If any matching rule is
deny, the decision is deny. - Otherwise, if any is
require_approval, the decision is approval required. - Otherwise, if any is
allow, the decision is allow. - If nothing matches, the decision is deny (
no_matching_policy).
Read Policies for the full condition language and Policy as code for CI.
Something wrong or unclear? Report an issue with this page.