Documentation
SDK reference
The public TypeScript API, its options and its error codes.
EpochAgent
new EpochAgent(options) wires a chain, storage, encryption, a serializer and a journal. executeWithAutosave(fn) runs fn(session), commits a final checkpoint marking the execution completed, and returns an ExecutionResult.
Session
| Method | What it does |
|---|---|
restoreOrInitialize(init) | Resumes an interrupted execution from its last verified checkpoint, or starts a new one with init(). Refuses to resume from a checkpoint that fails verification. |
step(state, context?) | Records progress; commits a SAFE_BOUNDARY checkpoint every checkpointPolicy.everySteps calls. |
checkpoint(type, state, context?) | Commits a checkpoint now (for example MANUAL). |
action(spec) | Runs a consequential operation through the action gate, with PRE_ACTION and POST_ACTION checkpoints if configured. |
complete() | Final COMPLETED checkpoint (called by executeWithAutosave). |
Options
| Option | Meaning |
|---|---|
agentId | Off-chain agent name, written into every manifest and checked on recovery |
chain | RpcCheckpointChain({ provider, ledger, workflowId, from }) |
storage | ReplicatedStorage([...adapters], minCopies) |
encryption | LocalAesGcmProvider(key) for development, or LitEncryptionProvider(client, conditionsFor) (not tested against Lit) |
serializer | StateSerializer({ applicationVersion, schemaVersion, serializers?, migrations? }) |
journal | FileJournal(path) (durable) or MemoryJournal (tests) |
checkpointPolicy | { everySteps, beforeExternalAction, afterConfirmedAction } |
failurePolicy | "halt" (default) stops when a checkpoint cannot be persisted; "degraded" continues and refuses high-risk actions |
confirmations | Blocks to wait before a checkpoint counts as committed |
validators, approve | Action policy; high-risk actions without approve() are refused |
reconcilers, compensation, partialEffects | Status queries and compensation per operation type; keep, compensate or halt |
telemetry | Telemetry with sinks; only allow-listed fields are emitted |
Errors
Failures are EpochError with a stable code, a safe message, retryable and non-sensitive details. Codes include PAYLOAD_INTEGRITY_FAILED, PAYLOAD_UNAVAILABLE, INVALID_CHECKPOINT_LINEAGE, CHECKPOINT_NOT_FINALIZED, RECOVERY_NOT_PERMITTED, RECOVERY_ALREADY_IN_PROGRESS, EXTERNAL_ACTION_STATUS_UNKNOWN, STATE_SCHEMA_INCOMPATIBLE, POLICY_VALIDATION_FAILED, ENCRYPTION_ACCESS_DENIED and UNAUTHORIZED.
Python SDK
sdk-python/ (standard library only) implements hashing, canonical JSON, manifests and independent verification with byte-for-byte parity. It does not run agents or decrypt artifacts yet. See sdk-python/README.md.