feat(topology): workflow of topologies (run_workflow)
Milestone-A second capability: chain whole topology runs in sequence, threading each stage's final output into the next stage's task (e.g. swarm brainstorm → hierarchical execute → debate review). Each stage is a full safe topology run, so §15 holds at every step. WorkflowRecord aggregates per-stage RunRecords + totals. Demonstrated in the benchmark example. 14 tests; clippy clean. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
e93a3cfb53
commit
92151f2a90
@@ -15,7 +15,7 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use cm_llm::LlmProvider;
|
||||
use cm_orchestrator::{compare, ProviderExecutor, RunRecord, Scorer};
|
||||
use cm_orchestrator::{compare, run_workflow, ProviderExecutor, RunRecord, Scorer};
|
||||
use cm_topology::{Edge, EdgeKind, Node, TopologyGraph, TopologyKind};
|
||||
|
||||
/// Deterministic quality proxy: richer (longer) output scores higher.
|
||||
@@ -130,4 +130,16 @@ async fn main() {
|
||||
if let Some(i) = cmp.best_value {
|
||||
println!("best value: {:?} (quality per token)", cmp.results[i].kind);
|
||||
}
|
||||
|
||||
// Workflow of topologies: brainstorm (swarm) → execute (hierarchical) → review (debate).
|
||||
let wf = run_workflow(&[swarm(), hierarchical(), debate()], task, &executor)
|
||||
.await
|
||||
.expect("workflow failed");
|
||||
println!("\nworkflow: swarm -> hierarchical -> debate");
|
||||
println!(
|
||||
" stages: {} turns: {} tokens: {}",
|
||||
wf.stages.len(),
|
||||
wf.totals.turns,
|
||||
wf.totals.tokens
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user