---
title: "Installation"
summary: "Install the package and only the peers the layers you import need."
package: "octaflow"
version: "0.44.0"
section: "Start here"
canonical_url: "https://octabits.io/platform/octaflow/start/installation"
---

# Installation

```bash
pnpm add octaflow zod
```

`zod` is a **required** peer. The heavy dependencies are **optional peers** — install only
what the layers you import need:

```bash
# Postgres store / gate / event sink
pnpm add pg

# pg-boss dispatcher, workers, cron scheduler
pnpm add pg-boss

# the model layer on this engine — AI steps, agents, case loops (@octabits-io/models/octaflow)
pnpm add @octabits-io/models ai @ai-sdk/provider
```

> Pure in-memory usage (great for tests and single-process apps) needs **nothing** beyond
> `zod` — the engine, `defineStep`/`buildWorkflow`, and the in-memory store are all in the core.

Each layer is a separate subpath export, so importing one never drags in another's heavy deps:

| Import | Layer | Heavy deps |
|---|---|---|
| `octaflow` | **core** — engine, `defineStep`/`buildWorkflow`, store/dispatcher/gate interfaces, in-memory store, observability | none |
| `octaflow/postgres` | **postgres** — `WorkflowStore` + `StepGate` + event sink over Postgres, with DDL | `pg` |
| `octaflow/pg-boss` | **pg-boss** — `Dispatcher` + step/DLQ workers + cron scheduler over pg-boss | `pg-boss` |

The model layer — instrumented models, cost, quota, `defineAiStep`, the hooks factory — was
`octaflow/ai` until 0.36 and is now `@octabits-io/models`.

Enforced dependency tree (`scripts/check-boundaries.mjs`, part of `lint`):

```
core       → (nothing internal)  forbid: ai, @ai-sdk, pg, pg-boss
postgres   → core                 forbid: ai, @ai-sdk, pg-boss
pg-boss    → core                 forbid: ai, @ai-sdk, pg
```