Class: AnalyticalBrain::Tools::ReadWorkflow
Overview
Reads and activates a workflow on the main session. Returns the full workflow content so the brain can create goals from it. The workflow’s content enters the conversation as a phantom tool_use/tool_result pair through the PendingMessage promotion flow.
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Tools::Base
schema, truncation_threshold
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."
|
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
|
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.message}
end
|