Class: AnalyticalBrain::Tools::DeactivateWorkflow

Inherits:
Tools::Base
  • Object
show all
Defined in:
lib/analytical_brain/tools/deactivate_workflow.rb

Overview

Deactivates the current workflow on the main session. The workflow’s recalled message stays in the conversation and evicts naturally from the sliding window.

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Tools::Base

schema, truncation_threshold

Constructor Details

#initialize(main_session:) ⇒ DeactivateWorkflow

Returns a new instance of DeactivateWorkflow.

Parameters:

  • main_session (Session)

    the session to deactivate the workflow on



22
23
24
# File 'lib/analytical_brain/tools/deactivate_workflow.rb', line 22

def initialize(main_session:, **)
  @main_session = main_session
end

Class Method Details

.descriptionObject



11
# File 'lib/analytical_brain/tools/deactivate_workflow.rb', line 11

def self.description = "Deactivate the current workflow when it is complete or no longer relevant."

.input_schemaObject



13
14
15
16
17
18
19
# File 'lib/analytical_brain/tools/deactivate_workflow.rb', line 13

def self.input_schema
  {
    type: "object",
    properties: {},
    required: []
  }
end

.tool_nameObject



9
# File 'lib/analytical_brain/tools/deactivate_workflow.rb', line 9

def self.tool_name = "deactivate_workflow"

Instance Method Details

#execute(_input) ⇒ String

Returns confirmation message.

Parameters:

  • input (Hash<String, Object>)

    (no parameters needed)

Returns:

  • (String)

    confirmation message



28
29
30
31
32
# File 'lib/analytical_brain/tools/deactivate_workflow.rb', line 28

def execute(_input)
  previous = @main_session.active_workflow
  @main_session.deactivate_workflow
  previous ? "Deactivated workflow: #{previous}" : "No workflow was active"
end