Class: Phronomy::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/phronomy/configuration.rb

Overview

Holds global configuration for the entire framework. Configure via the Phronomy.configure block.

Examples:

Phronomy.configure do |config|
  config.default_model    = "claude-3-5-sonnet-20241022"
  config.recursion_limit  = 50
end

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



64
65
66
67
68
69
70
# File 'lib/phronomy/configuration.rb', line 64

def initialize
  @recursion_limit = 25
  @tracer = Phronomy::Tracing::NullTracer.new
  @trace_pii = false
  @event_loop = false
  @event_loop_stop_grace_seconds = 5
end

Instance Attribute Details

#before_completionObject

Global before_completion hook callable (Proc / lambda). Called before every LLM request across all agents. Receives a Agent::BeforeCompletionContext; must return a Hash of params to merge, or nil to pass through unchanged.



26
27
28
# File 'lib/phronomy/configuration.rb', line 26

def before_completion
  @before_completion
end

#default_embedding_modelObject

Default embedding model name



17
18
19
# File 'lib/phronomy/configuration.rb', line 17

def default_embedding_model
  @default_embedding_model
end

#default_modelObject

Default LLM model name (nil delegates to RubyLLM default)



14
15
16
# File 'lib/phronomy/configuration.rb', line 14

def default_model
  @default_model
end

#event_loopObject

When true, workflow execution is driven by EventLoop instead of a synchronous loop in the calling thread. Defaults to false (sync mode).

See Also:



34
35
36
# File 'lib/phronomy/configuration.rb', line 34

def event_loop
  @event_loop
end

#event_loop_stop_grace_secondsObject

Grace period (in seconds) before the EventLoop background thread is force-killed after a cooperative stop request. Applies both to the overall thread join and to the drain-and-cancel phase when +stop(drain: true)+ is used. Default: 5 seconds.

See Also:



54
55
56
# File 'lib/phronomy/configuration.rb', line 54

def event_loop_stop_grace_seconds
  @event_loop_stop_grace_seconds
end

#loggerObject

Optional logger for framework diagnostic messages (e.g. unreachable-state warnings). Must respond to +#warn(message)+. When nil (default), messages are written to +$stderr+ via +Kernel#warn+.

Examples:

Phronomy.configure { |c| c.logger = Rails.logger }


47
48
49
# File 'lib/phronomy/configuration.rb', line 47

def logger
  @logger
end

#recursion_limitObject

Recursion limit for graph execution (default: 25)



29
30
31
# File 'lib/phronomy/configuration.rb', line 29

def recursion_limit
  @recursion_limit
end

#state_storeObject

Global state store for workflow persistence. When set, WorkflowRunner routes all state reads and writes through this store. Must be an instance of a class that inherits from Phronomy::StateStore::Base. Defaults to +nil+ (no persistence — state lives only for the duration of invoke).

Examples:

Phronomy.configure { |c| c.state_store = Phronomy::StateStore::InMemory.new }


62
63
64
# File 'lib/phronomy/configuration.rb', line 62

def state_store
  @state_store
end

#trace_piiObject

When true, user input and LLM output are recorded in trace spans. Defaults to false; set to true only in environments where PII capture is acceptable. Set to false in privacy-sensitive environments to prevent PII from reaching the tracing backend (OTel, Langfuse, etc.).



40
41
42
# File 'lib/phronomy/configuration.rb', line 40

def trace_pii
  @trace_pii
end

#tracerObject

Tracer instance



20
21
22
# File 'lib/phronomy/configuration.rb', line 20

def tracer
  @tracer
end