Module: RubyLLM::Agents::DSL

Included in:
BackgroundRemover, ImageAnalyzer, ImageEditor, ImagePipeline, ImageTransformer, ImageUpscaler, ImageVariator
Defined in:
lib/ruby_llm/agents/dsl.rb,
lib/ruby_llm/agents/dsl/base.rb,
lib/ruby_llm/agents/dsl/caching.rb,
lib/ruby_llm/agents/dsl/knowledge.rb,
lib/ruby_llm/agents/dsl/queryable.rb,
lib/ruby_llm/agents/dsl/reliability.rb

Overview

Domain-Specific Language modules for agent configuration.

The DSL modules provide a clean, declarative way to configure agents at the class level. Each module focuses on a specific concern:

  • Base - Core settings (model, description, timeout)

  • Reliability - Retries, fallbacks, circuit breakers

  • Caching - Response caching configuration

Examples:

Using all DSL modules

class MyAgent < RubyLLM::Agents::BaseAgent
  extend DSL::Base
  extend DSL::Reliability
  extend DSL::Caching

  model "gpt-4o"
  description "A helpful agent"
  timeout 30

  reliability do
    retries max: 3, backoff: :exponential
    fallback_models "gpt-4o-mini"
    circuit_breaker errors: 5, within: 60
  end

  cache_for 1.hour
end

Defined Under Namespace

Modules: Base, Caching, Knowledge, Queryable, Reliability