From 1adedfe3d05a887455b46639b3936a2e1a7197e4 Mon Sep 17 00:00:00 2001 From: Amit Saxena Date: Sun, 29 Mar 2026 09:41:56 +0530 Subject: [PATCH 1/2] updated readme --- README.md | 175 +++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 146 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index b3dd6d5..6708067 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,27 @@ +# Actra +### Control what runs before it runs + [![PyPI version](https://img.shields.io/pypi/v/actra.svg)](https://pypi.org/project/actra/) [![PyPI downloads](https://img.shields.io/pypi/dm/actra)](https://pypi.org/project/actra/) +[![npm version](https://img.shields.io/npm/v/@getactra/actra.svg)](https://www.npmjs.com/package/@getactra/actra) +[![npm downloads](https://img.shields.io/npm/dm/@getactra/actra.svg)](https://www.npmjs.com/package/@getactra/actra) +[![types](https://img.shields.io/npm/types/@getactra/actra)](https://www.npmjs.com/package/@getactra/actra) +[![WebAssembly](https://img.shields.io/badge/WebAssembly-supported-purple.svg)](https://webassembly.org/) +[![Edge Runtime](https://img.shields.io/badge/Edge-ready-black.svg)](https://vercel.com/docs/functions/edge-functions) +[![Bundle size](https://img.shields.io/bundlephobia/minzip/@getactra/actra)](https://bundlephobia.com/package/@getactra/actra) +[![ESM](https://img.shields.io/badge/module-ESM-blue.svg)]() +[![Node](https://img.shields.io/badge/node-%3E%3D18-green.svg)](https://nodejs.org/) +[![Deno](https://img.shields.io/badge/Deno-supported-black.svg)](https://deno.land/) +[![Bun](https://img.shields.io/badge/Bun-supported-black.svg)](https://bun.sh/) +[![Browser](https://img.shields.io/badge/browser-supported-brightgreen.svg)]() +[![Cloudflare Workers](https://img.shields.io/badge/Cloudflare-Workers-orange.svg)](https://workers.cloudflare.com/) +[![Vercel Edge](https://img.shields.io/badge/Vercel-Edge-black.svg)](https://vercel.com/) [![License](https://img.shields.io/github/license/getactra/actra)](https://github.com/getactra/actra/blob/main/LICENSE) -# Actra -### Decision Control for Software +**Admission Control for Agentic and Automated Systems** ![Actra Policy Enforced](https://img.shields.io/badge/Actra-Policy%20Enforced-16a34a?style=flat-square) -**Admission Control for Agentic and Automated Systems** - 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 @@ -25,14 +38,14 @@ Actra protects operations in systems such as: - background workers - workflows and schedulers - +**WASM Runtimes:** Wasmtime • Wasmer --- @@ -40,6 +53,14 @@ Python • JavaScript • CLI ![MCP Demo](doc/mcp-demo.gif) +## Try in 30 seconds + +Run Actra directly in your browser: + +👉 https://actra.dev/playground.html + +No setup required. Uses the real WASM engine. + ### An AI agent attempted to call an MCP tool. Actra evaluated policy and **blocked the unsafe operation before execution**. @@ -116,6 +137,104 @@ Actra evaluates the policy **before the function executes** and blocks refunds g --- +## JavaScript Example + + +```javascript +import { Actra, ActraRuntime, ActraPolicyError } from "@getactra/actra"; + +// 1. Schema +const schema = ` +version: 1 + +actions: + refund: + fields: + amount: number + +actor: + fields: + role: string + +snapshot: + fields: + fraud_flag: boolean +`; + +// 2. Policy +const policyYaml = ` +version: 1 + +rules: + - id: block_large_refund + scope: + action: refund + when: + subject: + domain: action + field: amount + operator: greater_than + value: + literal: 1000 + effect: block +`; + +// 3. Compile +const policy = await Actra.fromStrings(schema, policyYaml); + +// 4. Runtime +const runtime = new ActraRuntime(policy); + +// 5. Context resolvers +runtime.setActorResolver(() => ({ role: "support" })); +runtime.setSnapshotResolver(() => ({ fraud_flag: false })); + +// 6. Protect function +function refund(amount) { + console.log("Refund executed:", amount); +} + +const protectedRefund = runtime.admit("refund", refund); + +// 7. Execute +await protectedRefund(200); // allowed + +try { + await protectedRefund(1500); // blocked +} catch (e) { + if (e instanceof ActraPolicyError) { + console.log("Blocked by policy:", e.matchedRule); + } +} +``` + +## Python Example + +```python +from actra import Actra, ActraPolicyError +from actra.runtime import ActraRuntime + +schema = """...""" +policy_yaml = """...""" + +policy = Actra.from_strings(schema, policy_yaml) +runtime = ActraRuntime(policy) + +runtime.set_actor_resolver(lambda ctx: {"role": "support"}) +runtime.set_snapshot_resolver(lambda ctx: {"fraud_flag": False}) + +@runtime.admit() +def refund(amount: int): + print("Refund executed:", amount) + +refund(200) + +try: + refund(1500) +except ActraPolicyError as e: + print("Blocked by policy:", e.matched_rule) +``` + ## Key Concepts Actra evaluates policies using a small set of core concepts. @@ -164,7 +283,7 @@ Governance policies operate **above normal admission policies**, providing a control layer that validates policies themselves before they are accepted. -## Installation +## Installation Python ```bash pip install actra @@ -172,6 +291,14 @@ pip install actra See the **examples/** directory for quick start examples. +## Installation JavaScript + +Install: + +```bash +npm install @getactra/actra +``` + --- ## Architecture @@ -253,23 +380,23 @@ Actra runs across **server, edge, and browser environments**. | ---------------------- | ------------------- | | Rust Core Engine | Available (Publishing Pending) | | Python SDK | Available | -| JavaScript Runtime SDK | WIP | -| JavaScript Browser SDK | WIP | +| JavaScript Runtime SDK | Available | +| JavaScript Browser SDK | Available | | 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 | +| Node.js | Available | +| Bun | Available | +| Cloudflare Workers | Available | +| AWS Lambda | Available | +| Web Browsers | Available | +| Deno | Available | +| Fastly Compute@Edge | Available | +| Vercel Edge Runtime | Available | +| Netlify Edge Functions | Available | ### Native WebAssembly Runtime Targets @@ -324,17 +451,7 @@ Actra also supports **governance policies**, which validate operational policies ## Documentation -Full documentation coming soon. - -Refer to the **examples** folder for detailed usage examples. - -Planned documentation sections: - -* policy language -* MCP integration -* agent safety -* runtime architecture -* advanced policy patterns +Full documentation available at https://docs.actra.com --- From ab4836354496e23f2c06ba8fa1e2301c2f2c9dc4 Mon Sep 17 00:00:00 2001 From: Amit Saxena Date: Sun, 29 Mar 2026 09:44:13 +0530 Subject: [PATCH 2/2] updated readme --- CHANGELOG.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f3fd55..11b89a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ -### v0.7.5 - 28 March 2026 +### v0.7.7 - 28 March 2026 - browser load js sdk bug fix + +### v0.7.6 - 28 March 2026 +- publish js sdk to npm + +### v0.7.5 - 28 March 2026 +- publish js sdk to npm ### v0.7.4 - 28 March 2026 - publish js sdk to npm