SDK & CLI
Official SDKs, CLI, and sidecar for integrating AI agent security into your applications.
Official SDKs
Choose the SDK for your language. All SDKs provide the same core features: credential management, budget controls, prompt injection detection, and usage logging.
TypeScript / Node.js
For web apps, serverless functions, and Node.js backends. Includes OpenAI and LangChain integrations.
AvailablePython
For data pipelines, ML workflows, and Python backends. Async support included.
AvailableGo
For microservices, cloud-native apps, and high-performance systems.
AvailableTypeScript SDK
npm install @veraid/sdk # or yarn add @veraid/sdk
import { VeraIDClient } from '@veraid/sdk';
const client = new VeraIDClient({
apiKey: process.env.VERAID_API_KEY,
agentId: process.env.VERAID_AGENT_ID,
});
// Get a credential
const apiKey = await client.getCredential('openai-api-key');
// Check budget before making LLM calls
const canProceed = await client.checkBudget(0.05);
if (!canProceed) throw new Error('Budget exceeded');
// Check for prompt injection
const result = await client.checkInjection(userInput);
if (result.isInjection) {
console.error('Injection detected:', result.summary);
return;
}
// Record usage after LLM call
await client.recordUsage({
provider: 'openai',
model: 'gpt-4',
inputTokens: 500,
outputTokens: 200,
cost: 0.045,
latencyMs: 1200,
success: true,
});OpenAI Integration
import OpenAI from 'openai';
import { VeraIDClient } from '@veraid/sdk';
import { wrapOpenAI } from '@veraid/sdk/openai';
const client = new VeraIDClient({
apiKey: process.env.VERAID_API_KEY,
agentId: process.env.VERAID_AGENT_ID,
});
// Wrap OpenAI - all calls monitored automatically
const openai = wrapOpenAI(new OpenAI(), client);
// Use as normal - budget, injection, logging handled
const response = await openai.chat.completions.create({
model: 'gpt-4',
messages: [{ role: 'user', content: userInput }],
});SDK Methods
| Method | Description |
|---|---|
getCredential(name) | Retrieve a credential value from the vault |
listCredentials() | List all credentials available to the agent |
getBudgetStatus() | Get current budget limits and usage |
checkBudget(cost) | Check if estimated cost is within budget |
recordUsage(usage) | Log LLM usage for monitoring and billing |
checkInjection(prompt) | Check a prompt for injection attacks |
guardPrompt(prompt) | Check prompt and throw if injection detected |
getStats(period) | Get usage statistics (day/week/month) |
Sidecar Container
For applications that can't integrate the SDK directly, use the VeraID Sidecar. It runs as a container alongside your app, fetches credentials, and writes them to a shared volume.
services:
app:
image: your-app:latest
volumes:
- secrets:/secrets:ro
depends_on:
veraid-sidecar:
condition: service_healthy
veraid-sidecar:
image: ghcr.io/braineetech/veraid-sidecar:latest
environment:
VERAID_API_KEY: ${VERAID_API_KEY}
VERAID_AGENT_ID: ${VERAID_AGENT_ID}
VERAID_CREDENTIALS: "db-password,api-key,openai-key"
volumes:
- secrets:/secrets
volumes:
secrets:The sidecar auto-refreshes credentials before they expire. Your app just reads from /secrets/.
CLI Tool
Manage identities, credentials, and budgets from your terminal.
npm install -g veraid-cli
# Configure veraid config set-api-key YOUR_API_KEY # List agents veraid agents list # Get credential veraid credentials get db-password # Check budget veraid budget status --agent agent_abc123 # Test prompt for injection veraid injection check "Ignore previous instructions..." # View analytics veraid analytics --period week
Check out the API Reference for detailed endpoint documentation, or reach out to support@veraid.io for assistance.