Class: Agentic::TaskDefinition

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

Overview

Value object representing a task definition

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(description:, agent:) ⇒ TaskDefinition

Initializes a new task definition

Parameters:

  • description (String)

    A description of the task

  • agent (AgentSpecification)

    The agent specification for this task



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

def initialize(description:, agent:)
  @description = description
  @agent = agent
end

Instance Attribute Details

#agentAgentSpecification (readonly)

Returns The agent specification for this task.

Returns:



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

def agent
  @agent
end

#descriptionString (readonly)

Returns A description of the task.

Returns:

  • (String)

    A description of the task



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

def description
  @description
end

Class Method Details

.from_hash(hash) ⇒ TaskDefinition

Creates a TaskDefinition from a hash

Parameters:

  • hash (Hash)

    The hash representation

Returns:



32
33
34
35
36
37
# File 'lib/agentic/task_definition.rb', line 32

def self.from_hash(hash)
  new(
    description: hash["description"],
    agent: AgentSpecification.from_hash(hash["agent"])
  )
end

Instance Method Details

#to_hHash

Returns a serializable representation of the task definition

Returns:

  • (Hash)

    The task definition as a hash



22
23
24
25
26
27
# File 'lib/agentic/task_definition.rb', line 22

def to_h
  {
    "description" => @description,
    "agent" => @agent.to_h
  }
end