Sign In

@vantio/agent-sdk

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vantio/agent-sdk

Vantio Optics Node SDK — shield() for Sight Loop observe. Metadata only; no prompts. Upgrade path to Gate and Phantom Engine.

latest
Source
npmnpm
Version
0.2.1
Version published
Maintainers
1
Created
Source

@vantio/agent-sdk

See what your AI agents are doing. Two lines of code.

npm install @vantio/agent-sdk

Quick start

import { shield } from "@vantio/agent-sdk";

await shield(async () => {
  await runMyLLMAgent();
});

Wrap your agent in shield(). Vantio generates a trace ID, propagates it through every async hop in your agent's call tree, and streams metadata to your dashboard — without ever reading your prompts.

API

shield(callback, options?) — canonical interceptor

import { shield } from "@vantio/agent-sdk";

const result = await shield(async () => {
  return await runMyAgent();
});

// With options:
await shield(async () => { ... }, {
  traceId: "custom-uuid",   // optional — generated if omitted
});

withVantio() is an alias for shield() — use either.

reportAnomaly(event, opts?) — send metadata to your dashboard

import { shield, reportAnomaly } from "@vantio/agent-sdk";

await shield(async () => {
  await runMyAgent();

  await reportAnomaly({
    target_host:   "api.openai.com",
    bytes_severed: 14382,
    // VantioActionTaken: "OBSERVED" | "ALLOWED" | "REDACTED" | "BLOCKED_HOST" | "BLOCKED_SIZE" | "BLOCKED_SPEND"
    action_taken:  "BLOCKED_HOST",
    pid:           process.pid,
  });
});

Requires VANTIO_CLOUD_INGEST=true and VANTIO_API_KEY to be set. Non-fatal — telemetry failures never crash your agent.

Policy & redaction (Vantio Pro)

Enforcement policy is served by the Vantio Pro control plane; the SDK applies it locally — Vantio is not a network proxy. The SDK ships two building blocks so you can fetch and enforce that policy yourself.

fetchPolicy(apiKey, opts?) — load the cloud-managed policy

import { fetchPolicy, type VantioPolicy } from "@vantio/agent-sdk";

const policy: VantioPolicy = await fetchPolicy(process.env.VANTIO_API_KEY!);
// { enforce, redact_pii, pii_types, allowed_hosts,
//   blocked_hosts, max_request_bytes, spend_cap_usd }

GETs /api/v1/config with the x-vantio-identity header. Fails open: on any error — network failure, non-2xx, malformed body, or timeout — it returns a permissive copy of DEFAULT_POLICY so an unreachable control plane can never block your agent. Options: ingestUrl, timeoutMs (default 5000), signal.

redactPII(text, piiTypes?) — strip PII locally

import { redactPII } from "@vantio/agent-sdk";

const { text, redactions } = redactPII("ssn 123-45-6789, mail a@b.com");
// text       → "ssn [VANTIO_REDACTED:SSN], mail [VANTIO_REDACTED:EMAIL]"
// redactions → ["ssn", "email"]

A pure, side-effect-free function — nothing ever leaves your process. Supports ssn, email, credit_card, and phone (defaults to all four), using the same patterns and [VANTIO_REDACTED:LABEL] tokens as the CLI interceptor.

The VantioActionTaken union ("OBSERVED" | "ALLOWED" | "REDACTED" | "BLOCKED_HOST" | "BLOCKED_SIZE" | "BLOCKED_SPEND") is also exported for typing your own enforcement reporting.

getCurrentTraceId() — read the active trace ID

import { getCurrentTraceId } from "@vantio/agent-sdk";

await shield(async () => {
  const id = getCurrentTraceId(); // always defined inside shield()
  console.log(`Trace: ${id}`);
});

getCurrentTraceId(); // undefined — outside shield() frame

Environment variables

VariableDescription
VANTIO_API_KEYYour API key from vantio.ai/dashboard
VANTIO_INGEST_URLIngest endpoint (default: https://vantio.ai)
VANTIO_CLOUD_INGESTSet to true to enable cloud routing
VANTIO_AUDIT_MODESet to 1 to flag events as audit mode

Zero-line alternative

No code changes at all — use the CLI:

npx @vantio/cli run node agent.js

What gets captured

  • Which LLM endpoint was called
  • Response size in bytes
  • Process ID and timestamp
  • A trace ID linking all calls in the same agent run

What never gets captured: prompts, completions, or any content from your requests.

vantio.ai · Platform · Pricing · MIT License

Keywords

vantio

FAQs

Package last updated on 17 Jul 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts