Skip to main content

Documentation Index

Fetch the complete documentation index at: https://veryfront.com/docs/llms.txt

Use this file to discover all available pages before exploring further.

veryfront/workflow

DAG-based agentic workflows with human-in-the-loop support.

Import

import {
  workflow,
  step,
  parallel,
  branch,
  waitForApproval,
  createWorkflowClient,
} from "veryfront/workflow";

Examples

Simple sequential workflow

import { workflow, step } from "veryfront/workflow";

const pipeline = workflow({
  id: "summarize",
  steps: () => [
    step("fetch", { tool: "webScraper" }),
    step("summarize", { agent: "writer" }),
  ],
});

Parallel steps and human-in-the-loop

import { workflow, step, parallel, branch, waitForApproval } from "veryfront/workflow";

const contentPipeline = workflow({
  id: "content-pipeline",
  steps: ({ input }) => [
    step("research", { agent: "researcher" }),
    parallel("generate", [
      step("write", { agent: "writer" }),
      step("images", { tool: "imageGenerator" }),
    ]),
    branch("review", {
      condition: () => input.requiresApproval,
      then: [waitForApproval("human-review", { timeout: "24h" })],
    }),
    step("publish", { agent: "publisher" }),
  ],
});

API

workflow(options)

Create a workflow definition.
PropertyTypeDescriptionSource
idstringUnique workflow identifiersource
description?stringHuman-readable descriptionsource
version?stringSemantic version stringsource
inputSchema?Schema<TInput>Zod schema for workflow input validationsource
outputSchema?Schema<TOutput>Zod schema for workflow output validationsource
retry?RetryConfigRetry configuration for failed stepssource
timeout?string | numberMax execution time (ms)source
introspect?booleanEnable runtime introspection for debuggingsource
stepsWorkflowNode[] | ((context: StepBuilderContext<TInput>) => WorkflowNode[])Workflow step definitionssource
onError?(error: Error, context: WorkflowContext) => void | Promise<void>Error handler called when a step failssource
onComplete?(result: TOutput, context: WorkflowContext) => void | Promise<void>Callback fired after workflow completessource
Returns: Workflow<TInput, TOutput>

Type Reference

StepOptions

Options accepted by step.
PropertyTypeDescriptionSource
agent?string | AgentAgent to run (by ID or instance)source
tool?string | ToolTool to execute (by ID or instance)source
input?string | Record<string, unknown> | ((context: WorkflowContext) => unknown)Step input: static value or function of workflow contextsource
checkpoint?booleanPersist state after this stepsource
retry?RetryConfigRetry configuration for this stepsource
timeout?string | numberStep timeout (ms)source
skip?(context: WorkflowContext) => boolean | Promise<boolean>Predicate: skip this step if returns truesource

BranchOptions

Options accepted by branch.
PropertyTypeDescriptionSource
condition(context: WorkflowContext) => boolean | Promise<boolean>Branch predicate functionsource
thenWorkflowNode[]Steps when condition is truesource
else?WorkflowNode[]Steps when condition is falsesource
checkpoint?booleanPersist state after this nodesource
retry?RetryConfigRetry configurationsource
timeout?string | numberNode timeout (ms or duration string)source
skip?(context: WorkflowContext) => boolean | Promise<boolean>Predicate: skip if returns truesource

ParallelOptions

Options accepted by parallel.
PropertyTypeDescriptionSource
strategy?"all" | "race" | "allSettled"Completion strategy ("all", "race", "allSettled")source
checkpoint?booleanPersist state after this nodesource
retry?RetryConfigRetry configurationsource
timeout?string | numberNode timeout (ms or duration string)source
skip?(context: WorkflowContext) => boolean | Promise<boolean>Predicate: skip if returns truesource

Exports

Functions

NameDescriptionSource
agentStepCreate a workflow step that runs an agent.source
branchCreate a conditional branch node.source
createWorkflowClientCreate workflow client.source
dagCreate a directed workflow graph.source
delayCreate a simple delay/sleep node.source
dependsOnDeclare workflow step dependencies.source
doWhileCreate a do-while workflow loop.source
generateIdGenerate a unique workflow IDsource
getWorkflowTenantGet the current workflow tenant context. Returns undefined if not executing within a workflow step.source
hasWorkerSupportCheck whether worker support is present.source
loopCreate a loop workflow step.source
mapCreate a mapped workflow step.source
parallelCreate a parallel node for concurrent execution of multiple steps.source
parseDurationParse duration string to millisecondssource
sequenceCreate a sequential workflow definition.source
stepCreate a workflow step definition.source
subWorkflowCreate a sub-workflow node for nested execution.source
timesCreate a fixed-count workflow loop.source
toolStepCreate a workflow step that runs a tool.source
unlessCreate a branch that only executes if condition is false.source
useApprovalManage workflow approval interactions.source
useWorkflowReact hook for workflow.source
useWorkflowListList and filter workflow runs.source
useWorkflowStartReact hook for workflow start.source
waitForApprovalCreate a wait-for-approval node. Pauses until human approves/rejects.source
waitForEventCreate a wait-for-event node. Pauses until external event is received.source
whenCreate a branch that only executes if condition is true (no else).source
workflowCreate a workflow definition.source

