Lesson 24: Multi-Agent Architecture (MAA) Vertical Planning
Implement MAA vertical orchestration: runTasks with subagent_type and verification, planForEach sub-pipelines, and conclude verdict synthesis.
1. Why This Feature Exists
MAA (Multi-Agent Architecture) provides a structured pipeline for running batches of heterogeneous subagent tasks, verifying each result, and producing a formal conclusion.
2. Key Symbols and Exports
3. Implementation Walkthrough
import {
ProviderType,
resolveProvider,
initializeClient,
loadCredentials,
getDefaultModel,
withTaskAgents
} from 'merci-sdk';
const PROVIDER = resolveProvider();
const { client } = await initializeClient({ provider: PROVIDER, options: loadCredentials({ provider: PROVIDER }) });
const MODEL = getDefaultModel({ provider: PROVIDER });
withTaskAgents(client, [
{ name: 'analyzer', model: MODEL, systemPrompt: 'Analyze system metrics.' },
{ name: 'verifier', model: MODEL, systemPrompt: 'Verify findings against SLOs.' }
] });
const session = client.session(MODEL);
// MAA Vertical Flow: runTasks -> planForEach -> conclude
const result = await session.run(`
Objective: Assess cloud infrastructure health.
1. Run analyzer subagent on CPU and memory metrics.
2. Run verifier subagent on SLO compliance.
3. Conclude with an executive verdict.
`);
console.log('MAA Verdict:', result);4. Wire and Telemetry Mechanics
Subagents run in parallel or sequence, each verified against completion criteria, with final synthesis aggregated in the conclude stage.
5. Run the Example
Execute the runnable example directly from the repository root:
node examples/19_discussion.mjsRead the full example: examples/19_discussion.mjs →