Class: Agentic::AgentConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/agentic/agent_config.rb

Overview

Configuration object for an Agent

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, role:, backstory: nil, tools: [], llm_config: nil, options: {}) ⇒ AgentConfig

Initializes a new agent configuration

Parameters:

  • name (String)

    The name of the agent

  • role (String)

    The role of the agent

  • backstory (String, nil) (defaults to: nil)

    The backstory or additional context for the agent

  • tools (Array<String>) (defaults to: [])

    The tools available to the agent

  • llm_config (LlmConfig, nil) (defaults to: nil)

    The LLM configuration for the agent

  • options (Hash) (defaults to: {})

    Additional options for the agent



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/agentic/agent_config.rb', line 31

def initialize(
  name:,
  role:,
  backstory: nil,
  tools: [],
  llm_config: nil,
  options: {}
)
  @name = name
  @role = role
  @backstory = backstory
  @tools = tools
  @llm_config = llm_config || LlmConfig.new
  @options = options
end

Instance Attribute Details

#backstoryString

Returns The backstory or additional context for the agent.

Returns:

  • (String)

    The backstory or additional context for the agent



13
14
15
# File 'lib/agentic/agent_config.rb', line 13

def backstory
  @backstory
end

#llm_configLlmConfig

Returns The LLM configuration for the agent.

Returns:

  • (LlmConfig)

    The LLM configuration for the agent



19
20
21
# File 'lib/agentic/agent_config.rb', line 19

def llm_config
  @llm_config
end

#nameString

Returns The name of the agent.

Returns:

  • (String)

    The name of the agent



7
8
9
# File 'lib/agentic/agent_config.rb', line 7

def name
  @name
end

#optionsHash

Returns Additional options for the agent.

Returns:

  • (Hash)

    Additional options for the agent



22
23
24
# File 'lib/agentic/agent_config.rb', line 22

def options
  @options
end

#roleString

Returns The role of the agent.

Returns:

  • (String)

    The role of the agent



10
11
12
# File 'lib/agentic/agent_config.rb', line 10

def role
  @role
end

#toolsArray<String>

Returns The tools available to the agent.

Returns:

  • (Array<String>)

    The tools available to the agent



16
17
18
# File 'lib/agentic/agent_config.rb', line 16

def tools
  @tools
end

Instance Method Details

#to_hHash

Returns a hash representation of the agent configuration

Returns:

  • (Hash)

    The agent configuration as a hash



49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/agentic/agent_config.rb', line 49

def to_h
  {
    name: @name,
    role: @role,
    backstory: @backstory,
    tools: @tools,
    llm_config: {
      model: @llm_config.model,
      temperature: @llm_config.temperature
    },
    options: @options
  }
end