Class: RubynCode::Agent::Loop
- Inherits:
-
Object
- Object
- RubynCode::Agent::Loop
- Includes:
- BackgroundJobHandler, FeedbackHandler, LlmCaller, ResponseParser, SystemPromptBuilder, ToolProcessor
- Defined in:
- lib/rubyn_code/agent/loop.rb
Constant Summary collapse
- MAX_ITERATIONS =
Config::Defaults::MAX_ITERATIONS
Constants included from FeedbackHandler
FeedbackHandler::NEGATIVE_PATTERNS, FeedbackHandler::POSITIVE_PATTERNS
Constants included from ToolProcessor
ToolProcessor::CORE_TOOLS, ToolProcessor::PLAN_MODE_RISK_LEVELS
Constants included from UsageTracker
UsageTracker::TASK_BUDGET_TOTAL
Constants included from SystemPromptBuilder
SystemPromptBuilder::INSTRUCTION_FILES
Constants included from Prompts
Prompts::PLAN_MODE_PROMPT, Prompts::SYSTEM_PROMPT
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#initialize(**opts) ⇒ Loop
constructor
A new instance of Loop.
-
#send_message(user_input) ⇒ String
Send a user message and run the agent loop until a final text response is produced or the iteration limit is reached.
Constructor Details
#initialize(**opts) ⇒ Loop
Returns a new instance of Loop.
38 39 40 41 42 |
# File 'lib/rubyn_code/agent/loop.rb', line 38 def initialize(**opts) assign_dependencies(opts) assign_callbacks(opts) @plan_mode = false end |
Instance Attribute Details
#codebase_index ⇒ Index::CodebaseIndex? (readonly)
48 49 50 |
# File 'lib/rubyn_code/agent/loop.rb', line 48 def codebase_index @codebase_index end |
#plan_mode ⇒ Boolean
45 46 47 |
# File 'lib/rubyn_code/agent/loop.rb', line 45 def plan_mode @plan_mode end |
Instance Method Details
#send_message(user_input) ⇒ String
Send a user message and run the agent loop until a final text response is produced or the iteration limit is reached.
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/rubyn_code/agent/loop.rb', line 55 def (user_input) initialize_session! check_user_feedback(user_input) drain_background_notifications inject_skill_listing unless @skills_injected @decision_compactor&.detect_topic_switch(user_input) @skill_ttl&.tick! @conversation.(user_input) reset_iteration_state MAX_ITERATIONS.times do |iteration| result = run_iteration(iteration) return result if result end RubynCode::Debug.warn("Hit MAX_ITERATIONS (#{MAX_ITERATIONS})") max_iterations_warning end |