Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,7 @@ venv_test
wheelhouse
____*/
____*
bindings/wasm/pkg/
bindings/wasm/pkg/
sdk/js/server/pkg/
sdk/js/server/dist/
sdk/js/web/pkg/
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ members = [
resolver = "2"

[workspace.package]
version = "0.5.1"
version = "0.6.0"
edition = "2021"
license = "Apache-2.0"
authors = ["Amit Saxena"]
Expand Down
79 changes: 57 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,44 @@
[![License](https://img.shields.io/github/license/getactra/actra)](https://github.com/getactra/actra/blob/main/LICENSE)

# Actra
Decision Control
### Decision Control for Software

**Admission Control for Agentic & Automated Systems**
![Actra Policy Enforced](https://img.shields.io/badge/Actra-Policy%20Enforced-16a34a?style=flat-square)

Evaluate decisions before operations execute.
Prevent unsafe actions and enforce safe policies across APIs, services, automation pipelines, and AI agents.
**Admission Control for Agentic and Automated Systems**

Actra evaluates policies **before operations execute**, allowing or blocking actions triggered by APIs, automation systems, or AI agents.
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

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

* AI agents
* APIs
* automation systems
* background workers
* workflows
## Where Actra applies

Instead of embedding control logic in application code, Actra evaluates **external policies** before state-changing actions run.
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](doc/mcp-demo.gif)

An AI agent attempted to call an MCP tool.
### An AI agent attempted to call an MCP tool.

Actra evaluated policy and **blocked the unsafe operation before execution**.

Expand Down Expand Up @@ -232,17 +243,41 @@ Actra can control many automated operations.

---

## SDKs
## Actra Platform Support

Actra runs across **server, edge, and browser environments**.

### SDKs and Engines.

| SDK/Engine | Status |
| ---------------------- | ------------------- |
| Rust Core Engine | Available (Publishing Pending) |
| Python SDK | Available |
| JavaScript Runtime SDK | WIP |
| JavaScript Browser SDK | WIP |
| Go SDK | Planned |

### JavaScript Runtime Compatibility

| Runtime | Status |
| ------------------ | --------|
| Node.js | WIP |
| Bun | WIP |
| Cloudflare Workers | WIP |
| AWS Lambda | WIP |
| Web Browsers | WIP |
| Deno | WIP |
| Fastly Compute@Edge | WIP |
| Vercel Edge Runtime | WIP |
| Netlify Edge Functions | WIP |

### Native WebAssembly Runtime Targets

Actra supports multiple runtimes.
| Runtime | Status |
| -------- | ------- |
| Wasmtime | Planned |
| Wasmer | Planned |

| Runtime | Status |
| ------- | ------------ |
| Python | Available |
| Node.js | WIP |
| Rust | Core runtime |
| WASM | Planned |
| Go | Planned |

---

Expand Down
9 changes: 6 additions & 3 deletions bindings/wasm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pub struct JsEvaluationOutput {
///
/// The compiled policy is stored internally.
/// Evaluation operations are pure and deterministic.
#[wasm_bindgen]
#[wasm_bindgen (js_name = Actra)]
pub struct Actra {
compiled_policy: CompiledPolicy,
}
Expand Down Expand Up @@ -132,8 +132,11 @@ impl Actra {
#[wasm_bindgen]
pub fn evaluate(&self, input: JsValue) -> Result<JsValue, JsValue> {

let js_input: JsEvaluationInput =
from_value(input)?;
let js_input: JsEvaluationInput =
from_value(input).map_err(|e| JsValue::from_str(&format!(
"Invalid evaluation input: {}",
e
)))?;

let eval_input = EvaluationInput {
action: js_input.action,
Expand Down
1 change: 1 addition & 0 deletions core/src/ir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ pub enum ValueRef {
///
/// These correspond to validated schema field types.
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ScalarValue {
String(String),
Number(f64),
Expand Down
11 changes: 8 additions & 3 deletions scripts/wasm_pack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ cargo install wasm-pack
# 1. Browser build
wasm-pack build bindings/wasm --target web --out-dir pkg/web --release

# 2. Node build
wasm-pack build bindings/wasm --target nodejs --out-dir pkg/all --release
# 2. Server build
wasm-pack build bindings/wasm --target nodejs --out-dir pkg/server --release

# cargo install wasm-opt

Expand All @@ -50,4 +50,9 @@ wasm-opt -Oz \
--strip-producers \
-o bindings/wasm/pkg/web/actra_wasm_bg.wasm \
bindings/wasm/pkg/web/actra_wasm_bg.wasm


cd sdk/js
npm install
npm run build

#Publish
117 changes: 117 additions & 0 deletions sdk/go/sdk-blueprint.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
// v1
package actra

import "time"

// Types
type Action map[string]interface{}
type Actor map[string]interface{}
type Snapshot map[string]interface{}
type Decision map[string]interface{}
type Context interface{}
type EvaluationContext map[string]interface{}
type ActionInput struct {
Action Action
Actor Actor
Snapshot Snapshot
}

// Resolver Types
type ActionBuilder func(actionType string, args []interface{}, kwargs map[string]interface{}, ctx Context) Action
type ActorResolver func(ctx Context) Actor
type SnapshotResolver func(ctx Context) Snapshot
type ActionResolver func(actionType string, args []interface{}, kwargs map[string]interface{}, ctx Context) Action
type ContextResolver func(args []interface{}, kwargs map[string]interface{}) Context
type ActionTypeResolver func(fn interface{}, args []interface{}, kwargs map[string]interface{}) string

// Errors
type ActraError struct{ Msg string }
type ActraPolicyError struct {
ActraError
Decision Decision
Context EvaluationContext
MatchedRule string
}
type ActraSchemaError struct{ ActraError }

// Decision Event
type DecisionEvent struct {
Action Action
Decision Decision
Context EvaluationContext
Timestamp time.Time
DurationMs float64
}

func (e *DecisionEvent) Effect() string { return e.Decision["effect"].(string) }
func (e *DecisionEvent) MatchedRule() string { return e.Decision["matched_rule"].(string) }
func (e *DecisionEvent) IsBlocked() bool { return e.Effect() == "block" }
func (e *DecisionEvent) ActionType() string { return e.Action["type"].(string) }

// Policy
type Policy struct{}

func (p *Policy) Evaluate(ctx ActionInput) Decision { return Decision{} }
func (p *Policy) EvaluateAction(action Action, actor Actor, snapshot Snapshot) Decision {
return Decision{}
}
func (p *Policy) Explain(ctx ActionInput) Decision { return Decision{} }
func (p *Policy) PolicyHash() string { return "" }
func (p *Policy) AssertEffect(ctx ActionInput, expected string) Decision { return Decision{} }

// Actra Loader
type Actra struct{}

func (a *Actra) FromStrings(schemaYaml, policyYaml string, governanceYaml ...string) *Policy {
return &Policy{}
}
func (a *Actra) FromFiles(schemaPath, policyPath string, governancePath ...string) *Policy {
return &Policy{}
}
func (a *Actra) FromDirectory(directory string) *Policy { return &Policy{} }
func (a *Actra) CompilerVersion() string { return "0.0.0" }

// Runtime
type ActraRuntime struct {
Policy *Policy
ActorResolver ActorResolver
SnapshotResolver SnapshotResolver
ActionResolver ActionResolver
ContextResolver ContextResolver
ActionTypeResolver ActionTypeResolver
}

func (r *ActraRuntime) SetActorResolver(fn ActorResolver) {}
func (r *ActraRuntime) SetSnapshotResolver(fn SnapshotResolver) {}
func (r *ActraRuntime) SetActionResolver(fn ActionResolver) {}
func (r *ActraRuntime) SetContextResolver(fn ContextResolver) {}
func (r *ActraRuntime) SetActionTypeResolver(fn ActionTypeResolver) {}
func (r *ActraRuntime) Allow(actionType string, ctx Context, fields map[string]interface{}) bool {
return true
}
func (r *ActraRuntime) Block(actionType string, ctx Context, fields map[string]interface{}) bool {
return false
}
func (r *ActraRuntime) Action(actionType string, fields map[string]interface{}) Action {
return Action{"type": actionType}
}
func (r *ActraRuntime) BuildAction(actionType string, args []interface{}, kwargs map[string]interface{}, ctx Context) Action {
return Action{"type": actionType}
}
func (r *ActraRuntime) BuildContext(action Action, ctx Context) EvaluationContext {
return EvaluationContext{}
}
func (r *ActraRuntime) Evaluate(action Action, ctx Context) Decision { return Decision{} }
func (r *ActraRuntime) Explain(action Action, ctx Context) Decision { return Decision{} }
func (r *ActraRuntime) Admit(actionType string, fields []string, builder ActionBuilder, fn func()) {
fn()
}
func (r *ActraRuntime) Audit(actionType string, fields []string, builder ActionBuilder, fn func()) {
fn()
}

// Aliases
var LoadPolicyFromFile = Actra{}.FromFiles
var LoadPolicyFromString = Actra{}.FromStrings
var CompilerVersion = Actra{}.CompilerVersion
var Version = "0.0.0"
10 changes: 10 additions & 0 deletions sdk/js/common/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "@actra/common",
"version": "0.1.0",
"private": true,
"description": "Shared common utilities for Actra JavaScript SDKs",
"type": "module",
"main": "src/index.ts",
"types": "src/index.ts",
"sideEffects": false
}
Loading
Loading