cd ~/projects
Level 2 · Multi-Agent System

Captain Cool

Multi-Agent IPL Strategist on Gemini

01. The Investigation

Why build this?

LLMs are trained on human consensus. They want to agree. Give five agents the same problem and they converge toward the same answer. Your "debate" becomes theater. The final output looks like deliberation — but it's really just consensus with extra steps and extra API cost.

The thesis: To force genuine adversarial critique, the constraint must be architectural, not stylistic.

System Architecture: 5-Agent DAG

Live Mermaid Render

02. Engineering

Code is Signal

Adversarial Constraints (Red Team)

Hardcoded 'You MUST disagree' into the Devil's Advocate agent prompt, structurally preventing consensus and forcing the pipeline to engage with genuine flaws in the initial strategy.

prompts.js
// ━━━ DEVIL'S ADVOCATE — the constraint that makes everything real ━━━

"You are the Devil's Advocate — a ruthless critical data scientist.
Read the Strategist's plan. You MUST disagree with it.
Find the biggest risk or flaw. Challenge aggressively.
NEVER agree with the Strategist.
Keep your response under 50 words."

Live FinOps & Telemetry

Wrapped every agent execution in a tracking function that measures latency, prompt tokens, completion tokens, and real-time cost, streaming atomic receipts to the dashboard.

telemetry.js
async function trackExecution(agentName, executeFn) {
  const start = performance.now();
  const result = await executeFn();
  const latencyMs = (performance.now() - start).toFixed(2);

  const { promptTokenCount, candidatesTokenCount } = result.usageMetadata;
  const cost = (promptTokenCount / 1_000_000 * 0.075) + 
               (candidatesTokenCount / 1_000_000 * 0.300);

  totalCost += cost;
  auditLog.push({ 
    Agent: agentName, 
    Latency: `${latencyMs}ms`, 
    Cost_USD: `$${cost.toFixed(6)}` 
  });
  return result;
}

SRE-First Engineering

Hard Timeout on Externals

Implemented `AbortController` for 3-second hard timeouts on all external APIs (e.g. Open-Meteo) so the pipeline never hangs during live inferences.

Structured Fallback

If the weather API dies, a `catch` block returns historical pitch data ensuring graceful degradation instead of a crash.

03. Telemetry

Evidence Ledger

< $10DOCUMENTED RESULT

Cost per Season

Methodology

Multi-agent architecture is highly cost-effective at scale when prompts are optimized.

100%DOCUMENTED RESULT

Consensus Broken

Methodology

Hardcoded system prompt constraints can successfully force adversarial evaluation.

System Components

Google GeminiNode.jsExpressSSEFinOps Tracking
Next

View the Flagship Platform

ZeroDrift