Skip to content

Latest commit

 

History

History
79 lines (55 loc) · 1.87 KB

README.md

File metadata and controls

79 lines (55 loc) · 1.87 KB

@ellmers/task-graph

A lightweight library for building and executing DAG (Directed Acyclic Graph) pipelines of AI tasks. Provides persistent storage solutions and workflow management for complex task orchestration.

Installation

bun add @ellmers/task-graph

Basic Usage

import { TaskGraph, SingleTask, Dataflow, TaskGraphRunner } from "@ellmers/task-graph";

// Define tasks
class DataLoader extends SingleTask {
  /* ... */
}
class ModelRunner extends SingleTask {
  /* ... */
}

// Build graph
const graph = new TaskGraph()
  .addTask(new DataLoader({ id: "loader" }))
  .addTask(new ModelRunner({ id: "model" }))
  .addDataflow(new Dataflow("loader", "data", "model", "input"));

// Execute graph
const runner = new TaskGraphRunner(graph);
await runner.run(graph);

Core Concepts

Task Types

  • SingleTask: Atomic unit of work
  • CompoundTask: Group of tasks forming a subgraph
  • ArrayTask: Parallel task execution
  • JobQueueTask: Integration with job queues

See Task Types Documentation for more details

Task Graph and Workflow

  • TaskGraph: Manage tasks and dependencies
  • Workflow: Quick way to build complex workflows

See Task Graph and Workflow Documentation for more details

Storage

  • Task Output Repositories: Cache task outputs for faster re-runs
  • Task Graph Repositories: Persist workflow state

See Storage Module Documentation for more details

Testing

Run the full test suite:

bun test

License

Apache 2.0 - See LICENSE for details.