feat: refactor agent step limits and enhance workflow orchestration with new findings tool

This commit is contained in:
asepharyana
2026-07-13 14:39:39 +07:00
parent 0d6f558b2b
commit 3b660e09a8
9 changed files with 229 additions and 100 deletions
+40
View File
@@ -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())
}
}
}