Class: AnalyticalBrain::Tools::ReadWorkflow
- Inherits:
-
Tools::Base
- Object
- Tools::Base
- AnalyticalBrain::Tools::ReadWorkflow
- Defined in:
- lib/analytical_brain/tools/read_workflow.rb
Overview
Reads and activates a workflow on the main session. Returns the full workflow content so the brain can create goals from it. Also sets the workflow as active on the session, injecting its content into the main agent’s “Your Expertise” section.
Class Method Summary collapse
Instance Method Summary collapse
- #execute(input) ⇒ String, Hash
-
#initialize(main_session:) ⇒ ReadWorkflow
constructor
A new instance of ReadWorkflow.
Methods inherited from Tools::Base
Constructor Details
#initialize(main_session:) ⇒ ReadWorkflow
Returns a new instance of ReadWorkflow.
25 26 27 |
# File 'lib/analytical_brain/tools/read_workflow.rb', line 25 def initialize(main_session:, **) @main_session = main_session end |
Class Method Details
.description ⇒ Object
12 |
# File 'lib/analytical_brain/tools/read_workflow.rb', line 12 def self.description = "Activate a workflow and return its content for goal planning." |
.input_schema ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/analytical_brain/tools/read_workflow.rb', line 14 def self.input_schema { type: "object", properties: { workflow_name: {type: "string"} }, required: %w[workflow_name] } end |
.tool_name ⇒ Object
10 |
# File 'lib/analytical_brain/tools/read_workflow.rb', line 10 def self.tool_name = "read_workflow" |
Instance Method Details
#execute(input) ⇒ String, Hash
32 33 34 35 36 37 38 39 40 |
# File 'lib/analytical_brain/tools/read_workflow.rb', line 32 def execute(input) workflow_name = input["workflow_name"].to_s.strip return {error: "Workflow name cannot be blank"} if workflow_name.empty? workflow = @main_session.activate_workflow(workflow_name) format_workflow(workflow) rescue Workflows::InvalidDefinitionError => error {error: error.} end |