diff --git a/ra_aid/__main__.py b/ra_aid/__main__.py index 64f1605..8c92b15 100644 --- a/ra_aid/__main__.py +++ b/ra_aid/__main__.py @@ -287,6 +287,16 @@ Examples: action="store_true", help="Display model thinking content extracted from think tags when supported by the model", ) + parser.add_argument( + "--reasoning-assistance", + action="store_true", + help="Force enable reasoning assistance regardless of model defaults", + ) + parser.add_argument( + "--no-reasoning-assistance", + action="store_true", + help="Force disable reasoning assistance regardless of model defaults", + ) if args is None: args = sys.argv[1:] parsed_args = parser.parse_args(args) @@ -578,6 +588,8 @@ def main(): config_repo.set("experimental_fallback_handler", args.experimental_fallback_handler) config_repo.set("web_research_enabled", web_research_enabled) config_repo.set("show_thoughts", args.show_thoughts) + config_repo.set("force_reasoning_assistance", args.reasoning_assistance) + config_repo.set("disable_reasoning_assistance", args.no_reasoning_assistance) # Build status panel with memory statistics status = build_status() @@ -651,6 +663,8 @@ def main(): config_repo.set("expert_model", args.expert_model) config_repo.set("temperature", args.temperature) config_repo.set("show_thoughts", args.show_thoughts) + config_repo.set("force_reasoning_assistance", args.reasoning_assistance) + config_repo.set("disable_reasoning_assistance", args.no_reasoning_assistance) # Set modification tools based on use_aider flag set_modification_tools(args.use_aider) @@ -740,6 +754,10 @@ def main(): # Store temperature in config config_repo.set("temperature", args.temperature) + + # Store reasoning assistance flags + config_repo.set("force_reasoning_assistance", args.reasoning_assistance) + config_repo.set("disable_reasoning_assistance", args.no_reasoning_assistance) # Set modification tools based on use_aider flag set_modification_tools(args.use_aider) diff --git a/ra_aid/agent_utils.py b/ra_aid/agent_utils.py index ed8ccbe..529fc30 100644 --- a/ra_aid/agent_utils.py +++ b/ra_aid/agent_utils.py @@ -674,8 +674,18 @@ def run_planning_agent( if provider_models and model_name in provider_models: model_config = provider_models[model_name] - # Check if reasoning assist is enabled - reasoning_assist_enabled = model_config.get("reasoning_assist_default", False) + # Check if reasoning assist is explicitly enabled/disabled + force_assistance = config.get("force_reasoning_assistance", False) if config else get_config_repository().get("force_reasoning_assistance", False) + disable_assistance = config.get("disable_reasoning_assistance", False) if config else get_config_repository().get("disable_reasoning_assistance", False) + + if force_assistance: + reasoning_assist_enabled = True + elif disable_assistance: + reasoning_assist_enabled = False + else: + # Fall back to model default + reasoning_assist_enabled = model_config.get("reasoning_assist_default", False) + logger.debug("Reasoning assist enabled: %s", reasoning_assist_enabled) # Get all the context information (used both for normal planning and reasoning assist) @@ -989,8 +999,18 @@ def run_task_implementation_agent( if provider_models and model_name in provider_models: model_config = provider_models[model_name] - # Check if reasoning assist is enabled - reasoning_assist_enabled = model_config.get("reasoning_assist_default", False) + # Check if reasoning assist is explicitly enabled/disabled + force_assistance = config.get("force_reasoning_assistance", False) if config else get_config_repository().get("force_reasoning_assistance", False) + disable_assistance = config.get("disable_reasoning_assistance", False) if config else get_config_repository().get("disable_reasoning_assistance", False) + + if force_assistance: + reasoning_assist_enabled = True + elif disable_assistance: + reasoning_assist_enabled = False + else: + # Fall back to model default + reasoning_assist_enabled = model_config.get("reasoning_assist_default", False) + logger.debug("Reasoning assist enabled: %s", reasoning_assist_enabled) # Initialize implementation guidance section diff --git a/ra_aid/prompts/reasoning_assist_prompt.py b/ra_aid/prompts/reasoning_assist_prompt.py index 20d7102..cf57ecd 100644 --- a/ra_aid/prompts/reasoning_assist_prompt.py +++ b/ra_aid/prompts/reasoning_assist_prompt.py @@ -3,8 +3,6 @@ REASONING_ASSIST_PROMPT_PLANNING = """Current Date: {current_date} Working Directory: {working_directory} -I am an agent and need your assistance in planning how to approach the following task in an agentic way. I'll be using the provided tools and context to complete this task, but I'd like your high-level strategic guidance before I start. - {base_task} @@ -33,38 +31,12 @@ I am an agent and need your assistance in planning how to approach the following {tool_metadata} -Please provide high-level planning guidance including: -1. Overall approach strategy -2. Key decision points to consider -3. Potential challenges and how to address them -4. Most effective tools to use for this task -5. Contingency plans if certain approaches don't work -6. Any critical insights from the provided context - -Focus on strategic thinking rather than implementation details. Your guidance will be used to create a detailed implementation plan. - -Please be concise, practical, and specific to this task. Avoid generic advice. - -Your sole output is a beautiful outline/pseudo code format to communicate the approach. Remember I am an agent and will use this logic to guide my actions. - -It should be the most beautiful, elegant, simple logic ever. - -YOUR OUTPUT MUST BE MARKDOWN. - -WE ARE IN THE **PLANNING** STAGE RIGHT NOW. NO CODE SHOULD BE WRITTEN. WE SHOULD BE THINKING LOGICALLY ABOUT HOW TO APPROACH THE PROBLEM, PLANNING OUT WHICH TASKS TO REQUEST IMPLEMENTATION OF, ETC. - -DO NOT OVERTHINK OR OVERCOMPLICATE THE ANSWER. YOU ARE AN EXPERT AND CAN RESPOND ASSERTIVELY AND CONFIDENTLY. +Given the available information, tools, and base task, write a couple paragraphs about how an agentic system might use the available tools to plan the base task, break it down into tasks, and request implementation of those tasks. The agent will not be writing any code at this point, so we should keep it to high level tasks and keep the focus on project planning. """ REASONING_ASSIST_PROMPT_IMPLEMENTATION = """Current Date: {current_date} Working Directory: {working_directory} -I am an agent about to implement the following task. I need your assistance in thinking through the implementation details in a structured, logical way before I start writing code. The task is: - - -{task} - - {key_facts} @@ -89,20 +61,9 @@ I am an agent about to implement the following task. I need your assistance in t {tool_metadata} -Please provide detailed implementation guidance including: -1. Code structure and patterns to follow -2. Potential edge cases to handle -3. Testing strategies to validate the implementation -4. Key files to modify and how -5. Dependencies and their interactions -6. Error handling considerations -7. Performance considerations + +{task} + -Please be concise, practical, and specific to this task. Avoid generic advice. - -Your output should include pseudo-code where appropriate and clear step-by-step implementation instructions. Remember I am an agent and will use this logic to guide my implementation actions. - -You are guiding an agent. Suggest how and when to use the tools. Write a couple paragraphs about it in markdown and you're done. - -DO NOT OVERTHINK OR OVERCOMPLICATE THE ANSWER. YOU ARE AN EXPERT AND CAN RESPOND ASSERTIVELY AND CONFIDENTLY. +Given the available information, tools, and base task, write a couple paragraphs about how an agentic system might use the available tools to implement the given task definition. The agent will be writing code and making changes at this point. """