Class: Agentic::AgentSpecification

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

Overview

Value object representing requirements for an agent

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, description:, instructions:) ⇒ AgentSpecification

Initializes a new agent specification

Parameters:

  • name (String)

    The name of the agent

  • description (String)

    A description of the agent

  • instructions (String)

    Instructions for the agent



19
20
21
22
23
# File 'lib/agentic/agent_specification.rb', line 19

def initialize(name:, description:, instructions:)
  @name = name
  @description = description
  @instructions = instructions
end

Instance Attribute Details

#descriptionString (readonly)

Returns A description of the agent.

Returns:

  • (String)

    A description of the agent



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

def description
  @description
end

#instructionsString (readonly)

Returns Instructions for the agent.

Returns:

  • (String)

    Instructions for the agent



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

def instructions
  @instructions
end

#nameString (readonly)

Returns The name of the agent.

Returns:

  • (String)

    The name of the agent



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

def name
  @name
end

Class Method Details

.from_hash(hash) ⇒ AgentSpecification

Creates an AgentSpecification from a hash

Parameters:

  • hash (Hash)

    The hash representation

Returns:



38
39
40
41
42
43
44
# File 'lib/agentic/agent_specification.rb', line 38

def self.from_hash(hash)
  new(
    name: hash["name"],
    description: hash["description"],
    instructions: hash["instructions"]
  )
end

Instance Method Details

#to_hHash

Returns a serializable representation of the agent specification

Returns:

  • (Hash)

    The agent specification as a hash



27
28
29
30
31
32
33
# File 'lib/agentic/agent_specification.rb', line 27

def to_h
  {
    "name" => @name,
    "description" => @description,
    "instructions" => @instructions
  }
end