AI Employee SDK

API Reference

Flat reference table for all 16 runtime exports from @ai-employee-sdk/core.

All exports from @ai-employee-sdk/core. For type definitions, see Types Reference.

Functions

ExportSignatureDescriptionDocs
membrane(config: MembraneConfig<TOOLS>) => MembraneResult<TOOLS>Creates a 4-tier permission system for toolsMembrane
resolveTier(toolName: string, config: MembraneConfig) => TierResolves a tool name to its tierMembrane
explainTier(toolName: string, config: MembraneConfig) => TierResolutionResolves tier with explanation (source, pattern index)Membrane
composePrepareStep(...fns: (PrepareStepFn | undefined | null)[]) => PrepareStepFnComposes multiple prepareStep functions with deterministic merge rulesMemory
createMemoryPrepareStep(store: MemoryStore, config?: MemoryPrepareStepConfig) => PrepareStepFnCreates a prepareStep that injects memories at step 0Memory
createCostTracker(config: CostTrackerConfig) => CostTrackerResultStateful per-model cost tracker with budget enforcementCost Tracking
budgetExceeded(config: BudgetConfig) => StopConditionStateless stop condition for token/USD budgetsCost Tracking
tokenVelocityExceeded(config: VelocityConfig) => StopConditionStop condition for runaway token velocityCost Tracking
extractPendingApprovals(result: any) => PendingApproval[]Extracts tool calls awaiting approval from generateText resultInterrupts
createInterruptHandle(result: any, pendingApprovals: PendingApproval[]) => InterruptHandleCreates a serializable JSON handle for interrupted stateInterrupts
resolveInterrupt(handle: InterruptHandle, decisions: InterruptDecision[]) => { messages, previousUsage }Pure function. Applies human decisions to produce resumption messagesInterrupts
createHeartbeat(agent, config: HeartbeatConfig) => HeartbeatResultAlways-on tick function with concurrency guard and circuit breakerAgent
createAuditLogger(config: AuditLoggerConfig) => AuditLoggerResultCreates callbacks for tool call and step observabilityAudit

Classes

ExportDescriptionDocs
EmployeeAgentAgent implementation composing membrane + memory + prepareStep + stop conditions. Delegates to ToolLoopAgent.Agent
InMemoryStoreZero-dependency MemoryStore implementation with lazy TTL. For tests and development.Memory

Constants

ExportTypeDescription
DEFAULT_MODEL_PRICINGRecord<string, ModelPricing>Built-in pricing for OpenAI, Anthropic, and Google models (March 2025)

Import

// Runtime exports
import {
  membrane,
  resolveTier,
  explainTier,
  composePrepareStep,
  createMemoryPrepareStep,
  createCostTracker,
  DEFAULT_MODEL_PRICING,
  budgetExceeded,
  tokenVelocityExceeded,
  extractPendingApprovals,
  createInterruptHandle,
  resolveInterrupt,
  createHeartbeat,
  createAuditLogger,
  EmployeeAgent,
  InMemoryStore,
} from '@ai-employee-sdk/core';

// Type-only exports
import type {
  Tier,
  TierPattern,
  TierResolution,
  MemoryStore,
  MembraneConfig,
  MembraneResult,
  AuditEntry,
  HeartbeatConfig,
  HeartbeatResult,
  CheckWorkFn,
  MemoryPrepareStepConfig,
  ModelPricing,
  BudgetConfig,
  VelocityConfig,
  AuditLoggerConfig,
  AuditLoggerResult,
  EmployeeAgentConfig,
  CostTrackerConfig,
  CostSnapshot,
  CostTrackerResult,
  PendingApproval,
  InterruptDecision,
  InterruptHandle,
} from '@ai-employee-sdk/core';

On this page