Skip to content

Fulcrum SDK Quickstart

Get Governance Running in 5 Minutes

This guide walks you through integrating Fulcrum governance into your AI agent with minimal code changes.


Prerequisites


Python Installation

pip install fulcrum-governance

TypeScript Installation

npm install @fulcrum-governance/sdk

Basic Integration (Python)

from fulcrum import Fulcrum

# Initialize client
client = Fulcrum(api_key="your-api-key")

# Wrap your agent action
async def my_agent_action(user_query: str):
    # Create execution envelope
    envelope = await client.envelope.create(
        agent_id="my-agent",
        action="llm_call",
        metadata={"query": user_query}
    )

    # Check if action is allowed
    if envelope.decision == "DENY":
        return f"Action blocked: {envelope.reason}"

    if envelope.decision == "REQUIRE_APPROVAL":
        return "Action pending approval"

    # Execute your action
    result = await call_llm(user_query)

    # Complete the envelope
    await client.envelope.complete(
        envelope_id=envelope.id,
        status="COMPLETED",
        cost=result.cost,
        tokens=result.tokens
    )

    return result.response

Basic Integration (TypeScript)

import { Fulcrum } from '@fulcrum-governance/sdk';

const client = new Fulcrum({ apiKey: 'your-api-key' });

async function myAgentAction(userQuery: string) {
  // Create execution envelope
  const envelope = await client.envelope.create({
    agentId: 'my-agent',
    action: 'llm_call',
    metadata: { query: userQuery }
  });

  if (envelope.decision === 'DENY') {
    return `Action blocked: ${envelope.reason}`;
  }

  // Execute your action
  const result = await callLLM(userQuery);

  // Complete the envelope
  await client.envelope.complete({
    envelopeId: envelope.id,
    status: 'COMPLETED',
    cost: result.cost,
    tokens: result.tokens
  });

  return result.response;
}

Key Concepts

Execution Envelope

Every agent action is wrapped in an envelope that tracks: - State (PENDING → RUNNING → COMPLETED) - Cost accumulation - Policy decisions - Audit trail

Decisions

Decision Meaning Action
ALLOW Action permitted Proceed
DENY Action blocked Stop
REQUIRE_APPROVAL Needs human review Wait
WARN Proceed with caution Log warning

Cost Tracking

Fulcrum tracks costs in real-time:

# Report actual cost after execution
await client.envelope.complete(
    envelope_id=envelope.id,
    cost=0.0034,  # USD
    tokens=1500
)


Next Steps


Document Version: 1.0
Last Updated: January 6, 2026