@sentrial/sdk 0.4.4 → 0.4.5
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 +72 -21
- package/dist/cli.cjs +1139 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.d.cts +77 -0
- package/dist/cli.d.ts +77 -0
- package/dist/cli.js +1100 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.cjs +84 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +61 -2
- package/dist/index.d.ts +61 -2
- package/dist/index.js +82 -26
- package/dist/index.js.map +1 -1
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
TypeScript SDK for [Sentrial](https://sentrial.com) - AI agent observability and monitoring.
|
|
4
4
|
|
|
5
5
|
Track sessions, tool calls, and metrics to power:
|
|
6
|
+
|
|
6
7
|
- **Signal detection**: Auto-detect patterns and anomalies
|
|
7
8
|
- **Root cause analysis**: Understand WHY agents fail
|
|
8
9
|
- **Experiments**: A/B test different system prompts
|
|
@@ -18,6 +19,35 @@ pnpm add @sentrial/sdk
|
|
|
18
19
|
yarn add @sentrial/sdk
|
|
19
20
|
```
|
|
20
21
|
|
|
22
|
+
## CLI
|
|
23
|
+
|
|
24
|
+
The SDK package also ships a `sentrial` binary for scriptable workflows. This is the
|
|
25
|
+
first packaging step toward a dedicated `npm install sentrial` style CLI package.
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# Run the CLI without a global install and set up the current project
|
|
29
|
+
npx --yes --package=@sentrial/sdk@latest sentrial install
|
|
30
|
+
|
|
31
|
+
# Save credentials locally
|
|
32
|
+
npx sentrial login --api-key sentrial_live_xxx
|
|
33
|
+
|
|
34
|
+
# Install the SDK package and scaffold a safe example integration
|
|
35
|
+
npx sentrial install
|
|
36
|
+
|
|
37
|
+
# Or scaffold only, without installing packages
|
|
38
|
+
npx sentrial init
|
|
39
|
+
|
|
40
|
+
# Inspect production runs
|
|
41
|
+
npx sentrial sessions list --last 7d --status failed --agent support
|
|
42
|
+
npx sentrial sessions get <session-id>
|
|
43
|
+
npx sentrial events list <session-id> --type tool_call
|
|
44
|
+
|
|
45
|
+
# Review signals and run CI gates
|
|
46
|
+
npx sentrial signals list --type negative --last 30d
|
|
47
|
+
npx sentrial diagnose <session-id>
|
|
48
|
+
npx sentrial evaluate <experiment-id> --min-score 80
|
|
49
|
+
```
|
|
50
|
+
|
|
21
51
|
## Quick Start (30 seconds)
|
|
22
52
|
|
|
23
53
|
### Option 1: Auto-Wrap LLM Clients (Recommended)
|
|
@@ -241,40 +271,61 @@ const cost = calculateOpenAICost({
|
|
|
241
271
|
|
|
242
272
|
## What Gets Tracked
|
|
243
273
|
|
|
244
|
-
| Data
|
|
245
|
-
|
|
246
|
-
| LLM calls
|
|
247
|
-
| Token usage
|
|
248
|
-
| Cost (USD)
|
|
249
|
-
| Latency
|
|
250
|
-
| Tool calls
|
|
251
|
-
| Errors
|
|
252
|
-
| User ID
|
|
253
|
-
| Custom metrics | -
|
|
274
|
+
| Data | Auto-tracked | Manual |
|
|
275
|
+
| -------------- | ----------------- | --------------------- |
|
|
276
|
+
| LLM calls | ✔️ via wrappers | `trackToolCall()` |
|
|
277
|
+
| Token usage | ✔️ via wrappers | `promptTokens` param |
|
|
278
|
+
| Cost (USD) | ✔️ calculated | `estimatedCost` param |
|
|
279
|
+
| Latency | ✔️ always | - |
|
|
280
|
+
| Tool calls | ✔️ via `withTool` | `trackToolCall()` |
|
|
281
|
+
| Errors | ✔️ always | `trackError()` |
|
|
282
|
+
| User ID | ✔️ via session | `userId` param |
|
|
283
|
+
| Custom metrics | - | `customMetrics` param |
|
|
254
284
|
|
|
255
285
|
## Framework Compatibility
|
|
256
286
|
|
|
257
|
-
| Framework
|
|
258
|
-
|
|
259
|
-
| **Direct OpenAI**
|
|
260
|
-
| **Direct Anthropic** | `wrapAnthropic()` | ✔️
|
|
261
|
-
| **Direct Gemini**
|
|
262
|
-
| **Vercel AI SDK**
|
|
263
|
-
| **Express/Fastify**
|
|
264
|
-
| **Next.js**
|
|
265
|
-
| **Custom agents**
|
|
287
|
+
| Framework | Integration | Status |
|
|
288
|
+
| -------------------- | ----------------- | ------ |
|
|
289
|
+
| **Direct OpenAI** | `wrapOpenAI()` | ✔️ |
|
|
290
|
+
| **Direct Anthropic** | `wrapAnthropic()` | ✔️ |
|
|
291
|
+
| **Direct Gemini** | `wrapGoogle()` | ✔️ |
|
|
292
|
+
| **Vercel AI SDK** | `wrapAISDK()` | ✔️ |
|
|
293
|
+
| **Express/Fastify** | Decorators | ✔️ |
|
|
294
|
+
| **Next.js** | Decorators | ✔️ |
|
|
295
|
+
| **Custom agents** | Full API | ✔️ |
|
|
266
296
|
|
|
267
297
|
## Documentation
|
|
268
298
|
|
|
269
299
|
See the `docs/` folder in the repository:
|
|
300
|
+
|
|
270
301
|
- `docs/sdks/typescript-sdk.md` - Full SDK reference
|
|
271
302
|
- `docs/integrations/vercel-ai-sdk.md` - Vercel AI SDK integration
|
|
272
303
|
- `docs/features/experiments.md` - Experiments guide
|
|
273
304
|
|
|
274
305
|
## Support
|
|
306
|
+
|
|
275
307
|
- 💬 [Discord](https://discord.gg/9bMmJCXt)
|
|
276
|
-
- 📧 [Email](mailto:
|
|
277
|
-
- 🐛 [GitHub Issues](https://github.com/
|
|
308
|
+
- 📧 [Email](mailto:founders@sentrial.com)
|
|
309
|
+
- 🐛 [GitHub Issues](https://github.com/sentrialdev/Sentrial/issues)
|
|
310
|
+
|
|
311
|
+
## SDK feature parity (TypeScript ↔ Python)
|
|
312
|
+
|
|
313
|
+
Both SDKs share the same core API (`begin`/`finish`, tool & LLM tracking, production
|
|
314
|
+
experiments, provider wrappers). Framework integrations currently differ:
|
|
315
|
+
|
|
316
|
+
| Capability | TypeScript | Python |
|
|
317
|
+
| ----------------------------------------------------- | --------------------- | ------------------- |
|
|
318
|
+
| Core tracking (begin/finish, tools, LLM, experiments) | ✓ | ✓ |
|
|
319
|
+
| OpenAI / Anthropic / Google wrappers | ✓ | ✓ |
|
|
320
|
+
| Vercel AI SDK helper | ✓ | — (JS-only) |
|
|
321
|
+
| Claude Agent SDK | partial (single-turn) | ✓ (full multi-turn) |
|
|
322
|
+
| OpenTelemetry export | — | ✓ |
|
|
323
|
+
| Langfuse dual-write | — | ✓ |
|
|
324
|
+
| AutoGen / CrewAI / LangChain handlers | — | ✓ |
|
|
325
|
+
|
|
326
|
+
Porting the missing TypeScript integrations (OpenTelemetry, Langfuse, Claude
|
|
327
|
+
multi-turn) is planned; new TS integrations must keep V1 API response shapes
|
|
328
|
+
backward-compatible.
|
|
278
329
|
|
|
279
330
|
## License
|
|
280
331
|
|