the manual / sec 07

Package overview

looprig is a collection of small Go modules, not one all-inclusive framework. Applications import the boundaries they need and own the composition between them.

                         your application
        /             /          |          \             \
       v             v           v           v             v
 provider clients   harness    storage     sandbox    presentation
    llm module                  backends                 tui / serve
                       |
                       v
               core + inference + storage contracts

        flow is a sibling engine for durable workflow graphs

The harness stays provider-neutral and backend-neutral. Provider implementations live in llm. Durable backend implementations live in the storage modules. The application chooses and wires both.

Modules

ModuleWhat it ownsImport it when
coreshared content blocks, identifiers, logging contractsexchanging content or IDs across looprig modules
inferenceprovider-neutral invocation contracts, with focused model, stream, codec, context-counting, auth, routing, transport, and failure packagesdeclaring models or implementing an inference client
llmprovider clients and wire codecscalling OpenRouter, LM Studio, Bedrock, Google, Phala, Chutes, or another supported provider
harnessLoops, Rigs, Sessions, tool contracts, gates, journals, workspaces, delegation, servingbuilding and running an agent system
toolsoptional standard file, command, web, interaction, skill, and permission implementationsadding selected standard capabilities to a Loop
storageneutral ledger, lease, KV, and blob contracts plus in-memory implementationsimplementing a backend or running in memory
fsstorefilesystem implementations of all four storage contractspersisting one-host systems on local disk
natsstoreJetStream implementations of all four storage contractssharing durable state across processes or hosts
rclonestoreblob storage through rclonekeeping snapshots or offloads on an rclone-supported remote
sandboxaccess profiles, OS-level command enforcement, and honest guarantee reportsgiving agents command execution with an operating-system boundary
flowdurable graph execution, messages, checkpoints, ingress, and control planecoordinating explicit resumable workflows
tuireusable interactive terminal presentationbuilding a terminal interface over a Session adapter
coderiga complete coding Rigstudying a production composition or running CodeRig
testscross-module integration and compatibility testsvalidating development across the repository set

coderig and tests are useful references, but consumer applications do not need to import them.

Start with these imports

A text-only agent like the quickstart needs:

github.com/looprig/core
github.com/looprig/harness
github.com/looprig/inference
github.com/looprig/llm
github.com/looprig/storage

Add one durable backend when state must survive restart:

github.com/looprig/fsstore

or:

github.com/looprig/natsstore

Add github.com/looprig/tools for standard tools. Add github.com/looprig/sandbox when a Loop can spawn confined commands: its Profile drives both the access gate and OS enforcement. Add github.com/looprig/tui or the Harness serve package only when you want those presentation surfaces.

Harness package map

Most consumer code uses a small part of the harness module:

PackageConsumer role
pkg/loopdefine one agent’s identity, inference, instructions, tools, permissions, modes, and delegates
pkg/rigvalidate and assemble Loops with storage, workspaces, snapshots, limits, and lifecycle policy
pkg/sessionsubmit work, observe events, answer gates, interrupt, compact, checkpoint, and control one live execution
pkg/eventconsume typed ephemeral and enduring runtime events
pkg/tooldefine tool contracts, bindings, prepared requests, capability requirements, and command runners
pkg/gateevaluate the three access states and answer durable permission gates
pkg/sessionstoreopen durable Session journals, offloads, leases, and catalog state over storage.Composite
pkg/workspacestorecapture and materialize content-addressed workspace snapshots over storage.Blobs
pkg/serveexpose live and durable Session operations over HTTP and server-sent events
pkg/serve/catalogreaderconnect the durable session catalog to the HTTP read plane
pkg/hustledefine bounded inference jobs outside the normal turn lane, including compaction work
pkg/foreignloopintegrate supported foreign Claude or Codex execution engines

The normal construction path is:

loop.Define
    |
    v
rig.Define
    |
    +-------------------+
    v                   v
NewSession        RestoreSession
    |                   |
    +---------+---------+
              v
        session.Session

Read Loop, Rig, and Session in that order when you need to understand those boundaries in detail.

Inference packages

model.Model from github.com/looprig/inference/model describes a model without secrets. inference.Client performs provider calls. Keeping them separate lets a model declaration participate in validation and fingerprints without putting credentials into durable state.

The llm module contains concrete clients and an auto package for providers that can be constructed from a model plus API key. Providers with extra security or credential requirements expose direct constructors.

Applications own their model catalog. Declare capabilities such as tool or image support on each model, and keep credentials on the client side of the boundary.

Storage packages

The storage module defines four independent contracts:

  • Ledger for ordered append-only records;
  • Leaser for ownership and coordination;
  • KV for revisioned keyed state;
  • Blobs for content-addressed or named binary objects.

storage.Composite bundles one implementation of each contract because their method names overlap and cannot be implemented by one ordinary Go interface.

The harness uses them through two facades:

storage.Composite --> sessionstore.Store
storage.Blobs     --> workspacestore.Store

This means Session history and workspace snapshots can share a backend or use different ones. Build larger systems shows the standard choices.

Harness and flow

The harness and flow solve different problems:

HarnessFlow
runs model-driven Loopsruns explicit graph vertices
records agent turns, steps, gates, and tool activityrecords graph messages and checkpoints
supports delegation chosen by an agentsupports routing chosen by graph structure
exposes Session controlexposes workflow ingress and control

Use the harness alone for an agent or multi-agent system. Use flow alone for a durable graph without agents. Combine them in your application when a workflow vertex should start or resume agent work.

Presentation is optional

The main harness boundary is a Go session.Session. Nothing requires a specific interface. You can drive it from:

  • a one-shot command;
  • a terminal or desktop application;
  • an HTTP service;
  • a scheduled process;
  • a chat integration;
  • a workflow task;
  • another Go library.

Use the tui module when its terminal adapter fits. Use pkg/serve when its HTTP surface fits. Otherwise keep the Session interface and build the interaction model your product needs.

What the application owns

Across every module, your application remains the composition root. It owns:

  • model selection and provider credentials;
  • prompts, tools, permissions, and policy revisions;
  • Loop topology and delegation limits;
  • storage placement and retention;
  • workspace placement and the access profile command tools run under;
  • interfaces, authentication, and deployment;
  • restore compatibility and configuration migrations.

looprig supplies the reusable machinery and validates the boundaries. The Rig you assemble remains yours to run, change, and extend.