perf(agent): rombak alur AI agent — adaptif, hemat token, self-healing
Ganti explore phase MANDATORY (3 subagent tiap turn, boros) dengan tool explore_codebase yang DIPUTUSKAN agent sendiri (lazy, token-aware): - hapus ExploreService trait + with_explore + Phase 0 dari turn loop - ExploreServiceImpl kini jadi tool 'explore_codebase' (1 context-scout subagent, read-only, cap output 4k chars) - system prompt: instruksi TOKEN BUDGET (jawab langsung utk query simple, panggil explore_codebase sekali utk task kompleks) Loop utama kini adaptif & self-healing: - max_tokens adaptif (800/1600/4096 by request length) — bukan selalu 4096 - temperature 0.2 saat tool-calling, 0.7 utk final answer - ErrorTracker: deteksi tool error berulang → inject recovery note, stop setelah 8 error total (bukan 50 iterasi sia-sia) - auto-compact history > 60k chars sebelum LLM call - tool output di-truncate ke 12k chars sebelum masuk konteks Tambah 8 unit test (truncation, adaptive tokens, error tracker).
This commit is contained in:
@@ -19,8 +19,6 @@ pub trait AgentTurnService: Send + Sync {
|
||||
fn run_turn(&self, params: AgentTurnParams) -> impl Future<Output = Result<()>> + Send;
|
||||
}
|
||||
|
||||
pub mod explore;
|
||||
pub mod turn_service;
|
||||
|
||||
pub use explore::{ExploreOutput, ExploreService};
|
||||
pub use turn_service::{compact_messages_with_ai, AgentTurnServiceImpl};
|
||||
|
||||
Reference in New Issue
Block a user