Import
Examples
Simple sequential workflow
Parallel steps and human-in-the-loop
API
workflow(options)
Create a workflow definition.
| Property | Type | Description | Source |
|---|---|---|---|
id | string | Unique workflow identifier | source |
description? | string | Human-readable description | source |
version? | string | Semantic version string | source |
inputSchema? | Schema<TInput> | Zod schema for workflow input validation | source |
outputSchema? | Schema<TOutput> | Zod schema for workflow output validation | source |
retry? | RetryConfig | Retry configuration for failed steps | source |
timeout? | string | number | Max execution time (ms) | source |
introspect? | boolean | Enable runtime introspection for debugging | source |
steps | WorkflowNode[] | ((context: StepBuilderContext<TInput>) => WorkflowNode[]) | Workflow step definitions | source |
onError? | (error: Error, context: WorkflowContext) => void | Promise<void> | Error handler called when a step fails | source |
onComplete? | (result: TOutput, context: WorkflowContext) => void | Promise<void> | Callback fired after workflow completes | source |
Workflow<TInput, TOutput>
Type Reference
StepOptions
Options accepted by step.
| Property | Type | Description | Source |
|---|---|---|---|
agent? | string | Agent | Agent to run (by ID or instance) | source |
tool? | string | Tool | Tool to execute (by ID or instance) | source |
input? | string | Record<string, unknown> | ((context: WorkflowContext) => unknown) | Step input: static value or function of workflow context | source |
checkpoint? | boolean | Persist state after this step | source |
retry? | RetryConfig | Retry configuration for this step | source |
timeout? | string | number | Step timeout (ms) | source |
skip? | (context: WorkflowContext) => boolean | Promise<boolean> | Predicate: skip this step if returns true | source |
BranchOptions
Options accepted by branch.
| Property | Type | Description | Source |
|---|---|---|---|
condition | (context: WorkflowContext) => boolean | Promise<boolean> | Branch predicate function | source |
then | WorkflowNode[] | Steps when condition is true | source |
else? | WorkflowNode[] | Steps when condition is false | source |
checkpoint? | boolean | Persist state after this node | source |
retry? | RetryConfig | Retry configuration | source |
timeout? | string | number | Node timeout (ms or duration string) | source |
skip? | (context: WorkflowContext) => boolean | Promise<boolean> | Predicate: skip if returns true | source |
ParallelOptions
Options accepted by parallel.
| Property | Type | Description | Source |
|---|---|---|---|
strategy? | "all" | "race" | "allSettled" | Completion strategy ("all", "race", "allSettled") | source |
checkpoint? | boolean | Persist state after this node | source |
retry? | RetryConfig | Retry configuration | source |
timeout? | string | number | Node timeout (ms or duration string) | source |
skip? | (context: WorkflowContext) => boolean | Promise<boolean> | Predicate: skip if returns true | source |
Exports
Functions
| Name | Description | Source |
|---|---|---|
agentStep | Create a workflow step that runs an agent. | source |
branch | Create a conditional branch node. | source |
createWorkflowClient | Create workflow client. | source |
dag | Create a directed workflow graph. | source |
delay | Create a simple delay/sleep node. | source |
dependsOn | Declare workflow step dependencies. | source |
doWhile | Create a do-while workflow loop. | source |
generateId | Generate a unique workflow ID | source |
getWorkflowTenant | Get the current workflow tenant context. Returns undefined if not executing within a workflow step. | source |
hasWorkerSupport | Check whether worker support is present. | source |
loop | Create a loop workflow step. | source |
map | Create a mapped workflow step. | source |
parallel | Create a parallel node for concurrent execution of multiple steps. | source |
parseDuration | Parse duration string to milliseconds | source |
sequence | Create a sequential workflow definition. | source |
step | Create a workflow step definition. | source |
subWorkflow | Create a sub-workflow node for nested execution. | source |
times | Create a fixed-count workflow loop. | source |
toolStep | Create a workflow step that runs a tool. | source |
unless | Create a branch that only executes if condition is false. | source |
useApproval | Manage workflow approval interactions. | source |
useWorkflow | React hook for workflow. | source |
useWorkflowList | List and filter workflow runs. | source |
useWorkflowStart | React hook for workflow start. | source |
waitForApproval | Create a wait-for-approval node. Pauses until human approves/rejects. | source |
waitForEvent | Create a wait-for-event node. Pauses until external event is received. | source |
when | Create a branch that only executes if condition is true (no else). | source |
workflow | Create a workflow definition. | source |
Classes
Types
| Name | Description | Source |
|---|---|---|
BackendConfig | Configuration used by backend. | source |
BranchOptions | Options accepted by branch. | source |
CapturedTenantContext | Captured tenant context for multi-tenant workflow execution. Allows tools and framework utilities to access the current tenant without explicit parameter passing. | source |
LoopOptions | Options accepted by loop. | source |
MapOptions | Options accepted by map. | source |
ParallelOptions | Options accepted by parallel. | source |
RedisAdapter | Standardized Redis Adapter Interface Normalizes differences between Deno and Node Redis clients | source |
RedisBackendConfig | Redis backend configuration | source |
StepOptions | Options accepted by step. | source |
SubWorkflowOptions | Options accepted by sub workflow. | source |
UseApprovalOptions | Options accepted by use approval. | source |
UseApprovalResult | Result returned from use approval. | source |
UseWorkflowListOptions | Options accepted by use workflow list. | source |
UseWorkflowListResult | Result returned from use workflow list. | source |
UseWorkflowOptions | Options accepted by use workflow. | source |
UseWorkflowResult | Result returned from use workflow. | source |
UseWorkflowStartOptions | Options accepted by use workflow start. | source |
UseWorkflowStartResult | Result returned from use workflow start. | source |
WaitForApprovalOptions | Options accepted by wait for approval. | source |
WaitForEventOptions | Options accepted by wait for event. | source |
Workflow | Workflow instance | source |
WorkflowBackend | Public API contract for workflow backend. | source |
WorkflowClientConfig | Configuration used by workflow client. | source |
WorkflowContext | Workflow context - accumulates node outputs during execution | source |
WorkflowDefinition | Workflow definition | source |
WorkflowExecutorConfig | Workflow executor configuration | source |
WorkflowHandle | Controller for a running workflow. | source |
WorkflowNode | Workflow node | source |
WorkflowNodeConfig | Union of all workflow node configurations | source |
WorkflowOptions | Options accepted by workflow. | source |
WorkflowRun | Workflow run state | source |
WorkflowStatus | Public API contract for workflow status. | source |
Constants
| Name | Description | Source |
|---|---|---|
api | Context-aware API that automatically uses the current tenant. | source |
Deep imports
These import paths group focused functionality under this module. Each is a separate barrel; import only what you need.veryfront/workflow/claude-code
Claude Agent SDK Integration Provides Claude Code agentic capabilities within Veryfront workflows. Uses your local Claude Code installation - no separate API key needed.
Functions
| Name | Description | Source |
|---|---|---|
createAgent | Create a reusable agent function with preset configuration. | source |
createClaudeCodeTool | Create a customized Claude Code tool | source |
createEventPublisher | Create an event publisher based on environment | source |
createWebSocketHandler | Create a WebSocket handler for HTTP upgrade requests | source |
createWorkspaceSync | Create a workspace sync for a Claude Code run | source |
executeAgent | Execute a task using the Claude Agent SDK. | source |
withWorkspace | Execute a function with a synchronized workspace | source |
Classes
| Name | Description | Source |
|---|---|---|
AgentController | Agent controller for handling client commands | source |
CallbackEventPublisher | Simple callback-based publisher Calls a function for each event | source |
MemoryEventPublisher | In-memory event publisher using EventTarget Useful for testing or single-process deployments | source |
MultiEventPublisher | Publishes events to multiple publishers | source |
RedisEventPublisher | Implement redis event publisher. | source |
SSEEventPublisher | Server-Sent Events publisher Writes events directly to a ReadableStream controller | source |
WebSocketPublisher | WebSocket-based bidirectional publisher | source |
WorkspaceSync | Workspace manager for Claude Code execution | source |
Types
| Name | Description | Source |
|---|---|---|
AgentConfig | Agent configuration | source |
ApprovalRequestEvent | Approval request event (sent to client when tool needs approval) | source |
BidirectionalPublisher | Bidirectional publisher interface (WebSocket) | source |
CancelCommand | Cancel the running agent | source |
CancelledEvent | Cancelled event | source |
ClaudeCodeEvent | Union of all event types | source |
ClaudeCodeEventBase | Base event interface | source |
ClaudeCodeEventHandler | Event subscriber callback | source |
ClaudeCodeEventPublisher | Event publisher interface for streaming events | source |
ClaudeCodeEventSubscriber | Event subscriber interface for receiving events | source |
ClaudeCodeEventType | Event types for streaming Claude Code execution | source |
ClaudeCodeMode | Tool modes for Claude Code agent | source |
ClaudeCodeResult | Final result from agent execution | source |
ClaudeCodeToolInput | Input schema type for claude-code workflow tools | source |
ClientCommand | Union of all client commands | source |
ClientCommandHandler | Handler for client commands | source |
ClientCommandType | Client command types for WebSocket communication | source |
CompleteEvent | Complete event (agent finished) | source |
ErrorEvent | Error event | source |
FileChange | File change tracking | source |
InputCommand | Send user input to the agent | source |
InputRequestEvent | Input request event (sent to client when agent needs user input) | source |
IterationCompleteEvent | Iteration complete event | source |
IterationStartEvent | Iteration start event | source |
PingCommand | Keepalive ping | source |
PongEvent | Pong response to ping | source |
RedisEventPublisherConfig | Redis event publisher configuration | source |
TextCompleteEvent | Text complete event | source |
TextDeltaEvent | Text delta event (streaming text chunk) | source |
ThinkingCompleteEvent | Thinking complete event | source |
ThinkingDeltaEvent | Thinking delta event | source |
ThinkingStartEvent | Thinking start event (extended thinking) | source |
ToolApprovalConfig | Tool approval configuration | source |
ToolCallCompleteEvent | Tool call complete event | source |
ToolCallInputEvent | Tool call input delta (streaming input JSON) | source |
ToolCallStartEvent | Tool call start event | source |
ToolResultEvent | Tool result event | source |
UploadResult | Upload result | source |
WebSocketPublisherConfig | WebSocket publisher configuration | source |
WorkspaceConfig | Workspace configuration | source |
WorkspaceSyncResult | Workspace sync result | source |
Constants
veryfront/workflow/claude-code/react
React hooks for Claude Code streaming
Functions
Types
| Name | Description | Source |
|---|---|---|
PendingApproval | Pending approval state | source |
PendingInput | Pending input request state | source |
UseClaudeCodeStreamOptions | Options for useClaudeCodeStream hook | source |
UseClaudeCodeStreamState | State for Claude Code streaming | source |
UseClaudeCodeWebSocketActions | Actions returned by the hook | source |
UseClaudeCodeWebSocketOptions | Options for useClaudeCodeWebSocket hook | source |
UseClaudeCodeWebSocketState | State for Claude Code WebSocket | source |
veryfront/workflow/discovery
Workflow Discovery Module Provides utilities for discovering workflow definitions from user code.
Functions
Types
veryfront/workflow/worker
Workflow worker module Provides distributed workflow execution support. Two execution profiles are available: 1. WorkflowWorker - In-process polling worker - Polls for stalled workflows and resumes them - Good for trusted code or single-tenant deployments - Simple setup, lower overhead 2. WorkflowRunManager + ProcessRunExecutor - Local process execution - Spawns child processes for each workflow - Good for local development without K8s/Docker A workflow run can be backed by a run executor without introducing another user-visible execution type.
Components
Functions
| Name | Description | Source |
|---|---|---|
createDynamicWorkflowRunEntrypoint | Create a dynamic workflow run entrypoint. | source |
createWorkflowRunEntrypoint | Create a workflow run entrypoint. | source |
createWorkflowRunManager | Create a workflow run manager backed by run executors. | source |
createWorkflowWorker | Create a workflow worker | source |
isRunExecutor | Type guard to check if an object implements RunExecutor | source |
runDynamicWorkflowRun | Run a workflow run with dynamic discovery. | source |
runWorkflowRun | Run the workflow run entrypoint | source |
Classes
Types
| Name | Description | Source |
|---|---|---|
CreateDynamicWorkflowRunEntrypointOptions | Create a dynamic workflow run entrypoint. | source |
CreateWorkflowRunEntrypointOptions | Create a simple workflow run entrypoint script. | source |
DynamicWorkflowRunEntrypointConfig | Configuration for the dynamic workflow run entrypoint. | source |
ManagerStats | Manager statistics | source |
ManagerStatus | Manager status | source |
ProcessRunExecutorConfig | Process run executor configuration | source |
RunExecutionConfig | Run execution configuration passed to executor | source |
RunExecutionInfo | Run execution information returned by executor | source |
RunExecutionStatus | Run execution status | source |
RunExecutor | Run Executor Interface | source |
WorkerStats | Worker statistics | source |
WorkerStatus | Worker status | source |
WorkflowRunEntrypointConfig | Configuration for the workflow run entrypoint. | source |
WorkflowRunManagerConfig | Configuration for the workflow run manager backed by run executors. | source |
WorkflowWorkerConfig | Configuration for the workflow worker | source |