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 content is removed from the main agent’s system prompt.

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Tools::Base

schema

Constructor Details

#initialize(main_session:) ⇒ DeactivateWorkflow

Returns a new instance of DeactivateWorkflow.

Parameters:

  • main_session (Session)

    the session to deactivate the workflow on



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

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

Class Method Details

.descriptionObject



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

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

.input_schemaObject



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

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

.tool_nameObject



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

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



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

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