PoC: Verified end-to-end Agent Inception and isolated task execution
This commit is contained in:
@@ -194,8 +194,8 @@ impl CHORUSAgent {
|
||||
let _ = self.graph.insert_node("task_log", log_entry);
|
||||
let _ = self.graph.commit(&format!("Logged task: {}", msg.topic));
|
||||
|
||||
// 1. Delegation logic (Leader only)
|
||||
if msg.topic == "task" && self.election.is_leader() {
|
||||
// 1. Delegation logic (Leader or Senior Architect)
|
||||
if msg.topic == "task" && (self.election.is_leader() || self.role == Role::SeniorSoftwareArchitect || self.role == Role::Architect) {
|
||||
let peers_vec: Vec<Peer> = self.peers.values().cloned().collect();
|
||||
if !peers_vec.is_empty() {
|
||||
let sub_tasks = self.council.delegate_work(msg.id, "System implementation", &peers_vec);
|
||||
@@ -207,7 +207,7 @@ impl CHORUSAgent {
|
||||
}
|
||||
|
||||
// 2. Execution logic
|
||||
if msg.topic == "implementation_task" || msg.topic == "execution_task" {
|
||||
if msg.topic == "implementation_task" || msg.topic == "execution_task" || msg.topic == "planning_task" {
|
||||
let workspace_path = if let Some(mgr) = &self.code_edit {
|
||||
println!("[AGENT {}] Preparing workspace for task...", self.id);
|
||||
let _ = mgr.spawn_task_branch(&msg.id.to_string());
|
||||
@@ -217,15 +217,18 @@ impl CHORUSAgent {
|
||||
None
|
||||
};
|
||||
|
||||
println!("[AGENT {}] Incepting sub-agent in sandbox...", self.id);
|
||||
let reasoning = self.think(&format!("Task: {:?}", msg.payload)).await;
|
||||
let task_desc = msg.payload["description"].as_str().unwrap_or("No description provided");
|
||||
let task_instr = msg.payload["instruction"].as_str().unwrap_or("Execute the task.");
|
||||
|
||||
println!("[AGENT {}] Incepting sub-agent for: {}", self.id, task_desc);
|
||||
let reasoning = self.think(task_desc).await;
|
||||
|
||||
let req = TaskRequest {
|
||||
language: "base".into(),
|
||||
code: None,
|
||||
agent_prompt: Some(format!("Your role: {}. {}", self.system_prompt, reasoning)),
|
||||
agent_prompt: Some(format!("Role: {}. Context: {}. Task: {}. Instruction: {}", self.system_prompt, reasoning, task_desc, task_instr)),
|
||||
workspace_path,
|
||||
timeout_secs: 300,
|
||||
timeout_secs: 600,
|
||||
};
|
||||
match self.executor.execute(req).await {
|
||||
Ok(res) => {
|
||||
|
||||
Reference in New Issue
Block a user