Start here · Architecture chooser

Choose an integration layer

Keep your existing architecture. Adopt the lowest Heddle layer that already owns the runtime mechanics your product needs.

Customization depth

Independent levels 1–5

Hosting depth

Independent levels A–F

Documentation status

Canonical reference

Assumptions

  • You know which server, transport, and UI layers your product already owns
  • You want Heddle to own reusable agent mechanics without becoming your application framework
Heddle owns
  • Conversation semantics, tools, traces, artifacts, and approval lifecycle
  • Optional process-local run identity, replay, cancellation, and remote protocol correctness
Your product owns
  • Existing server and client framework choices
  • Identity, authorization, public API, persistence policy, deployment, and UI

Choose by what your host already has

Existing product shapeStart withStatus
Nothing beyond a TypeScript processrunQuickstartConversationCliSupported SDK boundary and runnable example
A local process that needs product tools or MCPQuickstart plus host extensionsRunnable examples
A process that owns output or a local UIcreateConversationEngineSupported SDK boundary
A server, worker, or Electron backend@roackb2/heddle/hostedSupported boundary and runnable service example
Express with REST + SSE@roackb2/heddle/hosted/http-sseSupported helper and runnable Express example
A remote JavaScript client over any transport@roackb2/heddle-remoteSupported browser-safe protocol package
A browser using the conventional REST/SSE contract@roackb2/heddle-remote/http-sseSupported helper and runnable client example
A React/Vite productRemote client plus the React referenceRunnable reference, not a React SDK
Fastify, Hono, Nest, tRPC, WebSocket, or IPCHosted service plus a host adapterAdaptation guide
Multi-process or serverless active runsHosted service plus shared routing or deliveryArchitecture guidance

Customization and hosting are different decisions

The root @roackb2/heddle package exposes a progressive customization ladder:

  1. stand up a persisted conversation;
  2. add tools, MCP, and capability-specific context;
  3. shape output and consume results;
  4. own sessions, approvals, and lifecycle;
  5. inject production session and artifact storage.

Hosting is an optional second axis. Add /hosted only when execution must be independently addressable, cancellable, or reconnectable. Add the remote package only when events cross a transport boundary.

Entry-point boundaries

ImportAssumption it adds
@roackb2/heddleA Node host wants the curated conversation SDK
@roackb2/heddle/hostedOne long-lived process owns active runs and bounded replay
@roackb2/heddle/hosted/http-sseThe host chose conventional Node HTTP/SSE framing
@roackb2/heddle-remoteA JavaScript client consumes validated run envelopes
@roackb2/heddle-remote/http-sseThat client chose the conventional REST/SSE resource
@roackb2/heddle/advancedA Node host needs lower-level runtime assembly

The advanced entrypoint does not implicitly opt into hosting or remote transport.

Stop at the neutral boundary

For tRPC, Fastify, Hono, Nest, WebSocket, Electron IPC, or queues, stop at the transport-neutral run service and implement the adapter inside the framework your product already uses. Preserve stable run identity, ordered sequences, cursor replay, explicit cancellation, and exactly one terminal event.

Continue to Responsibility boundary before implementation, or start the first-agent tutorial if you are evaluating from scratch.

Canonical sources