You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(agent): address review comments for iteration limit fix
Changes:
- Extract tool budget prompt into reusable helper function build_tool_budget_prompt()
- Use dynamic tier ranges based on max_iterations (12%/20%/32%/48%/60%/80%)
- Apply budget awareness to both run() and process_message() code paths
- Update all test assertions from 10 to 25
- Add comprehensive doc comment with rollback guidance in schema.rs
Fixes review comments on PR #27
// Calculate dynamic tier ranges based on max_iterations
2748
+
let simple_min = std::cmp::max(1,(max_iterations asf32*0.12).round()asusize);
2749
+
let simple_max = std::cmp::max(2,(max_iterations asf32*0.2).round()asusize);
2750
+
let medium_min = std::cmp::max(3,(max_iterations asf32*0.32).round()asusize);
2751
+
let medium_max = std::cmp::max(5,(max_iterations asf32*0.48).round()asusize);
2752
+
let complex_min = std::cmp::max(8,(max_iterations asf32*0.6).round()asusize);
2753
+
let complex_max = std::cmp::max(12,(max_iterations asf32*0.8).round()asusize);
2754
+
2755
+
format!(
2756
+
"\n## Tool Use Budget\n\nYou have a maximum of {} tool-use iterations to complete this task. Plan efficiently:\n\n- **Complex tasks** (build projects, multiple files): ~{}-{} iterations\n- **Medium tasks** (modify existing code): ~{}-{} iterations\n- **Simple tasks** (read files, explain): ~{}-{} iterations\n\nIf approaching the limit, prioritize:\n1. Complete the critical path first (create → build → verify)\n2. Skip verification steps if already confident\n3. Provide partial results with explanation rather than failing\n\n",
// Wires up all subsystems (observer, runtime, security, memory, tools,
2746
2763
// provider, hardware RAG, peripherals) and enters either single-shot or
@@ -3027,10 +3044,7 @@ pub async fn run(
3027
3044
}else{
3028
3045
config.agent.max_tool_iterations
3029
3046
};
3030
-
system_prompt.push_str(&format!(
3031
-
"\n## Tool Use Budget\n\nYou have a maximum of {} tool-use iterations to complete this task. Plan efficiently:\n\n- **Complex tasks** (build projects, multiple files): ~15-20 iterations\n- **Medium tasks** (modify existing code): ~8-12 iterations\n- **Simple tasks** (read files, explain): ~3-5 iterations\n\nIf approaching the limit, prioritize:\n1. Complete the critical path first (create → build → verify)\n2. Skip verification steps if already confident\n3. Provide partial results with explanation rather than failing\n\n",
0 commit comments