Skip to main content

Policies

Policies are the core of Sequenceware. They define rules that match tool calls by any combination of fields and enforce actions automatically.

How policies work

When an agent makes a tool call, Sequenceware evaluates it against all enabled policies:

Tool call received → Match against all policies → Apply strictest action

Strictest-action-wins: when multiple policies match, the most restrictive action applies.

block > require_approval > warn > allow

Policy actions

ActionBehaviorUse case
allowTool call proceeds normallyExplicitly allow known-safe operations
warnTool call proceeds, risk flagged in dashboardMonitor without blocking
blockTool call is immediately rejectedPrevent dangerous operations
require_approvalTool call pauses until a human approvesCritical operations needing review

Match conditions

Each policy has one or more match conditions. All conditions must match for the policy to trigger (AND logic).

Fields

You can match on any field in the tool call event:

FieldDescriptionExample value
toolNameName of the tool being calledcreate_pull_request
agentIdID of the agentclaude-code-maria
inputPayload.*Any field in the tool's inputinputPayload.environment
metadata.*Any metadata fieldmetadata.branch
actionHintSemantic action hintdeploy, pr_merge

Operators

OperatorDescriptionExample
equalsExact matchtoolName equals "deploy"
not_equalsNot equalagentId not_equals "admin-agent"
containsSubstring matchtoolName contains "delete"
matchesRegex matchinputPayload.query matches "(DROP|TRUNCATE)"
inValue in listinputPayload.environment in ["production", "prod"]
not_inValue not in listagentId not_in ["trusted-agent"]
existsField existsinputPayload.password exists
gt / lt / gte / lteNumeric comparisoninputPayload.amount gt 1000

Default policies

Sequenceware ships with sensible defaults that are created on first boot:

PolicyMatchesAction
Sensitive Files Gate.env, credentials, secrets, .pemrequire_approval
Deployment GateDeploy actions to productionrequire_approval
Destructive Script Blockrm -rf, DROP TABLE, destructive commandsblock
Main Branch ProtectionDirect pushes/merges to main/masterrequire_approval

Creating policies

Via the dashboard

  1. Navigate to Policies > Create Policy
  2. Add match conditions
  3. Select the action
  4. Enable the policy

Via the API

curl -X POST http://localhost:3000/v1/policies \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Block prod database writes",
"description": "Prevent agents from writing to production databases",
"matchConditions": [
{ "field": "toolName", "operator": "equals", "value": "db_query" },
{ "field": "inputPayload.environment", "operator": "equals", "value": "production" },
{ "field": "inputPayload.operation", "operator": "in", "value": ["INSERT", "UPDATE", "DELETE"] }
],
"action": "block",
"enabled": true
}'

Via the SDK

await client.createPolicy({
name: 'Block prod database writes',
description: 'Prevent agents from writing to production databases',
matchConditions: [
{ field: 'toolName', operator: 'equals', value: 'db_query' },
{ field: 'inputPayload.environment', operator: 'equals', value: 'production' },
],
action: 'block',
enabled: true,
});

Policy simulation

Test policies before enabling them using the policy simulator:

curl -X POST http://localhost:3000/v1/policies/simulate \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"toolName": "deploy",
"inputPayload": {
"environment": "production",
"service": "api"
}
}'

The simulator returns which policies would match and what action would be taken — without affecting any real agent.

Rate limiting

Policies can include rate limits to control how frequently agents can use specific tools:

{
"name": "Rate limit API writes",
"matchConditions": [
{ "field": "toolName", "operator": "matches", "value": "(create_|update_|delete_)" }
],
"action": "block",
"rateLimit": {
"maxCalls": 50,
"windowMinutes": 60,
"scope": "per-agent"
}
}

Rate limit scopes:

  • per-agent — limit applies to each agent individually
  • per-tool — limit applies to each tool across all agents
  • per-org — limit applies organization-wide

Policy versioning

Policies are automatically versioned. Every update increments the version number and preserves the previous state. This gives you a full history of how a policy evolved over time.

Each policy includes:

  • version — auto-incremented integer starting at 1
  • updatedAt — timestamp of the last modification

View the full version history of any policy:

curl http://localhost:3000/v1/policies/pol_abc123/versions \
-H "Authorization: Bearer $TOKEN"

This is useful for:

  • Auditing — understanding why a policy changed and who changed it
  • Debugging — identifying when a policy change caused unexpected behavior
  • Compliance — maintaining a record of governance rule evolution

Policy presets

Sequenceware includes preset policies grouped by category that you can enable with one click from the dashboard. View available presets at GET /v1/policy-presets.