/** * Darwin — Agent Runner * * Executes agents via pluggable LLM providers. * Supports: Claude CLI (with MCP), Anthropic API, OpenAI, Ollama. * * The runner handles metrics, experiment records, and reports. * The provider handles the actual LLM call. */ import type { AgentDefinition, DarwinConfig, RunResult } from '../types.js'; import type { LLMProvider } from '../providers/types.js'; /** Options for a single agent run */ export interface RunOptions { /** Override the agent's model for this run */ model?: string; /** Override max turns for this run */ maxTurns?: number; /** Task category for experiment tracking */ taskType?: string; /** Darwin config (for MCP servers, data dir, etc.) */ config?: DarwinConfig; /** Prompt version identifier for experiment tracking */ promptVersion?: string; /** Working directory for the Claude CLI process */ cwd?: string; /** Timeout in milliseconds (default: 600_000 = 10 minutes) */ timeout?: number; /** Run in autonomous mode with bypassed permissions */ autonomous?: boolean; /** Explicit LLM provider (overrides config.provider) */ provider?: LLMProvider; } /** Override the per-process run cap (0 = disabled). Primarily for tests. */ export declare function setMaxRunsPerProcess(n: number): void; /** Override the wall-clock cap in ms (0 = disabled). Primarily for tests. */ export declare function setMaxRunWallMs(ms: number): void; /** Reset the process run counter + wall-clock start. Primarily for tests. */ export declare function resetRunCounters(): void; /** Error thrown when a process-lifetime budget cap is exceeded. */ export declare class DarwinBudgetError extends Error { readonly budget: 'runs' | 'wall'; constructor(message: string, budget: 'runs' | 'wall'); } /** * Run an agent using the configured LLM provider. * * For Claude CLI: spawns a child process with MCP support. * For API providers: makes a direct HTTP call (10-100x faster). * * @example * ```ts * // Default: uses Claude CLI * const result = await runAgent(writer, 'Write a landing page', { * taskType: 'market', * config: darwinConfig, * }); * * // Explicit provider: Anthropic API (faster, no MCP) * import { createProvider } from '../providers/index.js'; * const result = await runAgent(critic, 'Evaluate this output', { * provider: createProvider({ type: 'anthropic-api' }), * }); * ``` */ export declare function runAgent(agent: AgentDefinition, task: string, opts?: RunOptions): Promise; /** * Error thrown when an LLM provider fails. * Preserves the exit code (CLI) and any partial output for debugging. */ export declare class RunnerError extends Error { readonly exitCode: number | null; readonly partialOutput: string; constructor(message: string, exitCode: number | null, partialOutput: string); } //# sourceMappingURL=runner.d.ts.map