@fulcrum_io/sdk
v0.1.0
Published
TypeScript SDK for Fulcrum - Intelligent AI Governance Platform
Maintainers
Readme
Fulcrum TypeScript SDK
Intelligent AI Governance for Enterprise Agents
Installation
npm install @fulcrum-governance/sdkQuick Start
import { FulcrumClient } from '@fulcrum-governance/sdk';
// Initialize client
const client = new FulcrumClient({
host: 'your-fulcrum-server:50051',
apiKey: 'your-api-key',
onFailure: 'FAIL_OPEN' // or 'FAIL_CLOSED'
});
// Wrap agent executions in governance envelopes
const envelope = client.envelope({
workflowId: 'customer-support-bot',
tenantId: 'your-tenant-id'
});
// Check if action is allowed before executing
const allowed = await envelope.guard('send_email', userMessage);
if (allowed) {
// Action approved - proceed
const result = await sendEmail(userMessage);
envelope.log('email_sent', { recipient: email, status: 'success' });
} else {
// Action blocked by policy
envelope.log('action_blocked', { reason: 'policy_violation' });
}Features
- Policy Enforcement: Real-time governance checks before agent actions
- Cost Tracking: Monitor and control LLM spending per workflow
- Audit Trail: Complete execution history for compliance
- Fail-Safe Modes: Configurable FAIL_OPEN or FAIL_CLOSED behavior
- TypeScript Support: Full type definitions included
API Reference
FulcrumClient
interface FulcrumClientOptions {
host: string; // gRPC server address (e.g., 'localhost:50051')
apiKey?: string; // Authentication key
onFailure?: 'FAIL_OPEN' | 'FAIL_CLOSED'; // Behavior on errors
timeoutMs?: number; // Request timeout (default: 500ms)
}Envelope
interface EnvelopeOptions {
workflowId: string; // Identifier for the workflow
executionId?: string; // Auto-generated if not provided
tenantId?: string; // Defaults to 'default-tenant'
metadata?: Record<string, string>; // Additional context
}Methods
envelope.guard(actionName: string, inputText: string, metadata?: Record<string, string>): Promise<boolean>
Checks if an action is allowed by current policies.
envelope.log(eventType: string, payload: Record<string, any>): void
Logs an event for audit trail and observability.
Documentation
Full documentation: https://docs.fulcrum.dev
License
Apache 2.0
