Class: RubynCode::SubAgents::Runner
- Inherits:
-
Object
- Object
- RubynCode::SubAgents::Runner
- Defined in:
- lib/rubyn_code/sub_agents/runner.rb
Constant Summary collapse
- AGENT_TOOL_SETS =
{ explore: %w[read_file glob grep bash].freeze, general: nil # resolved at runtime to exclude sub-agent tools }.freeze
- SUB_AGENT_TOOLS =
%w[sub_agent spawn_agent].freeze
- MAX_ITERATIONS_HARD_LIMIT =
50
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(prompt:, llm_client:, project_root:, agent_type:, max_iterations:) ⇒ Runner
constructor
A new instance of Runner.
- #run ⇒ Object
Constructor Details
#initialize(prompt:, llm_client:, project_root:, agent_type:, max_iterations:) ⇒ Runner
Returns a new instance of Runner.
26 27 28 29 30 31 32 |
# File 'lib/rubyn_code/sub_agents/runner.rb', line 26 def initialize(prompt:, llm_client:, project_root:, agent_type:, max_iterations:) @prompt = prompt @llm_client = llm_client @project_root = File.(project_root) @agent_type = agent_type.to_sym @max_iterations = [max_iterations.to_i, MAX_ITERATIONS_HARD_LIMIT].min end |
Class Method Details
.call(prompt:, llm_client:, project_root:, agent_type: :explore, max_iterations: 30) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/rubyn_code/sub_agents/runner.rb', line 15 def call(prompt:, llm_client:, project_root:, agent_type: :explore, max_iterations: 30) new( prompt: prompt, llm_client: llm_client, project_root: project_root, agent_type: agent_type, max_iterations: max_iterations ).run end |
Instance Method Details
#run ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/rubyn_code/sub_agents/runner.rb', line 34 def run state = { conversation: build_conversation, executor: build_executor, tool_defs: build_tool_definitions, final_text: '' } @max_iterations.times do result = run_single_iteration(state) break if result == :done end Summarizer.call(state[:final_text]) end |