@runplane/runplane-sdk 1.1.2 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +107 -52
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,83 +1,122 @@
1
1
  # @runplane/runplane-sdk
2
2
 
3
- Official SDK for the Runplane control plane runtime governance for AI agent actions.
3
+ Control what your AI agents are allowed to do in real time.
4
4
 
5
5
  Runplane sits between your AI agents and execution. Every action passes through `guard()`, which enforces a decision before your code runs.
6
6
 
7
- ## Installation
7
+ ---
8
+
9
+ ## 🚀 Start in 2 Minutes
10
+
11
+ ### 1. Install the SDK
8
12
 
9
13
  ```bash
10
14
  npm install @runplane/runplane-sdk
11
15
  ```
12
16
 
13
- ## Quick Start (CommonJS)
17
+ ---
18
+
19
+ ### 2. Get your API key (Free 14-day trial)
20
+
21
+ 👉 https://runplane.ai/
22
+
23
+ Create your account and copy your API key.
24
+
25
+ ⚠️ **Important:** The SDK will not work without a valid API key.
26
+
27
+ ---
28
+
29
+ ### 3. Run your first protected action
14
30
 
15
31
  ```javascript
16
32
  require("dotenv").config()
17
- const { Runplane } = require("@runplain/runplane-sdk");
33
+ const { Runplane } = require("@runplane/runplane-sdk")
34
+
18
35
  const runplane = new Runplane({
19
36
  apiKey: process.env.RUNPLANE_API_KEY,
20
37
  })
21
38
 
22
- // guard() intercepts execution and enforces the decision
23
- await runplane.guard(
24
- "transfer_funds",
25
- "finance-system",
26
- { fromAccountId: "acc_1", toAccountId: "acc_2", amount: 400 },
27
- async () => {
28
- return await executeTransfer()
29
- }
30
- )
39
+ async function main() {
40
+ await runplane.guard(
41
+ "transfer_funds",
42
+ "finance-system",
43
+ { fromAccountId: "acc_1", toAccountId: "acc_2", amount: 400 },
44
+ async () => {
45
+ return await executeTransfer()
46
+ }
47
+ )
48
+ }
49
+
50
+ main()
31
51
  ```
32
52
 
33
- ## How It Works
53
+ ---
54
+
55
+ ## 💡 What Runplane Does
56
+
57
+ Runplane gives you **real-time control over AI agent actions**.
58
+
59
+ Before any action runs, Runplane evaluates:
60
+
61
+ * Policies
62
+ * Risk
63
+ * Context
34
64
 
35
- `guard()` calls the Runplane API over the network before executing your handler:
65
+ And returns a decision:
66
+
67
+ * **ALLOW** → execution continues
68
+ * **BLOCK** → action is stopped
69
+ * **REQUIRE_APPROVAL** → human approval required
70
+
71
+ ---
72
+
73
+ ## ⚙️ How It Works
74
+
75
+ `guard()` calls the Runplane API before executing your handler:
36
76
 
37
77
  1. Sends action + target + context to Runplane
38
78
  2. Runplane evaluates policies and risk
39
- 3. Returns one of three decisions:
40
- - **ALLOW** → handler executes immediately
41
- - **BLOCK** → throws `RunplaneError`, handler never runs
42
- - **REQUIRE_APPROVAL** → throws `RunplaneError`, awaits human decision
79
+ 3. Returns a decision:
43
80
 
44
- ## API Reference
81
+ * **ALLOW** → handler executes
82
+ * **BLOCK** → throws `RunplaneError`
83
+ * **REQUIRE_APPROVAL** → throws `RunplaneError` and waits for approval
45
84
 
46
- ### `new Runplane(config)`
85
+ ---
47
86
 
48
- Create a new Runplane client.
87
+ ## 📘 API Reference
88
+
89
+ ### `new Runplane(config)`
49
90
 
50
91
  ```javascript
51
92
  const runplane = new Runplane({
52
- apiKey: "your_api_key", // Required
53
- baseUrl: "https://runplane.ai", // Optional, defaults to https://runplane.ai
93
+ apiKey: "your_api_key",
94
+ baseUrl: "https://runplane.ai",
54
95
  })
55
96
  ```
56
97
 
57
- ### `guard(action, target, context, handler)`
98
+ ---
58
99
 
59
- The primary integration method. Wraps your action with Runplane enforcement.
100
+ ### `guard(action, target, context, handler)`
60
101
 
61
102
  ```javascript
62
103
  const result = await runplane.guard(
63
- "delete_record", // action type
64
- "hr_system", // target resource
65
- { employeeId: "emp_123" }, // context
104
+ "delete_record",
105
+ "hr_system",
106
+ { employeeId: "emp_123" },
66
107
  async () => {
67
- // Your code here - only runs if ALLOW
68
108
  return await deleteEmployee("emp_123")
69
109
  }
70
110
  )
71
111
  ```
72
112
 
73
- **Returns:** The result of `handler()` if decision is ALLOW.
113
+ **Returns:** handler result if ALLOW
114
+ **Throws:** `RunplaneError` if BLOCK or REQUIRE_APPROVAL
74
115
 
75
- **Throws:** `RunplaneError` if decision is BLOCK or REQUIRE_APPROVAL.
116
+ ---
76
117
 
77
118
  ### `decide(payload)`
78
119
 
79
- Low-level method to request a decision without automatic enforcement.
80
-
81
120
  ```javascript
82
121
  const result = await runplane.decide({
83
122
  action: "send_email",
@@ -85,17 +124,19 @@ const result = await runplane.decide({
85
124
  context: { recipients: 1200 },
86
125
  })
87
126
 
88
- console.log(result.decision) // "ALLOW" | "BLOCK" | "REQUIRE_APPROVAL"
127
+ console.log(result.decision)
89
128
  ```
90
129
 
91
- ## Handling Decisions
130
+ ---
131
+
132
+ ## 🧠 Handling Decisions
92
133
 
93
134
  ```javascript
94
135
  const { Runplane, RunplaneError } = require("@runplane/runplane-sdk")
95
136
 
96
137
  try {
97
138
  await runplane.guard("action", "target", {}, async () => {
98
- // ...
139
+ // your code
99
140
  })
100
141
  } catch (err) {
101
142
  if (err instanceof RunplaneError) {
@@ -109,36 +150,50 @@ try {
109
150
  }
110
151
  ```
111
152
 
112
- ## Decision Types
153
+ ---
154
+
155
+ ## 📊 Decision Types
113
156
 
114
- | Decision | Behavior |
115
- |----------|----------|
116
- | `ALLOW` | Handler executes immediately, result returned |
117
- | `BLOCK` | Throws `RunplaneError` with code `"BLOCK"` |
118
- | `REQUIRE_APPROVAL` | Throws `RunplaneError` with code `"REQUIRE_APPROVAL"` |
157
+ | Decision | Behavior |
158
+ | ------------------ | ---------------------------- |
159
+ | `ALLOW` | Handler executes immediately |
160
+ | `BLOCK` | Throws `RunplaneError` |
161
+ | `REQUIRE_APPROVAL` | Requires human approval |
119
162
 
120
- ## Error Object
163
+ ---
121
164
 
122
- When `guard()` throws, the error includes:
165
+ ## Error Object
123
166
 
124
167
  ```javascript
125
168
  {
126
169
  message: "Runplane blocked this action",
127
- code: "BLOCK", // "BLOCK" | "REQUIRE_APPROVAL" | "API_ERROR"
128
- runplane: { // Full decision response
170
+ code: "BLOCK",
171
+ runplane: {
129
172
  decision: "BLOCK",
130
- reason: "Policy: destructive action on production database",
173
+ reason: "Policy violation",
131
174
  requestId: "req_abc123",
132
175
  riskScore: 91,
133
176
  }
134
177
  }
135
178
  ```
136
179
 
137
- ## Requirements
180
+ ---
181
+
182
+ ## ⚠️ Requirements
183
+
184
+ * Node.js 18+
185
+ * Runplane API key 👉 https://runplane.ai/
186
+ * Internet access
187
+
188
+ ---
189
+
190
+ ## 💬 Feedback
191
+
192
+ Got stuck? Something unclear? Want to suggest improvements?
193
+
194
+ 👉 https://runplane.ai/
138
195
 
139
- - Node.js 18+
140
- - Valid Runplane API key
141
- - Network access to `https://runplane.ai`
196
+ ---
142
197
 
143
198
  ## License
144
199
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runplane/runplane-sdk",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "Runtime governance SDK for AI agent actions. Wrap sensitive operations with guard() to enforce ALLOW, BLOCK, or REQUIRE_APPROVAL decisions before execution.",
5
5
  "main": "./dist/index.js",
6
6
  "exports": {
@@ -37,7 +37,7 @@
37
37
  "license": "MIT",
38
38
  "repository": {
39
39
  "type": "git",
40
- "url": "https://github.com/runplane/sdk.git"
40
+ "url": "git+https://github.com/runplane/sdk.git"
41
41
  },
42
42
  "homepage": "https://runplane.ai/developer",
43
43
  "bugs": {