Classes

NameDescriptionSource
MemoryBackendImplement memory backend.source
RedisBackendImplement redis backend.source
WorkflowClientImplement workflow client.source
WorkflowExecutorWorkflow Executor classsource

Types

NameDescriptionSource
BackendConfigConfiguration used by backend.source
BranchOptionsOptions accepted by branch.source
CapturedTenantContextCaptured tenant context for multi-tenant workflow execution. Allows tools and framework utilities to access the current tenant without explicit parameter passing.source
LoopOptionsOptions accepted by loop.source
MapOptionsOptions accepted by map.source
ParallelOptionsOptions accepted by parallel.source
RedisAdapterStandardized Redis Adapter Interface Normalizes differences between Deno and Node Redis clientssource
RedisBackendConfigRedis backend configurationsource
StepOptionsOptions accepted by step.source
SubWorkflowOptionsOptions accepted by sub workflow.source
UseApprovalOptionsOptions accepted by use approval.source
UseApprovalResultResult returned from use approval.source
UseWorkflowListOptionsOptions accepted by use workflow list.source
UseWorkflowListResultResult returned from use workflow list.source
UseWorkflowOptionsOptions accepted by use workflow.source
UseWorkflowResultResult returned from use workflow.source
UseWorkflowStartOptionsOptions accepted by use workflow start.source
UseWorkflowStartResultResult returned from use workflow start.source
WaitForApprovalOptionsOptions accepted by wait for approval.source
WaitForEventOptionsOptions accepted by wait for event.source
WorkflowWorkflow instancesource
WorkflowBackendPublic API contract for workflow backend.source
WorkflowClientConfigConfiguration used by workflow client.source
WorkflowContextWorkflow context - accumulates node outputs during executionsource
WorkflowDefinitionWorkflow definitionsource
WorkflowExecutorConfigWorkflow executor configurationsource
WorkflowHandleController for a running workflow.source
WorkflowNodeWorkflow nodesource
WorkflowNodeConfigUnion of all workflow node configurationssource
WorkflowOptionsOptions accepted by workflow.source
WorkflowRunWorkflow run statesource
WorkflowStatusPublic API contract for workflow status.source

Constants

NameDescriptionSource
apiContext-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.
import { createAgent, createClaudeCodeTool, createEventPublisher } from "veryfront/workflow/claude-code";

Functions

NameDescriptionSource
createAgentCreate a reusable agent function with preset configuration.source
createClaudeCodeToolCreate a customized Claude Code toolsource
createEventPublisherCreate an event publisher based on environmentsource
createWebSocketHandlerCreate a WebSocket handler for HTTP upgrade requestssource
createWorkspaceSyncCreate a workspace sync for a Claude Code runsource
executeAgentExecute a task using the Claude Agent SDK.source
withWorkspaceExecute a function with a synchronized workspacesource

Classes

NameDescriptionSource
AgentControllerAgent controller for handling client commandssource
CallbackEventPublisherSimple callback-based publisher Calls a function for each eventsource
MemoryEventPublisherIn-memory event publisher using EventTarget Useful for testing or single-process deploymentssource
MultiEventPublisherPublishes events to multiple publisherssource
RedisEventPublisherImplement redis event publisher.source
SSEEventPublisherServer-Sent Events publisher Writes events directly to a ReadableStream controllersource
WebSocketPublisherWebSocket-based bidirectional publishersource
WorkspaceSyncWorkspace manager for Claude Code executionsource

Types

NameDescriptionSource
AgentConfigAgent configurationsource
ApprovalRequestEventApproval request event (sent to client when tool needs approval)source
BidirectionalPublisherBidirectional publisher interface (WebSocket)source
CancelCommandCancel the running agentsource
CancelledEventCancelled eventsource
ClaudeCodeEventUnion of all event typessource
ClaudeCodeEventBaseBase event interfacesource
ClaudeCodeEventHandlerEvent subscriber callbacksource
ClaudeCodeEventPublisherEvent publisher interface for streaming eventssource
ClaudeCodeEventSubscriberEvent subscriber interface for receiving eventssource
ClaudeCodeEventTypeEvent types for streaming Claude Code executionsource
ClaudeCodeModeTool modes for Claude Code agentsource
ClaudeCodeResultFinal result from agent executionsource
ClaudeCodeToolInputInput schema type for claude-code workflow toolssource
ClientCommandUnion of all client commandssource
ClientCommandHandlerHandler for client commandssource
ClientCommandTypeClient command types for WebSocket communicationsource
CompleteEventComplete event (agent finished)source
ErrorEventError eventsource
FileChangeFile change trackingsource
InputCommandSend user input to the agentsource
InputRequestEventInput request event (sent to client when agent needs user input)source
IterationCompleteEventIteration complete eventsource
IterationStartEventIteration start eventsource
PingCommandKeepalive pingsource
PongEventPong response to pingsource
RedisEventPublisherConfigRedis event publisher configurationsource
TextCompleteEventText complete eventsource
TextDeltaEventText delta event (streaming text chunk)source
ThinkingCompleteEventThinking complete eventsource
ThinkingDeltaEventThinking delta eventsource
ThinkingStartEventThinking start event (extended thinking)source
ToolApprovalConfigTool approval configurationsource
ToolCallCompleteEventTool call complete eventsource
ToolCallInputEventTool call input delta (streaming input JSON)source
ToolCallStartEventTool call start eventsource
ToolResultEventTool result eventsource
UploadResultUpload resultsource
WebSocketPublisherConfigWebSocket publisher configurationsource
WorkspaceConfigWorkspace configurationsource
WorkspaceSyncResultWorkspace sync resultsource

