UNPKG

claude-flow

Version:

Ruflo - Enterprise AI agent orchestration for Claude Code. Deploy 60+ specialized agents in coordinated swarms with self-learning, fault-tolerant consensus, vector memory, and MCP integration

110 lines 3.88 kB
/** * GAIA DAG Harness — Co-Sight Architecture Port (ADR-139 Addendum) * * Ports the ZTE-AICloud/Co-Sight DAG orchestration pattern (Apache 2.0, * arXiv 2510.21557) into the ruflo GAIA harness. * * Architecture: * 1. PLAN — Claude Sonnet 4.6 reads the question and emits a DAG of 3-7 * steps: {id, description, depends_on: [], suggested_tool}. * Claude-aware prompt: "3-5 steps max, direct answer when clear." * 2. EXECUTE — Loop while ready steps exist (deps satisfied). * Run all ready steps in PARALLEL (Promise.all, cap ≤5). * Each step = a Gemini 2.5 Pro actor with the full tool suite. * Actor marks step completed/blocked + writes step_notes. * Blocked steps trigger planner re_plan before next cycle. * 3. FINALIZE — Planner reads all step_notes → produces final answer * using T2 extraction cascade from gaia-agent.ts. * 4. CAMV — Async credibility labeling per step (stubbed, iter 65). * * Role assignment (env-configurable): * PLAN_MODEL = claude-sonnet-4-6 (default) * ACT_MODEL = gemini-2.5-pro (default) * VISION_MODEL = gemini-2.5-pro (default, same as act) * * CLI: * gaia-bench run --mode=dag --model claude-sonnet-4-6 * * Cost: planner ~$0.02/Q + actors ~$0.03/Q = ~$0.05/Q (vs single-Sonnet ~$0.075) * * Refs: ADR-139, github.com/ZTE-AICloud/Co-Sight, arXiv 2510.21557, #2156 */ import { GaiaQuestion } from './gaia-loader.js'; import { GaiaToolCatalogue } from './gaia-tools/index.js'; export interface DagStep { id: number; description: string; depends_on: number[]; suggested_tool?: string; status: 'not_started' | 'in_progress' | 'completed' | 'blocked'; step_notes: string; } export interface DagPlan { title: string; question: string; steps: DagStep[]; } /** * Get all steps whose dependencies are fully satisfied (completed). * Mirrors Co-Sight's Plan.get_ready_steps(). */ export declare function getReadySteps(plan: DagPlan): DagStep[]; export interface DagResult { questionId: string; finalAnswer: string | null; normalisedAnswer: string; plan: DagPlan; totalSteps: number; completedSteps: number; blockedSteps: number; plannerCycles: number; totalInputTokens: number; totalOutputTokens: number; estimatedCostUsd: number; wallMs: number; timedOut?: boolean; error?: string; } export interface DagOptions { planModel?: string; actModel?: string; anthropicApiKey?: string; geminiApiKey?: string; catalogue?: GaiaToolCatalogue; /** Disable CAMV stub (default: false — stub is always disabled in this iter). */ enableCamv?: boolean; } /** * Run a GAIA question through the Co-Sight DAG harness. * * Steps: * 1. Planner (Claude Sonnet) creates a DAG plan. * 2. Execute loop: parallel actors (Gemini 2.5 Pro) run ready steps. * 3. Blocked steps trigger replan (up to MAX_REPLAN_CYCLES). * 4. Finalizer (Claude Sonnet) reads all step notes → final answer. */ export declare function runGaiaDAG(question: GaiaQuestion, options?: DagOptions): Promise<DagResult>; export interface DagPilotResult { correct: number; total: number; accuracy: number; avgStepsPerQuestion: number; perQuestion: Array<{ taskId: string; question: string; expected: string; got: string | null; correct: boolean; steps: number; completedSteps: number; blockedSteps: number; plannerCycles: number; costUsd: number; wallMs: number; }>; totalCostUsd: number; projectedCost53Q: number; meanWallMs: number; } export declare function runDagPilot(questions: GaiaQuestion[], options?: DagOptions): Promise<DagPilotResult>; //# sourceMappingURL=gaia-dag.d.ts.map