OpenViSTAI · Agents · Blockchain · Crypto
Menu
Agent Frameworks

DSPy.rb

DSPy.rb is a Ruby framework for building model-backed programs and AI agents. It uses task signatures and Sorbet contracts to define typed inputs and outputs, while Ruby code implements tools and controls state, permissions, errors, side effects, and iteration limits. Its described capabilities include evaluation and prompt optimization.

Independent OpenViST project profile, based on linked sources.

DSPy.rb — Ruby projects using task signatures and Sorbet contracts for model inputs and outputs
OpenViST project illustration. See the linked sources for product details.
Understand the project

Practical overview

When it fits

Use DSPy.rb when a Ruby application needs structured model-backed tasks and its own code should govern tools, permissions, side effects, and iteration. It also offers a path to evaluation and prompt optimization as the application develops.

Who it is for

  • Ruby developers building applications that call language models.
  • Teams that want typed task contracts and Ruby-controlled tool behavior in model-backed programs.
  • Developers evaluating or optimizing prompts and agent programs.

Documented uses

  • Define typed inputs and outputs for language-model tasks.
  • Connect a Ruby application to a provider through an adapter.
  • Add tools while retaining Ruby control over permissions and side effects.
  • Bound agent iteration and handle errors explicitly.
  • Evaluate programs and optimize prompts.
Before you choose

Requirements & limits

  • Requires Ruby 3.3 or newer and Bundler.
  • Every application needs both the dspy core gem and a provider adapter.
  • Provider-specific credentials are passed through application configuration; the framework does not load .env files automatically.
  • Model capabilities vary by provider and selected model, so adapter installation alone does not establish support for a particular feature.
  • The documented default local Ollama endpoint requires no API key; remote or protected endpoints may require configuration.

Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.

Source-based practical guide

Set up a provider adapter

Prepare a Ruby project to configure DSPy.rb with a documented provider.

Before you start

  • Ruby 3.3 or newer
  • Bundler
  • The dspy core gem and an adapter gem
  • A provider credential where required

Steps

  1. Add dspy and the adapter gem for the chosen provider to the Gemfile.

  2. Run bundle install.

  3. Provide the provider credential in the process environment when the provider requires one; DSPy.rb does not load .env files automatically.

  4. Configure DSPy::LM with the provider's model prefix and pass the credential where required.

Expected outcome

The project has the core framework and provider adapter installed and a provider configuration path.

Guide limitations

  • Provider and model capabilities vary; a model prefix does not establish support for structured outputs, tools, media, documents, or streaming.
  • The guide documents setup, not successful execution of a model call.
Evidence and transparency

Sources & review

Source record details
Source availability
Active
Sources checked
16 November 2026
Original website title
DSPy.rb Typed AI Agents in Ruby | DSPy.rb · Official homepage title · retained in its source language