Skip to main content

bamboo_engine/runtime/managers/adapters/
mini_loop.rs

1use async_trait::async_trait;
2use bamboo_agent_core::tools::ToolCall;
3use bamboo_agent_core::{AgentError, Session};
4
5use crate::runtime::managers::mini_loop::{MiniLoopDecision, MiniLoopExecutor};
6
7/// Default mini-loop executor — placeholder that returns empty decisions.
8///
9/// In production, the agent loop uses direct LLM calls for task evaluation.
10/// This adapter provides a no-op fallback when no custom executor is configured.
11pub struct DefaultMiniLoopExecutor;
12
13#[async_trait]
14impl MiniLoopExecutor for DefaultMiniLoopExecutor {
15    async fn decide(
16        &self,
17        _session: &Session,
18        prompt: &str,
19        _context: &str,
20    ) -> Result<MiniLoopDecision, AgentError> {
21        // No-op: return the prompt as the answer.
22        Ok(MiniLoopDecision {
23            answer: prompt.to_string(),
24            prompt_tokens: 0,
25            completion_tokens: 0,
26        })
27    }
28
29    async fn evaluate_task(
30        &self,
31        _session: &Session,
32        _tool_calls: &[ToolCall],
33        _round: usize,
34    ) -> Result<MiniLoopDecision, AgentError> {
35        // No-op: return empty decision.
36        Ok(MiniLoopDecision {
37            answer: String::new(),
38            prompt_tokens: 0,
39            completion_tokens: 0,
40        })
41    }
42}