Skip to main content
The Adrian TypeScript SDK (@secureagentics/adrian) attaches to your agent’s LLM calls, captures activity and reasoning, and streams them to the Adrian backend over WebSocket. The core package owns the event pipeline - event pairing, PII redaction, JSONL logging, WebSocket streaming, and policy verdicts. Provider packages build on it; the OpenAI integration wraps your OpenAI client so every call is captured with no change to your call sites.

Install

Requires Node.js 18 or later.

OpenAI integration

@secureagentics/adrian-openai instruments the official openai client (Chat Completions). init, adrian.openai(client), and shutdown bracket your normal OpenAI code - call sites stay unchanged.
Requires the openai package as a peer dependency (>=4.0.0). Events appear in your dashboard within seconds, classified by severity.
The SDK defaults to ws://localhost:8080/ws. For Adrian Cloud, pass wsUrl: "wss://adrian.secureagentics.ai/ws" to init (or set ADRIAN_WS_URL).

Configuration

Explicit init() options take precedence over environment variables.

Policy and BLOCK mode

When the dashboard policy is in BLOCK or HITL mode, the SDK waits for backend verdicts on the tool calls an LLM turn proposes. In BLOCK mode, if no verdict arrives within blockTimeout seconds, the SDK fails open and allows execution (matching the Python SDK). See Severity codes for the M-codes and How it works for the operating modes.

What’s captured

  • Activity events. LLM calls and tool executions, paired (start + end) and streamed to the backend.
  • Reasoning traces. Captured where the model exposes them.
PII is redacted in your process before any data leaves it. See Security and Privacy.

Manual instrumentation

For a framework without a provider package, attach the handler from adrian.getHandler() and pair each LLM or tool start and end by a shared runId (handleChatModelStart / handleLLMEnd, handleToolStart / handleToolEnd). Shared capture helpers are exposed at @secureagentics/adrian/capture.

Known limitations

  • Fail-open on timeout. In BLOCK mode a verdict timeout allows execution; a dashboard-configurable failure policy is planned.
  • OpenAI surface. The OpenAI package instruments the openai client’s Chat Completions calls.