UNPKG

n8n

Version:

n8n Workflow Automation Tool

19 lines (18 loc) 1.06 kB
import type { BuiltMemory, BuiltTool, CredentialProvider, ToolDescriptor } from '@n8n/agents'; import { Agent } from '@n8n/agents'; import type { AgentSkill } from '@n8n/api-types'; import type { AgentJsonConfig, AgentJsonMemoryConfig, AgentJsonToolConfig } from './agent-json-config'; 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 interface BuildFromJsonOptions { toolExecutor: ToolExecutor; credentialProvider: CredentialProvider; resolveTool?: ToolResolver; skills?: Record<string, AgentSkill>; memoryFactory: MemoryFactory; } export declare function buildFromJson(config: AgentJsonConfig, toolDescriptors: Record<string, ToolDescriptor>, options: BuildFromJsonOptions): Promise<Agent>;