BuildBlueprint RunnerIntroduction

Blueprint Runners

SDK source (GitHub): https://github.com/tangle-network/blueprint/tree/main/crates/runner

Blueprint Runners are the core orchestration components that execute Tangle Blueprints. They run each job to completion, route events to the right handler, and restart failed work.

In this section

What is a Blueprint Runner?

A Blueprint Runner is the runtime environment for your Tangle Blueprint. It:

  • Orchestrates job execution
  • Manages communication between different components
  • Handles event processing from the blockchain
  • Manages state and persistence
  • Ensures fault tolerance and reliability

Blueprint Runners follow a modular architecture with four main components: Routers, Producers, Consumers, and Background Services.

Blueprint Runner Architecture

The architecture of a Blueprint Runner consists of the following components:

Routers

Routers direct job calls to the appropriate job handlers based on job IDs. When a job is called, the router identifies the correct handler and passes the job parameters to it.

Producers

Producers listen for events (such as on-chain events from Tangle Network) and prepare them for processing. They convert raw event data into a format that can be processed by your job handlers.

Consumers

Consumers handle the results of processed jobs. They can perform actions such as sending transactions, updating state, or triggering other processes based on job results.

Background Services

Background Services are optional components that run continuously in the background. They can perform tasks such as monitoring, data collection, or periodic operations that are required for your jobs.

Blueprint Runner Lifecycle

A runner moves each job through six stages:

  1. Initialization: The Blueprint Runner loads configuration, sets up components, and establishes connections.
  2. Event Processing: Producers listen for events and convert them into job inputs.
  3. Job Routing: The router directs job inputs to the appropriate job handlers.
  4. Job Execution: Job handlers process the inputs and produce results.
  5. Result Handling: Consumers process job results and perform necessary actions.
  6. Continuous Operation: Background services run continuously to support the Blueprint Runner.

Next Steps

Build a runner: follow the step-by-step guide.