Skip to content

WorkflowStore

Defined in: packages/core/src/stores/workflow-store.ts:77

Workflow run persistence: materialized run/step I/O plus append-only RunEvents.

Observers (WorkflowObserver) are push-only — no reads. WorkflowStore supports queries (listRuns, listEvents, getStepOutput) for UI and step skip on retry. RunRecorder writes to both when configured. Separate from MessageStore.

Default implementation: inMemoryWorkflowStore.

createSuspend(args): Promise<void>

Defined in: packages/core/src/stores/workflow-store.ts:155

Persist a pending suspend for a live run. Does not emit events: the parked run’s recorder emits workflow_suspended / workflow_resumed, so runSeq has one allocator. A run may hold several pending suspends (parallel steps); a duplicate handle id throws.

SuspendHandle

EffectIntent

Promise<void>


deleteRun(workflowRunId): Promise<void>

Defined in: packages/core/src/stores/workflow-store.ts:124

Remove a run and its events / step records.

string

Promise<void>


getLatestEvent<T>(scope, type): Promise<RunEventOfType<T> | null>

Defined in: packages/core/src/stores/workflow-store.ts:87

T extends "custom" | "workflow_started" | "workflow_finished" | "workflow_failed" | "workflow_cancelled" | "workflow_suspended" | "workflow_resumed" | "step_started" | "step_finished" | "step_skipped" | "step_failed" | "workflow_title_set" | "effect_intent" | "effect_settled" | "agent_started" | "agent_finished" | "agent_failed" | "agent_warning" | "agent_tool_call" | "agent_tool_result" | "agent_text_delta" | "agent_messages_committed" | "agent_title_set" | "conversation_forked"

ListEventsScope

T

Promise<RunEventOfType<T> | null>


getRun(workflowRunId): Promise<WorkflowRunSummary | null>

Defined in: packages/core/src/stores/workflow-store.ts:92

string

Promise<WorkflowRunSummary | null>


getRunInput(workflowRunId): Promise<unknown>

Defined in: packages/core/src/stores/workflow-store.ts:112

string

Promise<unknown>


getRunOutput(workflowRunId): Promise<unknown>

Defined in: packages/core/src/stores/workflow-store.ts:113

string

Promise<unknown>


getStepById(workflowRunId, stepId): Promise<StepRecord | null>

Defined in: packages/core/src/stores/workflow-store.ts:115

string

string

Promise<StepRecord | null>


getStepOutput(workflowRunId, slot): Promise<unknown>

Defined in: packages/core/src/stores/workflow-store.ts:114

string

StepSlot

Promise<unknown>


getSuspend(handleId): Promise<SuspendRecord | null>

Defined in: packages/core/src/stores/workflow-store.ts:157

string

Promise<SuspendRecord | null>


listAgentEpisodes(filter?): Promise<AgentEpisodeSummary[]>

Defined in: packages/core/src/stores/workflow-store.ts:127

Standalone and in-workflow agent episodes, newest first.

string

number

Promise<AgentEpisodeSummary[]>


listDescendantRuns(workflowRunId): Promise<WorkflowRunSummary[]>

Defined in: packages/core/src/stores/workflow-store.ts:111

All nested runs under workflowRunId at any depth (BFS over WorkflowRunSummary.parentWorkflowRunId). Does not include the starting run. Works when workflowRunId is a mid-tree node.

string

Promise<WorkflowRunSummary[]>


listEvents(scope, filter?): Promise<RunEvent[]>

Defined in: packages/core/src/stores/workflow-store.ts:85

Read events for a workflow run or a standalone agent episode. Workflow-scoped queries return workflow + step + custom events for that workflowRunId. Agent-scoped queries return agent events for that agentCallId.

ListEventsScope

ListEventsFilter

Promise<RunEvent[]>


listPendingSuspends(filter?): Promise<SuspendRecord[]>

Defined in: packages/core/src/stores/workflow-store.ts:160

Pending (unresolved) suspends, optionally for one run.

string

Promise<SuspendRecord[]>


listRuns(filter?): Promise<WorkflowRunSummary[]>

Defined in: packages/core/src/stores/workflow-store.ts:99

List workflow runs, oldest first (contrast listAgentEpisodes, newest first). tags matches runs carrying any of the given tags (OR semantics). parentWorkflowRunId filters to immediate children of that run. rootsOnly keeps only runs with no parent (top-level and isolated).

number

string

boolean

string[]

string

Promise<WorkflowRunSummary[]>


listStepRecords(workflowRunId): Promise<StepRecord[]>

Defined in: packages/core/src/stores/workflow-store.ts:117

Seeded / replayed step projections for a run (excludes in-flight steps without records).

string

Promise<StepRecord[]>


materializeAttemptRun(run): Promise<void>

Defined in: packages/core/src/stores/workflow-store.ts:144

Write a seeded run projection (no event-log duplication).

AttemptRunMaterialization

Promise<void>


materializeAttemptStep(step): Promise<void>

Defined in: packages/core/src/stores/workflow-store.ts:147

Write a seeded step projection + path-stable output slot.

AttemptStepMaterialization

Promise<void>


recordEvent(event): Promise<void>

Defined in: packages/core/src/stores/workflow-store.ts:78

RunEvent

Promise<void>


resolveSuspend(handleId, decision): Promise<void>

Defined in: packages/core/src/stores/workflow-store.ts:166

Resume with allow / deny / rewrite and wake the waiter. Missing or already-resolved handles fail closed — the effect is not allowed.

string

SuspendResolveDecision

Promise<void>


seedRetryAttempt(args): Promise<RetryAttempt>

Defined in: packages/core/src/stores/workflow-store.ts:141

Compatibility: seed from (fromWorkflowRunId, fromStepId) via a step-boundary cursor. Throws if fromStepId is unknown. Does not mutate the prior attempt.

SeedRetryAttemptArgs

Promise<RetryAttempt>


seedRetryFromCursor(args): Promise<RetryAttempt>

Defined in: packages/core/src/stores/workflow-store.ts:135

Seed a new attempt forest from a import(”../effect/types”).TraceCursor. effectId resolves via effect_intent on the run log to the enclosing step (step-atomic). stepId is the UI alias. Unknown / root-level effectId and runSeq throw. Does not mutate the prior attempt.

ForkFromCursorArgs

Promise<RetryAttempt>


setRunTags(workflowRunId, tags): Promise<void>

Defined in: packages/core/src/stores/workflow-store.ts:122

Replace a run’s WorkflowRunSummary.tags.

string

string[]

Promise<void>


setRunTitle(workflowRunId, title): Promise<void>

Defined in: packages/core/src/stores/workflow-store.ts:120

Set a display title without changing WorkflowRunSummary.workflowRunId.

string

string

Promise<void>


waitForSuspendResolution(handleId): Promise<SuspendResolveDecision>

Defined in: packages/core/src/stores/workflow-store.ts:173

Wait until resolveSuspend. Already-resolved handles return the stored decision. Waiters are process-local — a new process must not assume the original workflow.run closure is still parked.

string

Promise<SuspendResolveDecision>