Constants

NameDescriptionSource
bugFixToolBug fix tool (code mode)source
claudeCodeToolClaude Code tool for workflow stepssource
codeReviewToolCode review tool (analysis mode, read-only)source
docsToolDocumentation tool (code mode)source
refactorToolRefactoring tool (code mode)source

veryfront/workflow/claude-code/react

React hooks for Claude Code streaming
import { useClaudeCodeStream, useClaudeCodeText, useClaudeCodeWebSocket } from "veryfront/workflow/claude-code/react";

Functions

NameDescriptionSource
useClaudeCodeStreamReact hook for streaming Claude Code executionsource
useClaudeCodeTextSimplified hook that returns just the streaming textsource
useClaudeCodeWebSocketReact hook for bidirectional Claude Code streamingsource

Types

NameDescriptionSource
PendingApprovalPending approval statesource
PendingInputPending input request statesource
UseClaudeCodeStreamOptionsOptions for useClaudeCodeStream hooksource
UseClaudeCodeStreamStateState for Claude Code streamingsource
UseClaudeCodeWebSocketActionsActions returned by the hooksource
UseClaudeCodeWebSocketOptionsOptions for useClaudeCodeWebSocket hooksource
UseClaudeCodeWebSocketStateState for Claude Code WebSocketsource

veryfront/workflow/discovery

Workflow Discovery Module Provides utilities for discovering workflow definitions from user code.
import { createWorkflowRegistry, discoverWorkflows, findWorkflowById } from "veryfront/workflow/discovery";

Functions

NameDescriptionSource
createWorkflowRegistryCreate a workflow registry from discovered workflowssource
discoverWorkflowsDiscover all workflows in a projectsource
findWorkflowByIdFind a specific workflow by IDsource

Types

NameDescriptionSource
DiscoveredWorkflowDiscovered workflow infosource
WorkflowDiscoveryOptionsOptions for workflow discoverysource
WorkflowDiscoveryResultResult of workflow discoverysource

veryfront/workflow/worker

Workflow Worker Module Provides distributed workflow execution support. Three modes 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. WorkflowJobManager + K8sJobExecutor - Kubernetes Job-based execution - Each workflow runs in an ephemeral container - Complete tenant isolation (no shared state) - Required for multi-tenant untrusted code execution 3. WorkflowJobManager + ProcessJobExecutor - Local process execution - Spawns child processes for each workflow - Good for local development without K8s/Docker - Mirrors production behavior
import { createDynamicJobEntrypoint, createJobEntrypoint, createWorkflowJobManager } from "veryfront/workflow/worker";

Components

NameDescriptionSource
DYNAMIC_EXIT_CODESExit codes for the jobsource
EXIT_CODESExit codes for the jobsource

Functions

NameDescriptionSource
createDynamicJobEntrypointCreate dynamic job entrypoint.source
createJobEntrypointCreate job entrypoint.source
createWorkflowJobManagerCreate a workflow job managersource
createWorkflowWorkerCreate a workflow workersource
isJobExecutorType guard to check if an object implements JobExecutorsource
runDynamicWorkflowJobRun a workflow job with dynamic discoverysource
runWorkflowJobRun the workflow jobsource

Classes

NameDescriptionSource
K8sJobExecutorKubernetes Job Executorsource
ProcessJobExecutorProcess Job Executorsource
WorkflowJobManagerWorkflow Job Managersource
WorkflowWorkerImplement workflow worker.source

Types

NameDescriptionSource
CreateDynamicJobEntrypointOptionsCreate a dynamic job entrypointsource
CreateJobEntrypointOptionsCreate a simple job entrypoint scriptsource
DynamicJobEntrypointConfigConfiguration for the dynamic job entrypointsource
JobConfigJob configuration passed to executorsource
JobEntrypointConfigConfiguration for the job entrypointsource
JobExecutorJob Executor Interfacesource
JobInfoJob information returned by executorsource
JobStatusJob execution statussource
K8sClientKubernetes API client interfacesource
K8sJobExecutorConfigK8s Job Executor configurationsource
K8sJobSpecK8s Job specsource
K8sJobStatusResponseK8s Job status responsesource
ManagerStatsManager statisticssource
ManagerStatusManager statussource
ProcessJobExecutorConfigProcess Job Executor configurationsource
WorkerStatsWorker statisticssource
WorkerStatusWorker statussource
WorkflowJobManagerConfigConfiguration for the Workflow Job Managersource
WorkflowWorkerConfigConfiguration for the workflow workersource
Reference modules: User guides: Architecture: