Advanced Orchestration Engines ⏱ 12 min read 📁 examples/19_discussion.mjs

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

runTasks(tasks)
Executes parallel or sequenced task briefs against typed subagents with per-task verification.
planForEach(items, template)
Generates parallel execution sub-pipelines for each item in a collection.
asVerdict() & conclude()
Synthesizes completed tasks into a final authoritative verdict with sign-off criteria.

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.mjs

Read the full example: examples/19_discussion.mjs →

Expected Output: Executes MAA vertical pipeline across analyzer and verifier subagents and renders final executive verdict.