StepflowStepflow

Timeline

Time-travel debugging with execution timelines

Timeline

The Timeline system records every significant event during a workflow execution, allowing for detailed auditing and time-travel debugging.

StepflowTimeline

The StepflowTimeline recorder captures events like step starts, completions, failures, and sleeps.

import { createTimeline } from "@stepflowjs/observability";

const timeline = createTimeline({
  config: {
    enabled: true,
    maxEntries: 10000,
  },
});

Recording Events

Events are typically recorded automatically by the Stepflow engine, but you can also record custom events.

timeline.record({
  type: "custom",
  executionId: "exec_123",
  workflowId: "my-workflow",
  data: { message: "Something happened" },
});

Retrieving Timeline

You can retrieve the full history of an execution to visualize it or debug issues.

const entries = timeline.getEntries("exec_123");

entries.forEach((entry) => {
  console.log(`${entry.timestamp.toISOString()}: ${entry.type}`);
});

Timeline Entry Types

Stepflow records a wide variety of event types:

  • execution:start, execution:complete, execution:failed
  • step:start, step:complete, step:failed, step:cached, step:retry
  • sleep:start, sleep:complete
  • event:wait, event:received, event:timeout
  • log:debug, log:info, log:warn, log:error

Configuration

OptionTypeDefaultDescription
enabledbooleantrueWhether timeline recording is enabled
maxEntriesnumber10000Max entries to keep in memory per execution
persistToStoragebooleanfalseWhether to persist timeline to storage

On this page