Execute a task by spawning an isolated child AgentLoop. `parent_session_id` flows into the emitted `SubagentStart`/`SubagentEnd` events so dashboards can associate child runs with the parent session.
(
&self,
params: TaskParams,
event_tx: Option<broadcast::Sender<AgentEvent>>,
parent_session_id: Option<&str>,
)
| 267 | /// `parent_session_id` flows into the emitted `SubagentStart`/`SubagentEnd` |
| 268 | /// events so dashboards can associate child runs with the parent session. |
| 269 | pub async fn execute( |
| 270 | &self, |
| 271 | params: TaskParams, |
| 272 | event_tx: Option<broadcast::Sender<AgentEvent>>, |
| 273 | parent_session_id: Option<&str>, |
| 274 | ) -> Result<TaskResult> { |
| 275 | let task_id = format!("task-{}", uuid::Uuid::new_v4()); |
| 276 | self.execute_with_task_id(task_id, params, event_tx, parent_session_id, true) |
| 277 | .await |
| 278 | } |
| 279 | |
| 280 | /// Execute a task using a caller-supplied task id. Used by `execute_background` |
| 281 | /// so the synchronously-returned task id matches the one in lifecycle events. |
no test coverage detected