Skip to content

Repository files navigation

Actra

Control what runs before it runs

PyPI versionPyPI downloadsnpm versionnpm downloadstypesWebAssemblyEdge RuntimeBundle sizeESMNodeDenoBunBrowserCloudflare WorkersActra ClaudeVercel EdgeLicense

Admission Control for Agentic and Automated Systems

Actra Policy Enforced

Actra introduces Decision Control — a runtime layer that evaluates policies before operations execute.

It allows systems to permit or block actions safely, preventing unsafe operations triggered by AI agents, APIs & automation systems

Instead of embedding control logic directly in application code, Actra evaluates external policies before state-changing actions run.

Where Actra applies

Actra protects operations in systems such as:

  • AI agents
  • APIs and services
  • automation pipelines
  • background workers
  • workflows and schedulers

Runs Everywhere

SDKs

Python • JavaScript • CLI

Server: Node • Bun • Deno Edge: Cloudflare Workers • AWS Lambda • Vercel Edge • Netlify Edge • Fastly Compute@Edge Browser: Web Browsers WASM Runtimes: Wasmtime • Wasmer


See Actra in Action

MCP Demo

An AI agent attempted to call an MCP tool.

Actra evaluated policy and blocked the unsafe operation before execution.

Try in 30 seconds

Run Actra directly in your browser:

👉 https://actra.dev/playground.html

No setup required. Uses the real WASM engine.


Generate Policies with Claude (AI-assisted)

Actra provides a Claude Skill to help you generate:

  • policy YAML
  • schema definitions
  • governance rules
  • real-world policy patterns

What it can do

  • Convert natural language to Actra policies
  • Suggest safe policy patterns
  • Generate test sample payload

Example prompts

Generate a policy to block refunds above 5000 for non-admin users
Create a governance policy that ensures all delete actions require approval

Use the Claude Skill

Install Claude Skill


Why Actra?

Modern systems increasingly perform actions automatically:

  • AI agents calling tools
  • workflow automation
  • API integrations
  • background jobs

These systems can trigger powerful state-changing operations, such as:

  • issuing refunds
  • deleting resources
  • sending payments
  • modifying infrastructure

Today these controls often live inside application code:

ifamount>1000:
raiseException("Refund too large")

This creates problems:

  • rules duplicated across services
  • difficult to audit behavior
  • policy changes require redeploys
  • automation becomes risky

Actra moves these decisions into deterministic external policies evaluated before actions execute.


20-Second Example

@actra.admit()defrefund(amount):
...

The rule lives in policy:

rules:
- id: block_large_refundscope:
action: refundwhen:
subject:
domain: actionfield: amountoperator: greater_thanvalue:
literal: 1000effect: block

Result:

refund(200) -> allowed refund(1500) -> blocked by policy

Actra evaluates the policy before the function executes and blocks refunds greater than 1000.


JavaScript Example

import{Actra,ActraRuntime,ActraPolicyError}from"@getactra/actra";// 1. Schemaconstschema=`version: 1actions: refund: fields: amount: numberactor: fields: role: stringsnapshot: fields: fraud_flag: boolean`;// 2. PolicyconstpolicyYaml=`version: 1rules: - id: block_large_refund scope: action: refund when: subject: domain: action field: amount operator: greater_than value: literal: 1000 effect: block`;// 3. Compileconstpolicy=awaitActra.fromStrings(schema,policyYaml);// 4. Runtimeconstruntime=newActraRuntime(policy);// 5. Context resolversruntime.setActorResolver(()=>({role: "support"}));runtime.setSnapshotResolver(()=>({fraud_flag: false}));// 6. Protect functionfunctionrefund(amount){console.log("Refund executed:",amount);}constprotectedRefund=runtime.admit("refund",refund);// 7. ExecuteawaitprotectedRefund(200);// allowedtry{awaitprotectedRefund(1500);// blocked}catch(e){if(einstanceofActraPolicyError){console.log("Blocked by policy:",e.matchedRule);}}

Python Example

fromactraimportActra, ActraPolicyErrorfromactra.runtimeimportActraRuntimeschema="""..."""policy_yaml="""..."""policy=Actra.from_strings(schema, policy_yaml)
runtime=ActraRuntime(policy)
runtime.set_actor_resolver(lambdactx: {"role": "support"})
runtime.set_snapshot_resolver(lambdactx: {"fraud_flag": False})
@runtime.admit()defrefund(amount: int):
print("Refund executed:", amount)
refund(200)
try:
refund(1500)
exceptActraPolicyErrorase:
print("Blocked by policy:", e.matched_rule)

Key Concepts

Actra evaluates policies using a small set of core concepts.

Action
The operation being requested.
Example: refund, delete_user, deploy_service.

Actor
The identity performing the action (user, service, or agent).

Snapshot
External system state used during evaluation.
Example: account status, fraud flags, environment.

Policy
Rules that determine whether an action should be allowed or blocked.

Governance
Optional policies that control how operational policies themselves can be defined or modified.

Admission Control
Actra evaluates policies before the action executes, allowing or blocking the operation.


Governance

Actra optionally supports governance policies.

Governance policies validate operational policies at compile time, ensuring that critical safety rules cannot be removed or weakened.

Governance can enforce constraints such as:

  • requiring specific safety rules to exist
  • preventing unsafe rule patterns
  • limiting the number of certain rule types
  • restricting which fields policies may reference
  • applying constraints only to specific actions

This allows platform or security teams to enforce organization-wide policy standards across services.

Governance policies operate above normal admission policies, providing a control layer that validates policies themselves before they are accepted.

Installation Python

pip install actra

See the examples/ directory for quick start examples.

Installation JavaScript

Install:

npm install @getactra/actra

Architecture

Actra evaluates policies before operations execute.

flowchart LR
subgraph Governance Layer
G[Governance Policies]
end
subgraph Policy Layer
S[Schema]
P[Operational Policies]
end
subgraph Runtime Layer
A[Application / Agent / API]
C[Actra Admission Control]
R[Runtime Context]
end
A --> C
R --> C
S --> C
P --> C
G --> P
C --> D{Decision}
D -->|Allow| E[Execute Operation]
D -->|Block| F[Operation Prevented]
Loading

Schema defines the structure of actions, actors, and snapshots used during policy evaluation.


Example Use Cases

Actra can control many automated operations.

AI Agents

  • restrict tool execution
  • prevent critical infrastructure changes
  • enforce safety policies

APIs

  • block large refunds
  • prevent destructive operations
  • enforce safety checks

Automation

  • enforce workflow rules
  • restrict financial operations
  • require approval thresholds

Infrastructure

  • prevent destructive changes
  • enforce safe deployment policies

Actra Platform Support

Actra runs across server, edge, and browser environments.

SDKs and Engines.

SDK/EngineStatus
Rust Core EngineAvailable (Publishing Pending)
Python SDKAvailable
JavaScript Runtime SDKAvailable
JavaScript Browser SDKAvailable
Go SDKPlanned

JavaScript Runtime Compatibility

RuntimeStatus
Node.jsAvailable
BunAvailable
Cloudflare WorkersAvailable
AWS LambdaAvailable
Web BrowsersAvailable
DenoAvailable
Fastly Compute@EdgeAvailable
Vercel Edge RuntimeAvailable
Netlify Edge FunctionsAvailable

Native WebAssembly Runtime Targets

RuntimeStatus
WasmtimePlanned
WasmerPlanned

Actra vs OPA vs Cedar

FeatureActraOPACedar
Primary purposeDecision control for operationsGeneral policy engineAuthorization policy language
Evaluation timingBefore executing actionsUsually request-time decisionsAuthorization decisions
Integration modelFunction / action enforcementAPI / sidecar / middlewareService authorization
Policy styleStructured YAML rulesRego languageCedar language
Governance supportBuilt-in policy governanceExternal toolingLimited
Determinism focusStrongModerateStrong
Target systemsAgents, automation, APIsInfrastructure, KubernetesApplication authorization
Typical use caseControl automated operationsPolicy enforcement in infraAccess control

Positioning

Actra focuses on controlling actions before they execute, especially in automated or agent-driven systems.

OPA and Cedar focus primarily on authorization decisions, such as:

  • “Can user X access resource Y?”

Actra focuses on admission control for mutations, such as:

  • Should this refund execute?
  • Should an agent run this tool?
  • Should this workflow step proceed?

Actra also supports governance policies, which validate operational policies at compile time to ensure safety rules cannot be removed or weakened.

Example Scenarios

ScenarioBest Tool
Can a user access a document?Cedar
Can a service access an API?OPA
Should an automated system execute an operation?Actra
Should policies themselves follow safety standards?Actra

Documentation

Full documentation available at https://docs.actra.dev


License

Apache 2.0

About

Actra - control what runs before it runs, controls what actions are allowed before they execute. Evaluate policies across APIs, workflows and AI agents in real time.

Topics

Resources

Contributing

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages