@mandatedev/agent 0.1.0 → 0.1.1
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.
- package/README.md +190 -0
- package/package.json +25 -25
package/README.md
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
# Mandate
|
|
2
|
+
|
|
3
|
+
**The Trust Engine for the Agent Economy**
|
|
4
|
+
|
|
5
|
+
> Move your AI agents from 20% to 70% autonomy — without trading control for chaos.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## The Problem
|
|
10
|
+
|
|
11
|
+
You built AI agents expecting 70% automation.
|
|
12
|
+
You are running at 20% because you cannot trust your agents with real permissions.
|
|
13
|
+
|
|
14
|
+
One incident happened. Your team lobotomized the agents.
|
|
15
|
+
Now they run as suggestion engines — requiring human approval for everything.
|
|
16
|
+
You spent millions building autonomous systems that are no longer autonomous.
|
|
17
|
+
|
|
18
|
+
**The gap between 20% and 70% is not an intelligence problem. It is a trust infrastructure problem.**
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## What Mandate Does
|
|
23
|
+
|
|
24
|
+
Three things. Non-negotiable on engineering quality.
|
|
25
|
+
|
|
26
|
+
**1. Hard-Scoped Permissions**
|
|
27
|
+
The agent physically cannot touch anything outside its defined boundary.
|
|
28
|
+
Not prompt-level guardrails. Not "please only do X."
|
|
29
|
+
Infrastructure-level enforcement. Deterministic. Sub-millisecond.
|
|
30
|
+
|
|
31
|
+
**2. The Real Kill Switch**
|
|
32
|
+
Cryptographic key revocation across every platform in under one second.
|
|
33
|
+
Tested continuously. Graduated 5-level response. Never a false-positive fleet halt.
|
|
34
|
+
|
|
35
|
+
**3. Unified Execution Graph**
|
|
36
|
+
One immutable, searchable, timestamped record of every decision, every tool call, every action.
|
|
37
|
+
Replaces PagerDuty + LangSmith + OpenTelemetry + Jira + 4 other tools.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Install
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npm install @mandatedev/agent
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Quickstart — OpenAI
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
import { createMandateAgent } from '@mandate/agent';
|
|
53
|
+
|
|
54
|
+
const agent = createMandateAgent({
|
|
55
|
+
agentId: 'procurement-agent-v1',
|
|
56
|
+
orgId: 'acme-corp',
|
|
57
|
+
framework: 'openai-assistants',
|
|
58
|
+
environment: 'production',
|
|
59
|
+
auditLevel: 'full',
|
|
60
|
+
policy: {
|
|
61
|
+
agentId: 'procurement-agent-v1',
|
|
62
|
+
version: '1.0.0',
|
|
63
|
+
policyHash: 'sha256-abc123',
|
|
64
|
+
identity: { org: 'acme-corp', env: 'production' },
|
|
65
|
+
allow: [
|
|
66
|
+
{ tool: 'read_*' },
|
|
67
|
+
{
|
|
68
|
+
tool: 'process_payment',
|
|
69
|
+
conditions: [
|
|
70
|
+
{ field: 'intent.args.amount', operator: 'lte', value: 10000 },
|
|
71
|
+
],
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
deny: [
|
|
75
|
+
{ tool: 'process_payment',
|
|
76
|
+
conditions: [
|
|
77
|
+
{ field: 'intent.args.amount', operator: 'gt', value: 10000 },
|
|
78
|
+
],
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
anomalyThresholds: { alert: 0.6, throttle: 0.8 },
|
|
82
|
+
localAutonomy: { gracePeriodMs: 1800000, postGrace: 'PAUSE' },
|
|
83
|
+
},
|
|
84
|
+
onViolation: (intent, result) => {
|
|
85
|
+
console.error(`[BLOCKED] ${intent.toolName} — ${result.reason}`);
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
// Intercept tool calls before execution
|
|
90
|
+
const { allowed, blocked } = await agent.openai.interceptToolCalls(
|
|
91
|
+
response.tool_calls
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
// Execute only the allowed ones
|
|
95
|
+
for (const toolCall of allowed) {
|
|
96
|
+
// run your tool
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Quickstart — LangChain
|
|
103
|
+
|
|
104
|
+
```typescript
|
|
105
|
+
const mandateHook = agent.langchain.getBeforeToolCallHook();
|
|
106
|
+
|
|
107
|
+
// Attach to your LangChain agent
|
|
108
|
+
yourLangChainAgent.beforeToolCall = mandateHook;
|
|
109
|
+
// Mandate now enforces policy on every tool call automatically
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## Quickstart — Anthropic
|
|
115
|
+
|
|
116
|
+
```typescript
|
|
117
|
+
const { allowed, blocked } = await agent.anthropic.interceptToolUse(
|
|
118
|
+
response.content.filter(b => b.type === 'tool_use')
|
|
119
|
+
);
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## How It Works
|
|
125
|
+
|
|
126
|
+
Modern agent frameworks declare intent as structured data before any tool executes.
|
|
127
|
+
Mandate intercepts that declaration and evaluates it against your policy in **0.3–0.8ms**.
|
|
128
|
+
No LLM involved in enforcement. Deterministic. Hardware-agnostic.
|
|
129
|
+
|
|
130
|
+
Agent reasons → LLM produces tool call → MANDATE INTERCEPTS
|
|
131
|
+
→ WASM policy evaluation (0.3–0.8ms)
|
|
132
|
+
→ ALLOW / DENY / ESCALATE
|
|
133
|
+
→ Audit event sealed to hash chain
|
|
134
|
+
→ Tool executes (if allowed)
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## Framework Support
|
|
139
|
+
|
|
140
|
+
| Framework | Hook | Enforcement |
|
|
141
|
+
|-----------|------|-------------|
|
|
142
|
+
| OpenAI Assistants API | `agent.openai.interceptToolCalls()` | Full |
|
|
143
|
+
| LangChain / LangGraph | `agent.langchain.getBeforeToolCallHook()` | Full |
|
|
144
|
+
| Anthropic Tool Use | `agent.anthropic.interceptToolUse()` | Full |
|
|
145
|
+
| AutoGen / AG2 | Coming Month 2 | Full |
|
|
146
|
+
| Custom frameworks | `agent.evaluate(intent)` | Full |
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## Audit Chain
|
|
151
|
+
|
|
152
|
+
Every action is sealed to a cryptographic hash chain before any network transmission.
|
|
153
|
+
The audit record exists regardless of Mandate's availability.
|
|
154
|
+
|
|
155
|
+
```typescript
|
|
156
|
+
// Verify chain integrity — any tampering is detectable
|
|
157
|
+
const { valid, corruptedAt } = agent.verifyAuditChain();
|
|
158
|
+
|
|
159
|
+
// Flush buffer to control plane
|
|
160
|
+
await agent.flushAuditBuffer();
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## Degradation
|
|
166
|
+
|
|
167
|
+
Mandate never becomes a single point of failure.
|
|
168
|
+
If the control plane is unreachable, agents continue on their last signed policy for 30 minutes.
|
|
169
|
+
|
|
170
|
+
| Tier | State | Agent Status |
|
|
171
|
+
|------|-------|-------------|
|
|
172
|
+
| NOMINAL | Full enforcement | Full capacity |
|
|
173
|
+
| DEGRADED | Local cache | Full capacity |
|
|
174
|
+
| ISOLATED | No control plane | Full capacity |
|
|
175
|
+
| GRACE_STD | 30min elapsed | Continues |
|
|
176
|
+
| GRACE_HIGH | 30min elapsed, high risk | PAUSE |
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## License
|
|
181
|
+
|
|
182
|
+
MIT — the SDK is free and open source forever.
|
|
183
|
+
The control plane, fleet management, and kill switch infrastructure are commercial products.
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## Company
|
|
188
|
+
|
|
189
|
+
Mandate is building the trust infrastructure for the agent economy.
|
|
190
|
+
[mandate.dev](https://mandate.dev) · [GitHub](https://github.com/Bieliliber/mandate)
|
package/package.json
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mandatedev/agent",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "The Mandate Agent SDK — Trust Engine for the Agent Economy",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
8
|
"exports": {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.mjs",
|
|
11
|
+
"require": "./dist/index.js",
|
|
12
|
+
"types": "./dist/index.d.ts"
|
|
13
|
+
}
|
|
14
14
|
},
|
|
15
15
|
"scripts": {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
"build": "tsup src/index.ts --format cjs,esm --dts",
|
|
17
|
+
"dev": "tsup src/index.ts --format cjs,esm --dts --watch",
|
|
18
|
+
"test": "vitest",
|
|
19
|
+
"lint": "eslint src/"
|
|
20
20
|
},
|
|
21
21
|
"keywords": [
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
"ai-agents",
|
|
23
|
+
"agent-security",
|
|
24
|
+
"trust-infrastructure",
|
|
25
|
+
"llm",
|
|
26
|
+
"langchain",
|
|
27
|
+
"openai",
|
|
28
|
+
"anthropic",
|
|
29
|
+
"mandate"
|
|
30
30
|
],
|
|
31
31
|
"license": "MIT",
|
|
32
32
|
"repository": {
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "https://github.com/Bieliliber/mandate.git"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
"typescript": "^5.4.0",
|
|
38
|
+
"tsup": "^8.0.0",
|
|
39
|
+
"vitest": "^1.6.0",
|
|
40
|
+
"@types/node": "^20.0.0"
|
|
41
41
|
}
|
|
42
|
-
|
|
42
|
+
}
|