UNPKG

n8n

Version:

n8n Workflow Automation Tool

19 lines (18 loc) 1.18 kB
import type { BuiltMemory, BuiltTool, CredentialProvider, McpClient, ToolDescriptor, Agent as RuntimeAgent } from '@n8n/agents'; import type { AgentSkill, AgentJsonConfig, AgentJsonMcpServerConfig, AgentJsonMemoryConfig, AgentJsonToolConfig } from '@n8n/api-types'; export type ToolResolver = (toolSchema: AgentJsonToolConfig) => Promise<BuiltTool | null | undefined>; export interface ToolExecutor { executeTool(toolName: string, input: unknown, ctx: unknown): Promise<unknown>; executeToMessageSync?(toolName: string, output: unknown): unknown; } export type MemoryFactory = (params: AgentJsonMemoryConfig) => BuiltMemory | Promise<BuiltMemory>; export type McpClientBuilder = (server: AgentJsonMcpServerConfig) => Promise<McpClient>; export interface BuildFromJsonOptions { toolExecutor: ToolExecutor; credentialProvider: CredentialProvider; resolveTool?: ToolResolver; skills?: Record<string, AgentSkill>; memoryFactory: MemoryFactory; buildMcpClient?: McpClientBuilder; } export declare function buildFromJson(config: AgentJsonConfig, toolDescriptors: Record<string, ToolDescriptor>, options: BuildFromJsonOptions): Promise<RuntimeAgent>;