feat: refactor agent step limits and enhance workflow orchestration with new findings tool
This commit is contained in:
@@ -162,6 +162,7 @@ pub fn all_tools() -> Vec<Box<dyn Tool>> {
|
||||
Box::new(super::tool::plan::PlanReady),
|
||||
Box::new(super::tool::workflow::WorkflowRun),
|
||||
Box::new(super::tool::workflow::NoteFinding),
|
||||
Box::new(super::tool::workflow::ReadFindings),
|
||||
Box::new(super::tool::workflow::CompanyPipeline),
|
||||
Box::new(super::tool::spawn::SpawnAgents),
|
||||
Box::new(super::tool::spawn::SpawnPipeline),
|
||||
|
||||
@@ -209,3 +209,43 @@ impl Tool for CompanyPipeline {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Tool that retrieves all findings shared by sibling agents in the current workflow run.
|
||||
pub struct ReadFindings;
|
||||
|
||||
impl Tool for ReadFindings {
|
||||
fn name(&self) -> &'static str {
|
||||
"read_findings"
|
||||
}
|
||||
|
||||
fn description(&self) -> &'static str {
|
||||
"Retrieve all findings shared by sibling agents in the current workflow run. Use this to get real-time context updates from other divisions/subagents working in parallel."
|
||||
}
|
||||
|
||||
fn parameters(&self) -> Value {
|
||||
json!({
|
||||
"type": "object",
|
||||
"properties": {}
|
||||
})
|
||||
}
|
||||
|
||||
fn run(&self, ctx: &ToolCtx, _args: &Value) -> Result<String> {
|
||||
if let Some(ref findings) = ctx.workflow_findings {
|
||||
let f = findings.lock().map_err(|e| anyhow!("poisoned lock: {e}"))?;
|
||||
if f.is_empty() {
|
||||
Ok("No findings recorded yet in this workflow run.".to_string())
|
||||
} else {
|
||||
let formatted = f
|
||||
.iter()
|
||||
.enumerate()
|
||||
.map(|(i, f)| format!("{}. {}", i + 1, f))
|
||||
.collect::<Vec<_>>()
|
||||
.join("\n");
|
||||
Ok(format!("Findings in this workflow run:\n{}", formatted))
|
||||
}
|
||||
} else {
|
||||
Ok("No findings database available (called outside a workflow run).".to_string())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user