/** * Shared agent-execution core. * * Both the agent_execute MCP tool and the workflow runtime (G3) need * to dispatch a prompt to an agent's configured Anthropic model. This * module factors that path out so it's testable and reusable, and * keeps the wire from agent_spawn → ProviderManager (real) in one * place rather than duplicated. */ type ClaudeModel = 'haiku' | 'sonnet' | 'opus' | 'opus-4.7' | 'inherit'; export interface AgentRecord { agentId: string; agentType: string; status: 'idle' | 'busy' | 'terminated'; health: number; taskCount: number; config: Record; createdAt: string; domain?: string; model?: ClaudeModel; modelRoutedBy?: 'explicit' | 'router' | 'codemod' | 'default' | 'hybrid'; /** * ADR-149 — concrete picked model id (e.g. `openai/gpt-4.1`, * `inclusionai/ling-2.6-flash`). Present when the cost-optimal neural * router contributed to the decision; downstream `executeAgentInline` * uses this to dispatch via the correct provider's API instead of * falling back to MODEL_MAP[tier]. */ modelId?: string; /** ADR-148 phase 2 — execution provider hint. #2962 widened to include 'ollama'. */ provider?: 'anthropic' | 'openrouter' | 'ollama'; /** ADR-148 phase 2 — concrete OpenRouter slug when provider='openrouter'. */ openrouterModel?: string; lastResult?: Record; } export declare const DEFAULT_ANTHROPIC_MODEL = "claude-sonnet-5"; export declare function modelRejectsSamplingParams(model: string): boolean; export interface AnthropicCallInput { prompt: string; systemPrompt?: string; model?: string; maxTokens?: number; temperature?: number; timeoutMs?: number; /** * #2962 — explicit provider carried from the agent record (agent.provider, * itself populated from a user's `--provider` flag or persisted * `providers configure`). When set, this outranks the env-var-only * inference callAnthropicMessages otherwise does — see the precedence * comment on that function. */ provider?: 'anthropic' | 'openrouter' | 'ollama'; } export interface AnthropicCallResult { success: boolean; model?: string; messageId?: string; stopReason?: string; output?: string; usage?: { inputTokens: number; outputTokens: number; totalTokens: number; }; durationMs?: number; error?: string; } /** * Generic Anthropic Messages API call. No agent registry coupling — used * by agent_execute (with the agent's configured model) and by the WASM * agent runtime (G4) when the bundled WASM only echoes input. * * #1725 — falls back to Ollama Cloud (Tier-2, OpenAI-compat) when * ANTHROPIC_API_KEY is unset and OLLAMA_API_KEY is present, or when * RUFLO_PROVIDER=ollama is explicitly set. Response shape is normalized * to the Anthropic-flavored AnthropicCallResult so existing callers * don't need to know which provider answered. */ export declare function callAnthropicMessages(input: AnthropicCallInput): Promise; /** * Resolve a model identifier to an Anthropic model ID. Accepts: * - logical names: 'haiku', 'sonnet', 'opus', 'inherit' * - prefixed: 'anthropic:claude-sonnet-4-6' * - direct: 'claude-sonnet-4-6' */ export declare function resolveAnthropicModel(input: string | undefined): string; export interface AgentExecuteInput { agentId: string; prompt: string; systemPrompt?: string; maxTokens?: number; temperature?: number; timeoutMs?: number; } export interface AgentExecuteResult { success: boolean; agentId: string; model?: string; messageId?: string; stopReason?: string; output?: string; usage?: { inputTokens: number; outputTokens: number; totalTokens: number; }; durationMs?: number; error?: string; remediation?: string; /** * ADR-149 iter 7 — present when the request was retried after a 429/5xx * via `nextCostOptimalAlternative`. Each entry records a model that * was tried and failed, in attempt order. The final `model` field is * the one that produced the surfaced result (success or final error). */ fallbackHistory?: Array<{ modelId: string; error: string; }>; } export declare function executeAgentTask(input: AgentExecuteInput): Promise; export {}; //# sourceMappingURL=agent-execute-core.d.ts.map