feat(core): Add basic Sub-Agent support

This commit is contained in:
2025-12-26 19:19:02 +01:00
parent 0db472aaa5
commit b6ad2f09a5

View File

@@ -27,6 +27,14 @@ impl AgentManager {
&self.state
}
/// Spawn a sub-agent for a specific task
pub async fn spawn_sub_agent(&self, _task: &str) -> Result<String> {
// Basic placeholder implementation for Sub-Agent support
// In a real implementation, this would create a new AgentManager instance
// with a focused system prompt and context.
Ok("Sub-agent task completed (mock)".to_string())
}
/// Execute the reasoning loop: User Input -> LLM -> Thought/Action -> Result -> LLM
pub async fn step(&self, input: &str) -> Result<String> {
// 1. Add user message to history
@@ -101,4 +109,14 @@ mod tests {
let response = manager.step("Hello").await.unwrap();
assert_eq!(response, "Mock Response");
}
#[tokio::test]
async fn test_sub_agent_spawn() {
let client = Arc::new(MockProvider);
let state = Arc::new(Mutex::new(AppState::new()));
let manager = AgentManager::new(client, state);
let result = manager.spawn_sub_agent("Do something").await.unwrap();
assert_eq!(result, "Sub-agent task completed (mock)");
}
}