agentid-sdk 0.1.19 → 0.1.20
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 +33 -4
- package/dist/chunk-LOZUJLLF.mjs +3222 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +41 -9
- package/dist/index.mjs +10 -2761
- package/dist/{langchain-DJDqqpbT.d.mts → langchain-BipmisU1.d.mts} +7 -1
- package/dist/{langchain-DJDqqpbT.d.ts → langchain-BipmisU1.d.ts} +7 -1
- package/dist/langchain.d.mts +1 -1
- package/dist/langchain.d.ts +1 -1
- package/dist/langchain.js +190 -2
- package/dist/langchain.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-6YR4ECGB.mjs +0 -424
package/README.md
CHANGED
|
@@ -9,6 +9,23 @@
|
|
|
9
9
|
|
|
10
10
|
`agentid-sdk` is the official Node.js/TypeScript SDK for AgentID, an AI security and compliance System of Record. It allows you to gate LLM traffic through guard checks, enforce policy before execution, and capture durable telemetry for audit and governance workflows.
|
|
11
11
|
|
|
12
|
+
### The Mental Model
|
|
13
|
+
|
|
14
|
+
AgentID sits between your application and the LLM runtime:
|
|
15
|
+
|
|
16
|
+
```text
|
|
17
|
+
User Input -> guard() -> [AgentID Policy] -> verdict
|
|
18
|
+
| allowed
|
|
19
|
+
v
|
|
20
|
+
LLM Provider
|
|
21
|
+
v
|
|
22
|
+
log() -> [Immutable Ledger]
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
- `guard()`: evaluates prompt and context before model execution.
|
|
26
|
+
- Model call: executes only if guard verdict is allowed.
|
|
27
|
+
- `log()`: persists immutable telemetry (prompt, output, latency) for audit and compliance.
|
|
28
|
+
|
|
12
29
|
## 2. Installation
|
|
13
30
|
|
|
14
31
|
```bash
|
|
@@ -30,6 +47,12 @@ export AGENTID_SYSTEM_ID="00000000-0000-0000-0000-000000000000"
|
|
|
30
47
|
export OPENAI_API_KEY="sk-proj-..."
|
|
31
48
|
```
|
|
32
49
|
|
|
50
|
+
### Compatibility
|
|
51
|
+
|
|
52
|
+
- **Node.js:** v18+ / **Python:** 3.9+ (cross-SDK matrix)
|
|
53
|
+
- **Thread Safety:** AgentID clients are thread-safe and intended to be instantiated once and reused across concurrent requests.
|
|
54
|
+
- **Latency:** async `log()` is non-blocking for model execution paths; sync `guard()` typically adds network latency (commonly ~50-100ms, environment-dependent).
|
|
55
|
+
|
|
33
56
|
## 4. Quickstart
|
|
34
57
|
|
|
35
58
|
```ts
|
|
@@ -163,16 +186,22 @@ await agent.log({
|
|
|
163
186
|
const agent = new AgentID({
|
|
164
187
|
strictMode: true, // fail-closed on guard connectivity/timeouts
|
|
165
188
|
guardTimeoutMs: 10000, // default guard timeout is 10000ms
|
|
189
|
+
ingestTimeoutMs: 10000 // default ingest timeout is 10000ms
|
|
166
190
|
});
|
|
167
191
|
```
|
|
168
192
|
|
|
169
|
-
### Error
|
|
193
|
+
### Error Handling & Strict Mode
|
|
194
|
+
|
|
195
|
+
By default, AgentID is designed to keep your application running if the AgentID API has a timeout or is temporarily unreachable.
|
|
196
|
+
|
|
197
|
+
| Mode | Connectivity Failure | LLM Execution | Best For |
|
|
198
|
+
| :--- | :--- | :--- | :--- |
|
|
199
|
+
| **Default** (Strict Off) | API Timeout / Unreachable | **Fail-Open** (continues) | Standard SaaS, chatbots |
|
|
200
|
+
| **Strict Mode** (`strictMode: true`) | API Timeout / Unreachable | **Fail-Closed** (blocks) | Healthcare, FinTech, high-risk |
|
|
170
201
|
|
|
171
202
|
- `guard()` returns a verdict (`allowed`, `reason`); handle deny paths explicitly.
|
|
172
|
-
- `wrapOpenAI()`
|
|
173
|
-
- Default mode is fail-open for connectivity/timeouts (`timeout_fallback`, `guard_unreachable`, `system_failure_fail_open`).
|
|
203
|
+
- `wrapOpenAI()` and LangChain handlers throw `SecurityBlockError` when a prompt is blocked.
|
|
174
204
|
- If `strictMode` is not explicitly set in SDK code, runtime behavior follows the system configuration from AgentID (`strict_security_mode` / `failure_mode`).
|
|
175
|
-
- Set `strictMode: true` to fail-closed (`network_error_strict_mode` / `server_error`) in high-sensitivity environments.
|
|
176
205
|
- Ingest retries transient failures (5xx/429) and logs warnings if persistence fails.
|
|
177
206
|
|
|
178
207
|
## 7. Security & Compliance
|