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

92 lines 2.99 kB
/** * 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' | 'inherit'; export interface AgentRecord { agentId: string; agentType: string; status: 'idle' | 'busy' | 'terminated'; health: number; taskCount: number; config: Record<string, unknown>; createdAt: string; domain?: string; model?: ClaudeModel; modelRoutedBy?: 'explicit' | 'router' | 'agent-booster' | 'default'; lastResult?: Record<string, unknown>; } export declare const DEFAULT_ANTHROPIC_MODEL = "claude-sonnet-4-6"; export interface AnthropicCallInput { prompt: string; systemPrompt?: string; model?: string; maxTokens?: number; temperature?: number; timeoutMs?: number; } 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<AnthropicCallResult>; /** * 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; } export declare function executeAgentTask(input: AgentExecuteInput): Promise<AgentExecuteResult>; export {}; //# sourceMappingURL=agent-execute-core.d.ts.map