-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New config: GLOBAL_MAX_ITERATIONS #2121
Comments
Caveat: we also need to cap MAX_ITERATIONS to min(MAX_ITERATIONS, FULL_TASK_MAX_ITERATIONS - accumulated_iterations) every time a parent agent delegates a (sub)task to a new agent. |
Hi @li-boxuan !I would be happy to assist with this challenging task. Your documentation has helped me understand the problem very well. I have a question: Is there a way to address the prompt engineering issue that causes the parent agent to repeatedly delegate tasks? If so, where should I begin looking for the fix in the codebase? Additionally, if I were to start setting the iterations for the agents, where would you recommend I should begin reading the code in the codebase? Thank you very much! |
@prithvi2226 Please go ahead!
Yes but that's not what this issue is about. And I don't think prompt engineering is enough. We should systematically detect that and rejects the delegate request. That's harder and broader than what this issue is asking for.
Search for every place where |
Thank you for the guidance, @li-boxuan ! I understand that addressing the prompt engineering issue is a broader task. For now, I will focus on implementing the GLOBAL_MAX_ITERATIONS configuration. I will start by searching for every instance where MAX_ITERATIONS appears in the codebase and work on copying and modifying it to include the new configuration. If I have any further questions or run into any issues, I will reach out. Thanks again for your help! |
Hi @li-boxuan Update on Changes Made to Address Global Max Iterations Issue Objective: Implement a global_max_iterations cap to ensure no agent exceeds a predefined number of iterations, while allowing individual task-specific iterations to be lower if needed. Summary of Changes: opendevin/core/schema/config.py: opendevin/core/main.py: max_iterations = min(args.max_iterations, args.global_max_iterations) Used max_iterations when initializing the AgentController. opendevin/server/session/agent.py: tests/integration/regenerate.sh:
tests/unit/test_arg_parser.py: tests/unit/test_config.py: opendevin/controller/state/state.py: opendevin/controller/agent_controller.py: evaluation/swe_bench/run_infer.py: evaluation/mint/env.py: Next steps that I would take: Validation: Future Changes: Question for Confirmation: |
@prithvi2226 lol this reads like AI-generated. Did you use any AI tool to help you generate this summary? Regardless, this is too long of a proposal for a simple task. Please go ahead, create a PR, and let code talk. |
@li-boxuan ! Hahaha Yeah, I had written some notes in my obsidian, and told gpt to rephrase it in a "polite and respectful" way. Btw yeah I will create a pull request later this evening, thanks for making it smoother! |
General Changes: Iteration Limits Handling: Updated scripts to handle the max_iterations parameter appropriately. Logging Configuration: Enhanced logging setup and configuration for better debugging and monitoring. Error Handling and Logging: Improved error handling and logging across all scripts for better traceability and debugging. Code Cleanup: Improved readability, added comments, and ensured adherence to standard practices.
@li-boxuan ! Hi! I have opened a PR, and would love to know your thoughts on it, any feedback would be appreciated. Thank you very much! |
Is |
No, we didn't add a config called |
What problem or use case are you trying to solve?
We now have MAX_ITERATIONS config, which limits the number of turns/steps/iterations an agent could interact with LLM. This is very useful as a safe guard for user's wallet.
With #1910, an agent could delegate to another agent - every time a delegate agent is instantiated, it would have MAX_ITERATIONS as limit. I have seen a case where my parent agent (due to a bug in prompt engineering) keeps delegating a task to a child agent, who exhausts MAX_ITERATIONS and then gets invoked again in the next turn of parent agent. This means we effectively have MAX_ITERATIONS * MAX_ITERATIONS as the global limit, in the worst case.
We should have another config, e.g. GLOBAL_MAX_ITERATIONS (or maybe FULL_TASK_MAX_ITERATIONS) to control the total number of steps to finish a task.
Describe the UX of the solution you'd like
Do you have thoughts on the technical implementation?
Describe alternatives you've considered
Additional context
The text was updated successfully, but these errors were encountered: