argus-agent-sdk
v0.1.0
Published
Node.js SDK for Argus — AI agent observability and security monitoring
Maintainers
Readme
argus-sdk
Node.js / TypeScript SDK for Argus — AI agent observability and security monitoring.
Argus captures every LLM call, tool call, and action your agent takes, scores them for risk in real time, and surfaces alerts for dangerous operations, PII exposure, secret leakage, and prompt injection.
Installation
npm install argus-agent-sdkQuick Start
import { ArgusClient } from "argus-agent-sdk";
const argus = new ArgusClient({
apiKey: "sk_live_...", // from your Argus dashboard
actorId: "my-agent", // unique ID for this agent
});
// Track an LLM call
await argus.llmCall({
inputText: prompt,
outputText: response,
inputTokens: 512,
outputTokens: 128,
});
// Track a tool call
await argus.toolCall({
actionType: "search_web",
inputText: query,
outputText: result,
});
// Track any other action
await argus.action({
actionType: "file_write",
payload: { path: "/tmp/output.txt" },
});LangChain Integration
Drop ArgusLangChainHandler into any chain or agent — it automatically captures all LLM calls and tool calls:
import { ArgusClient, ArgusLangChainHandler } from "argus-agent-sdk";
import { LLMChain } from "langchain/chains";
const argus = new ArgusClient({ apiKey: "sk_live_...", actorId: "my-agent" });
const handler = new ArgusLangChainHandler(argus);
const chain = new LLMChain({ llm, prompt, callbacks: [handler] });
const result = await chain.call({ input: "..." });
// LLM calls and tool calls are automatically auditedOpenAI Wrapper
Wrap your OpenAI client to audit all chat.completions.create() calls with zero changes to your application code:
import OpenAI from "openai";
import { ArgusClient, wrapOpenAI } from "argus-agent-sdk";
const openai = wrapOpenAI(
new OpenAI(),
new ArgusClient({ apiKey: "sk_live_...", actorId: "my-agent" }),
);
// All calls below are automatically audited
const response = await openai.chat.completions.create({
model: "gpt-4o",
messages: [{ role: "user", content: "Hello!" }],
});Workflow Correlation
Group related events into a workflow chain using correlationId:
const correlationId = crypto.randomUUID();
await argus.llmCall({ inputText: "Plan the task", correlationId });
await argus.toolCall({ actionType: "read_file", correlationId });
await argus.toolCall({ actionType: "write_file", correlationId });
await argus.llmCall({ outputText: "Done", correlationId });Argus groups these into a single workflow run and computes chain-level risk (peak score, cumulative score, escalation detection).
API Reference
new ArgusClient(options)
| Option | Type | Required | Description |
|--------|------|----------|-------------|
| apiKey | string | ✓ | Your Argus API key (sk_live_...) |
| actorId | string | ✓ | Unique identifier for this agent |
| baseUrl | string | | Argus deployment URL (default: https://app.argus.ai) |
argus.llmCall(options)
| Option | Type | Description |
|--------|------|-------------|
| inputText | string | Prompt sent to the model |
| outputText | string | Model response |
| inputTokens | number | Prompt token count |
| outputTokens | number | Completion token count |
| correlationId | string | Workflow chain ID |
| payload | object | Arbitrary metadata |
argus.toolCall(options) / argus.action(options)
| Option | Type | Description |
|--------|------|-------------|
| actionType | string | Name of the tool or action (e.g. file_delete, search_web) |
| inputText | string | Input to the tool |
| outputText | string | Output from the tool |
| correlationId | string | Workflow chain ID |
| payload | object | Arbitrary metadata |
All methods return Promise<IngestResponse | null>. Errors are logged as warnings and never throw — Argus is designed to be non-blocking in production.
Self-Hosted
Point the SDK at your own Argus deployment:
const argus = new ArgusClient({
apiKey: "sk_live_...",
actorId: "my-agent",
baseUrl: "https://argus.yourcompany.com",
});Requirements
- Node.js ≥ 18
- LangChain ≥ 0.1.0 (optional peer dependency, only needed for
ArgusLangChainHandler)
License
MIT
