Class: RubyCode::Explorer
- Inherits:
-
Object
- Object
- RubyCode::Explorer
- Defined in:
- lib/rubycode/explorer.rb
Overview
Explorer engine that spawns a sub-agent for autonomous codebase exploration
Constant Summary collapse
- MAX_ITERATIONS =
15- ALLOWED_TOOLS =
%w[bash read search web_search fetch done].freeze
Instance Method Summary collapse
- #explore ⇒ Object
-
#initialize(adapter:, config:, query:, max_iterations: 10) ⇒ Explorer
constructor
A new instance of Explorer.
Constructor Details
#initialize(adapter:, config:, query:, max_iterations: 10) ⇒ Explorer
Returns a new instance of Explorer.
9 10 11 12 13 14 15 |
# File 'lib/rubycode/explorer.rb', line 9 def initialize(adapter:, config:, query:, max_iterations: 10) @adapter = adapter @config = config @query = query @max_iterations = max_iterations.clamp(1, MAX_ITERATIONS) @memory = Memory.new end |
Instance Method Details
#explore ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/rubycode/explorer.rb', line 17 def explore # Add user query to memory @memory.(role: "user", content: @query) # Build and run constrained agent loop agent_loop = build_constrained_loop puts "\nš Exploring codebase...\n" result = agent_loop.run puts "\nā Exploration complete\n\n" result end |