mirror of
https://github.com/n8n-io/n8n.git
synced 2026-06-03 10:17:00 +02:00
79 lines
2.5 KiB
TypeScript
79 lines
2.5 KiB
TypeScript
import type { INodeTypeBaseDescription, IVersionedNodeType } from 'n8n-workflow';
|
|
import { VersionedNodeType } from 'n8n-workflow';
|
|
|
|
import { AgentV1 } from './V1/AgentV1.node';
|
|
import { AgentV2 } from './V2/AgentV2.node';
|
|
import { AgentV3 } from './V3/AgentV3.node';
|
|
|
|
export class Agent extends VersionedNodeType {
|
|
constructor() {
|
|
const baseDescription: INodeTypeBaseDescription = {
|
|
displayName: 'AI Agent',
|
|
name: 'agent',
|
|
icon: 'node:ai-agent',
|
|
iconColor: 'black',
|
|
group: ['transform'],
|
|
description: 'Generates an action plan and executes it. Can use external tools.',
|
|
codex: {
|
|
alias: ['LangChain', 'Chat', 'Conversational', 'Plan and Execute', 'ReAct', 'Tools'],
|
|
categories: ['AI'],
|
|
subcategories: {
|
|
AI: ['Agents', 'Root Nodes'],
|
|
},
|
|
resources: {
|
|
primaryDocumentation: [
|
|
{
|
|
url: 'https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.agent/',
|
|
},
|
|
],
|
|
},
|
|
},
|
|
defaultVersion: 3.1,
|
|
builderHint: {
|
|
relatedNodes: [
|
|
{
|
|
nodeType: 'n8n-nodes-base.aggregate',
|
|
relationHint: 'Use to combine multiple items together before the agent',
|
|
},
|
|
{
|
|
nodeType: '@n8n/n8n-nodes-langchain.outputParserStructured',
|
|
relationHint:
|
|
'Attach for structured output; reference fields as $json.output.fieldName for use in subsequent nodes (conditions, storing data)',
|
|
},
|
|
{
|
|
nodeType: '@n8n/n8n-nodes-langchain.agentTool',
|
|
relationHint: 'For multi-agent systems using orchestrator pattern',
|
|
},
|
|
{
|
|
nodeType: '@n8n/n8n-nodes-langchain.memoryBufferWindow',
|
|
relationHint:
|
|
'Required for conversational workflows - connect memory to every agent that needs to recall previous messages in the conversation',
|
|
},
|
|
],
|
|
},
|
|
};
|
|
|
|
const nodeVersions: IVersionedNodeType['nodeVersions'] = {
|
|
1: new AgentV1(baseDescription),
|
|
1.1: new AgentV1(baseDescription),
|
|
1.2: new AgentV1(baseDescription),
|
|
1.3: new AgentV1(baseDescription),
|
|
1.4: new AgentV1(baseDescription),
|
|
1.5: new AgentV1(baseDescription),
|
|
1.6: new AgentV1(baseDescription),
|
|
1.7: new AgentV1(baseDescription),
|
|
1.8: new AgentV1(baseDescription),
|
|
1.9: new AgentV1(baseDescription),
|
|
2: new AgentV2(baseDescription),
|
|
2.1: new AgentV2(baseDescription),
|
|
2.2: new AgentV2(baseDescription),
|
|
2.3: new AgentV2(baseDescription),
|
|
3: new AgentV3(baseDescription),
|
|
3.1: new AgentV3(baseDescription),
|
|
// IMPORTANT Reminder to update AgentTool
|
|
};
|
|
|
|
super(nodeVersions, baseDescription);
|
|
}
|
|
}
|