Skip to content

Commit 7a11fc1

Browse files
committed
docs: document AutoAgents max_turns=10 hardcoded limitation
AutoAgents ReActAgent has max_turns hardcoded to 10 in current version. We calculate tier-aware max_iterations (Small: 5, Massive: 20) but cannot override ReActAgent's config() method. Impact: - Small/Medium tiers: Works fine (5-10 iterations) - Large tier: Capped at 10 instead of 15 - Massive tier: Capped at 10 instead of 20 Added max_iterations field to CodeGraphReActAgent for future use when AutoAgents allows configuration override. Workaround: Update to newer AutoAgents version or fork to allow configurable max_turns in ExecutorConfig.
1 parent 4225b24 commit 7a11fc1

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

crates/codegraph-mcp/src/autoagents/agent_builder.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ use crate::autoagents::codegraph_agent::CodeGraphAgentOutput;
319319
use autoagents::core::agent::memory::SlidingWindowMemory;
320320
use autoagents::core::agent::prebuilt::executor::ReActAgent;
321321
use autoagents::core::agent::AgentBuilder;
322-
use autoagents::core::agent::{AgentDeriveT, AgentHooks, AgentOutputT, DirectAgentHandle};
322+
use autoagents::core::agent::{AgentDeriveT, AgentHooks, AgentOutputT, DirectAgentHandle, ExecutorConfig};
323323
use autoagents::core::error::Error as AutoAgentsError;
324324
use autoagents::core::tool::{shared_tools_to_boxes, ToolT};
325325
use autoagents_derive::AgentHooks;
@@ -330,6 +330,7 @@ pub struct CodeGraphReActAgent {
330330
tools: Vec<Arc<dyn ToolT>>,
331331
system_prompt: String,
332332
analysis_type: AnalysisType,
333+
max_iterations: usize,
333334
}
334335

335336
impl AgentDeriveT for CodeGraphReActAgent {
@@ -370,6 +371,11 @@ impl AgentDeriveT for CodeGraphReActAgent {
370371

371372
impl AgentHooks for CodeGraphReActAgent {}
372373

374+
// NOTE: AutoAgents ReActAgent has max_turns hardcoded to 10 in version 8248b4e
375+
// We calculate tier-aware max_iterations (5-20) but can't override ReActAgent's config()
376+
// This is a known limitation - agents will stop at 10 turns regardless of tier
377+
// TODO: Update AutoAgents version or fork to allow configurable max_turns
378+
373379
/// Builder for CodeGraph AutoAgents workflows
374380
pub struct CodeGraphAgentBuilder {
375381
llm_adapter: Arc<CodeGraphChatAdapter>,
@@ -417,11 +423,16 @@ impl CodeGraphAgentBuilder {
417423
Arc::new(GetHubNodes::new(executor_adapter.clone())),
418424
];
419425

426+
// Get tier-aware max iterations
427+
let max_iterations = tier_plugin.get_max_iterations();
428+
tracing::info!("Setting ReActAgent max_turns={} for tier={:?}", max_iterations, self.tier);
429+
420430
// Create CodeGraph agent with tools and tier-aware system prompt
421431
let codegraph_agent = CodeGraphReActAgent {
422432
tools,
423433
system_prompt,
424434
analysis_type: self.analysis_type,
435+
max_iterations,
425436
};
426437

427438
// Build ReAct agent with our CodeGraph agent

0 commit comments

Comments
 (0)