Class: Silas::NamedAgent

Inherits:
Object
  • Object
show all
Defined in:
lib/silas/named_agent.rb

Overview

Handle for a named top-level agent (app/agents//). Same surface as the root Agent — #start plus the definition readers — so call sites don't care which kind they hold. The only difference: sessions it starts are stamped with the agent's name, and the loop swaps in the agent's scope (tools, skills, instructions, digest) for every turn of those sessions.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scope) ⇒ NamedAgent

Returns a new instance of NamedAgent.



10
11
12
# File 'lib/silas/named_agent.rb', line 10

def initialize(scope)
  @scope = scope
end

Instance Attribute Details

#scopeObject (readonly)

Returns the value of attribute scope.



8
9
10
# File 'lib/silas/named_agent.rb', line 8

def scope
  @scope
end

Instance Method Details

#descriptionObject



25
# File 'lib/silas/named_agent.rb', line 25

def description = scope.agent.description

#limitsObject



26
# File 'lib/silas/named_agent.rb', line 26

def limits      = scope.agent.limits

#max_costObject



29
# File 'lib/silas/named_agent.rb', line 29

def max_cost    = scope.agent.max_cost

#max_input_tokensObject



28
# File 'lib/silas/named_agent.rb', line 28

def max_input_tokens = scope.agent.max_input_tokens

#max_stepsObject



27
# File 'lib/silas/named_agent.rb', line 27

def max_steps   = scope.agent.max_steps

#modelObject

Definition readers delegate to the scope's parsed agent.yml.



24
# File 'lib/silas/named_agent.rb', line 24

def model       = scope.agent.model

#nameObject



14
# File 'lib/silas/named_agent.rb', line 14

def name = scope.name

#start(input:, metadata: {}, channel: nil, continuation_token: nil) ⇒ Object



16
17
18
19
20
21
# File 'lib/silas/named_agent.rb', line 16

def start(input:, metadata: {}, channel: nil, continuation_token: nil)
  session = Session.create!(agent_name: name, metadata: ,
                            channel: channel, continuation_token: continuation_token)
  session.continue(input: input)
  session
end

#timeoutObject



30
# File 'lib/silas/named_agent.rb', line 30

def timeout     = scope.agent.timeout