Expand description
Task graph types for the Director/Worker orchestrator.
A TaskGraph is a directed acyclic graph (DAG) of TaskNodes that the
orchestrator executor drives to completion in topological order. Nodes with
no unsatisfied dependencies run concurrently; each node executes as an
isolated AgentLoop worker with its own tool allowlist and context window.
§Validation
Call TaskGraph::new (preferred) or TaskGraph::validate_acyclic
(on a manually-constructed graph) before handing a graph to the executor.
Both methods check:
- All
depends_onids resolve to existing nodes. - The dependency edges form a true DAG (no cycles, no self-loops).
- Node count ≤
MAX_NODES. - Longest path depth ≤
MAX_DEPTH.
§Example
use std::collections::HashSet;
use gglib_core::domain::council::task_graph::{
TaskGraph, TaskNode, TaskNodeKind, NodeId, NodeStatus, HitlMode,
};
let nodes = vec![
TaskNode {
id: NodeId("research".into()),
goal: "Research the topic".into(),
depends_on: vec![],
tool_allowlist: vec!["web_search".into()],
kind: TaskNodeKind::Leaf,
role: None,
status: NodeStatus::Pending,
output: None,
compacted_output: None,
error: None,
},
TaskNode {
id: NodeId("draft".into()),
goal: "Write the first draft".into(),
depends_on: vec![NodeId("research".into())],
tool_allowlist: vec![],
kind: TaskNodeKind::Leaf,
role: None,
status: NodeStatus::Pending,
output: None,
compacted_output: None,
error: None,
},
];
let graph = TaskGraph::new("Write a research doc".into(), HitlMode::None, nodes).unwrap();
let ready = graph.ready_nodes(&HashSet::new());
assert_eq!(ready.len(), 1);
assert_eq!(ready[0], &NodeId("research".into()));Structs§
- Debate
Agent - An individual participant in a
TaskNodeKind::Debatenode. - Debate
Config - Complete configuration for a
TaskNodeKind::Debatenode. - Debate
Judge Config - Configuration for the optional judge that assesses each debate round.
- NodeId
- Opaque node identifier within a
TaskGraph. - Task
Graph - A validated directed acyclic graph of
TaskNodes. - Task
Node - A single work unit in a
TaskGraph.
Enums§
- Graph
Diff - A single mutation to apply to a
TaskGraphat runtime. - Hitl
Mode - Controls when the orchestrator executor pauses to request human approval.
- Node
Budget - Advisory upper bound on the aggregate node count across all subgraphs.
- Node
Status - Lifecycle state of a single
TaskNode. - Task
Graph Error - Error variants produced during
TaskGraphconstruction or validation. - Task
Node Kind - Execution kind for a
TaskNode: leaf worker, nested sub-team, or multi-agent debate.
Constants§
- BLACK 🔒
- GRAY 🔒
- MAX_
DEPTH - Maximum depth (longest root-to-leaf path) a
TaskGraphmay have per subgraph. - MAX_
NODES - Maximum number of nodes a
TaskGraphmay contain per subgraph. - MAX_
TOTAL_ NODES - Soft upper bound on the total node count across all subgraphs combined.
- WHITE 🔒