@usevalt/sdk
v0.1.0
Published
Valt SDK — observability and governance for AI coding agents
Maintainers
Readme
@usevalt/sdk
TypeScript SDK for Valt — the trust layer for AI-assisted development.
Capture AI coding agent sessions, track events and costs, and get Valt Verified certificates.
Installation
npm install @usevalt/sdk
# or
pnpm add @usevalt/sdkQuick Start
import { ValtClient } from '@usevalt/sdk';
const valt = new ValtClient({
apiKey: process.env.VALT_API_KEY,
project: 'my-project',
});
const session = valt.startSession({
tool: 'claude-code',
model: 'claude-sonnet-4',
task: 'Add user authentication',
});
session.trackEvent('file.write', {
path: 'src/auth/middleware.ts',
linesChanged: 45,
});
session.trackCost({
promptTokens: 1500,
completionTokens: 3200,
model: 'claude-sonnet-4',
});
await session.end({ status: 'completed' });
await valt.flush();Claude Code Integration
import { ValtClient } from '@usevalt/sdk';
import { claudeCodeIntegration } from '@usevalt/sdk/integrations/claude-code';
const valt = new ValtClient({
apiKey: process.env.VALT_API_KEY,
project: 'my-project',
integrations: [claudeCodeIntegration()],
});The integration automatically captures prompts, tool calls, file operations, token usage, and session lifecycle.
API
ValtClient
| Method | Description |
|--------|-------------|
| startSession(config) | Start tracking a new agent session |
| flush() | Force send all buffered events |
| close() | Flush and clean up |
| isEnabled() | Check if SDK is active |
Session
| Method | Description |
|--------|-------------|
| trackEvent(type, data) | Record an event (file.write, command.execute, etc.) |
| trackCost(tokens) | Record token usage and cost |
| end(result) | Complete the session |
| id | Session UUID |
Configuration
new ValtClient({
apiKey: string, // Required
project: string, // Required
endpoint?: string, // Default: https://api.usevalt.com
flushInterval?: number, // Default: 5000ms
maxBatchSize?: number, // Default: 100 events
maxRetries?: number, // Default: 3
debug?: boolean, // Default: false
});Design Principles
- Never crashes the host application. All operations wrapped in try/catch.
- Zero required configuration beyond API key. Sensible defaults for everything.
- Minimal dependencies. Zero runtime dependencies in core.
- Async, non-blocking. Events buffered and flushed in the background.
License
MIT
