Timeline Engine

The timeline engine manages how nodes execute over time and tracks their outputs, especially useful in interactive or long-running flows.

Responsibilities

  • Track step-by-step execution of nodes

  • Log intermediate results and state transitions

  • Handle delayed or asynchronous nodes (e.g., fetch, wait)

  • Enable replay or debugging of past executions

  • Support branching and conditional logic

Execution Modes

  1. Synchronous Execution Used for short flows that can complete immediately and return a result.

  2. Asynchronous / Deferred Execution For long-running tasks, external API waits, or streaming outputs.

  3. Stateful Execution Uses memory (short- or long-term) to influence flow logic across sessions.

Logging and Debugging

Each flow execution produces a timeline of events, including:

  • Node start and end timestamps

  • Input/output values

  • Errors (with stack trace)

  • Execution order

This data is stored per-execution and can be visualized in the UI.

Extending the Engine

To add custom execution behavior (e.g., streaming tokens, retries, branching logic):

tsCopyEditengine.registerNodeType('my-node', async (input, context) => {
  // Custom logic
  return { output: 'some result' };
});

The engine processes each node using a scheduler that respects topological order and handles failures gracefully.

Last updated