Class: Mistri::SubAgent::Runtime

Inherits:
Object
  • Object
show all
Defined in:
lib/mistri/sub_agent/runtime.rb

Overview

The live dependencies a host constructs for one dispatched child. Mistri verifies the provider and tools against the durable spec; the host owns tenant scope, backend isolation, and the freshness of every object placed here.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(provider:, system: nil, tools: [], schema: nil, cleanup: nil, **agent_options) ⇒ Runtime

Returns a new instance of Runtime.

Raises:

  • (ArgumentError)


40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/mistri/sub_agent/runtime.rb', line 40

def initialize(provider:, system: nil, tools: [], schema: nil, cleanup: nil,
               **agent_options)
  raise ArgumentError, "runtime tools must be an Array" unless tools.is_a?(Array)
  unless cleanup.nil? || cleanup.respond_to?(:call)
    raise ArgumentError, "runtime cleanup must be callable"
  end

  @provider = provider
  @system = system
  @tools = Array.new(tools).freeze
  @schema = schema
  @cleanup = cleanup
  @agent_options = agent_options.dup.freeze
  freeze
end

Instance Attribute Details

#agent_optionsObject (readonly)

Returns the value of attribute agent_options.



38
39
40
# File 'lib/mistri/sub_agent/runtime.rb', line 38

def agent_options
  @agent_options
end

#providerObject (readonly)

Returns the value of attribute provider.



38
39
40
# File 'lib/mistri/sub_agent/runtime.rb', line 38

def provider
  @provider
end

#schemaObject (readonly)

Returns the value of attribute schema.



38
39
40
# File 'lib/mistri/sub_agent/runtime.rb', line 38

def schema
  @schema
end

#systemObject (readonly)

Returns the value of attribute system.



38
39
40
# File 'lib/mistri/sub_agent/runtime.rb', line 38

def system
  @system
end

#toolsObject (readonly)

Returns the value of attribute tools.



38
39
40
# File 'lib/mistri/sub_agent/runtime.rb', line 38

def tools
  @tools
end

Instance Method Details

#closeObject



56
# File 'lib/mistri/sub_agent/runtime.rb', line 56

def close = @cleanup&.call