class RubyLLM::AgUI::Configuration

Global configuration for the gem. Hosts usually set it once at boot:

RubyLLM::AgUI.configure do |config|
  config.run_store = MyRunStore.new
  config.redact    = ->(kind, payload) { MyRedactor.call(kind, payload) }
  config.logger    = Rails.logger
end

Every value can be overridden per run by passing the matching keyword to RubyLLM::AgUI::Run.new.

Attributes

allow_client_history[RW]

Whether client-supplied message history is reconciled against host-stored history. Always off in the first release: client messages are never trusted as system or tool turns.

clock[RW]

A callable returning the current UTC Time. Injected in tests.

interrupt_ttl[RW]

How long an interrupt stays answerable, in seconds.

logger[RW]

A Logger used for host-side diagnostics. Never receives prompts, raw tool payloads or credentials.

max_context[RW]

Maximum number of context entries accepted in RunAgentInput.

max_input_bytes[RW]

Maximum accepted request body size in bytes.

max_messages[RW]

Maximum number of messages accepted in RunAgentInput.

max_tools[RW]

Maximum number of tools accepted in RunAgentInput.

protocol_version[RW]

The AG-UI protocol version this producer speaks, emitted on RUN_STARTED so a consumer can detect a downgrade.

redact[W]

A callable (kind, payload) — or (payload) — invoked before a tool result or activity payload reaches the wire. Return the value to publish.

It defaults to RubyLLM::AgUI::Redaction.default, which keeps the payload’s shape and withholds its content: the gem cannot know which part of a tool result is a secret, so it does not publish the raw value until a host says it is safe. Opt out with RubyLLM::AgUI::Redaction.method(:none), or replace it with your policy.

run_store[RW]

The object that reserves run identity and stores interrupts. Defaults to nil; set a RubyLLM::AgUI::Store::MemoryStore for single-process use, or a durable store for multi-process deployment.

Public Class Methods

new() click to toggle source
# File lib/ruby_llm/ag_ui/configuration.rb, line 62
def initialize
  @run_store = nil
  @redact = Redaction.method(:default)
  @logger = nil
  @protocol_version = '1.0'
  @max_input_bytes = 256_000
  @max_messages = 500
  @max_tools = 64
  @max_context = 64
  @interrupt_ttl = 900
  @clock = -> { Time.now.utc }
  @allow_client_history = false
end

Public Instance Methods

redact() click to toggle source

The redaction policy in force. Never nil: an unset or nil policy falls back to the default rather than publishing raw payloads.

# File lib/ruby_llm/ag_ui/configuration.rb, line 78
def redact
  @redact || Redaction.method(:default)
end
redaction() click to toggle source

Which policy is in force, for diagnostics: :default, :none or :custom.

# File lib/ruby_llm/ag_ui/configuration.rb, line 83
def redaction
  return :default if redact == Redaction.method(:default)
  return :none if redact == Redaction.method(:none)

  :custom
end
run_store!() click to toggle source

The run store, or nil when the host has not configured one.

# File lib/ruby_llm/ag_ui/configuration.rb, line 91
def run_store!
  @run_store || raise(ConfigurationError, 'No run_store is configured. ' \
                                          'Set RubyLLM::AgUI.config.run_store or pass store: to Run.new.')
end
to_h() click to toggle source

A snapshot of the configuration, for diagnostics and support reports. Never includes secrets.

# File lib/ruby_llm/ag_ui/configuration.rb, line 98
def to_h
  {
    run_store: run_store&.class&.name,
    redact: redaction,
    protocol_version: protocol_version,
    max_input_bytes: max_input_bytes,
    max_messages: max_messages,
    max_tools: max_tools,
    max_context: max_context,
    interrupt_ttl: interrupt_ttl,
    allow_client_history: allow_client_history
  }
end