Class: ActiveAgent::Task
- Inherits:
-
Object
- Object
- ActiveAgent::Task
- Defined in:
- lib/active_agent/task.rb
Overview
Defines a discrete task to be executed by an assigned Agent.
Instance Attribute Summary collapse
-
#agent ⇒ Object
readonly
Returns the value of attribute agent.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#expected_output ⇒ Object
readonly
Returns the value of attribute expected_output.
-
#output ⇒ Object
Returns the value of attribute output.
Instance Method Summary collapse
- #execute(context: nil) ⇒ Object
-
#initialize(description:, agent:, expected_output: nil) ⇒ Task
constructor
A new instance of Task.
Constructor Details
#initialize(description:, agent:, expected_output: nil) ⇒ Task
Returns a new instance of Task.
9 10 11 12 13 14 |
# File 'lib/active_agent/task.rb', line 9 def initialize(description:, agent:, expected_output: nil) @description = description @agent = agent @expected_output = expected_output @output = nil end |
Instance Attribute Details
#agent ⇒ Object (readonly)
Returns the value of attribute agent.
6 7 8 |
# File 'lib/active_agent/task.rb', line 6 def agent @agent end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
6 7 8 |
# File 'lib/active_agent/task.rb', line 6 def description @description end |
#expected_output ⇒ Object (readonly)
Returns the value of attribute expected_output.
6 7 8 |
# File 'lib/active_agent/task.rb', line 6 def expected_output @expected_output end |
#output ⇒ Object
Returns the value of attribute output.
7 8 9 |
# File 'lib/active_agent/task.rb', line 7 def output @output end |
Instance Method Details
#execute(context: nil) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/active_agent/task.rb', line 16 def execute(context: nil) @output = @agent.execute_task( @description, expected_output: @expected_output, context: context ) @output end |