Core Concepts

Start with a signature, choose a predictor, then wrap calls in a module when the program needs reusable Ruby composition. Use ReAct later, when the model should choose among typed tools.

The Programming Model

Signatures

A signature declares typed inputs, outputs, and task instructions.

Predictors

Execute a signature with Predict, ChainOfThought, or a bounded ReAct tool loop.

Modules

Encapsulate predictor calls and compose them with ordinary Ruby control flow.

Application State

Keep conversation history, user preferences, checkpoints, and other durable state in application-owned storage. Pass the state a module needs through typed inputs.

After these three abstractions, use the Build selector for examples, pipelines, retrieval, multimodal inputs, Toolsets, and stateful agents. Runtime context, events, interception, Rails, storage, observability, and troubleshooting live under Operate.

Learn the Concepts in Prerequisite Order

Read these concepts in order:

  1. Define an input/output contract with Signatures.
  2. Execute it with Predictors.
  3. Encapsulate and compose calls with Modules.
  4. Continue to Examples and Toolsets to build with evaluation data and tools.

Evaluation defines acceptable behavior. Optimizers use examples, metrics, and feedback to search supported program parameters.