feat: async research tool - runs in background, returns immediately
The research tool now spawns the scout agent in a background tokio task and returns immediately with a research_id placeholder. This allows the agent to continue working while research runs (30-120 seconds). Key changes: - New PendingResearchManager for tracking async research tasks - research tool returns immediately with placeholder containing research_id - research_status tool to check progress of pending research - Auto-injection of completed research at natural break points: - Start of each tool iteration (before LLM call) - Before prompting user in interactive mode - /research CLI command to list all research tasks - Updated system prompt to explain async behavior The agent can: - Continue with other work while research runs - Check status with research_status tool - Yield turn to user if results are critical before continuing
This commit is contained in:
@@ -210,6 +210,14 @@ pub async fn run_interactive<W: UiWriter>(
|
||||
// Display context window progress bar before each prompt
|
||||
display_context_progress(&agent, &output);
|
||||
|
||||
// Check for completed research and inject into context
|
||||
// This happens before prompting the user for input
|
||||
let injected_count = agent.inject_completed_research();
|
||||
if injected_count > 0 {
|
||||
println!("📋 {} research result(s) ready - injected into context", injected_count);
|
||||
println!();
|
||||
}
|
||||
|
||||
// Build prompt
|
||||
let prompt = build_prompt(in_multiline, agent_name, &active_project);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user