mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
feat(core): Make Tools Agent the default Agent type, deprecate other agent types (#13459)
This commit is contained in:
parent
461e39a74e
commit
a60d106ebb
|
@ -27,7 +27,13 @@ import { toolsAgentExecute } from './agents/ToolsAgent/execute';
|
||||||
// Function used in the inputs expression to figure out which inputs to
|
// Function used in the inputs expression to figure out which inputs to
|
||||||
// display based on the agent type
|
// display based on the agent type
|
||||||
function getInputs(
|
function getInputs(
|
||||||
agent: 'toolsAgent' | 'conversationalAgent' | 'openAiFunctionsAgent' | 'reActAgent' | 'sqlAgent',
|
agent:
|
||||||
|
| 'toolsAgent'
|
||||||
|
| 'conversationalAgent'
|
||||||
|
| 'openAiFunctionsAgent'
|
||||||
|
| 'planAndExecuteAgent'
|
||||||
|
| 'reActAgent'
|
||||||
|
| 'sqlAgent',
|
||||||
hasOutputParser?: boolean,
|
hasOutputParser?: boolean,
|
||||||
): Array<NodeConnectionType | INodeInputConfiguration> {
|
): Array<NodeConnectionType | INodeInputConfiguration> {
|
||||||
interface SpecialInput {
|
interface SpecialInput {
|
||||||
|
@ -256,7 +262,7 @@ export class Agent implements INodeType {
|
||||||
icon: 'fa:robot',
|
icon: 'fa:robot',
|
||||||
iconColor: 'black',
|
iconColor: 'black',
|
||||||
group: ['transform'],
|
group: ['transform'],
|
||||||
version: [1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7],
|
version: [1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8],
|
||||||
description: 'Generates an action plan and executes it. Can use external tools.',
|
description: 'Generates an action plan and executes it. Can use external tools.',
|
||||||
subtitle:
|
subtitle:
|
||||||
"={{ { toolsAgent: 'Tools Agent', conversationalAgent: 'Conversational Agent', openAiFunctionsAgent: 'OpenAI Functions Agent', reActAgent: 'ReAct Agent', sqlAgent: 'SQL Agent', planAndExecuteAgent: 'Plan and Execute Agent' }[$parameter.agent] }}",
|
"={{ { toolsAgent: 'Tools Agent', conversationalAgent: 'Conversational Agent', openAiFunctionsAgent: 'OpenAI Functions Agent', reActAgent: 'ReAct Agent', sqlAgent: 'SQL Agent', planAndExecuteAgent: 'Plan and Execute Agent' }[$parameter.agent] }}",
|
||||||
|
@ -322,6 +328,24 @@ export class Agent implements INodeType {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
displayName:
|
||||||
|
"This node is using Agent that has been deprecated. Please switch to using 'Tools Agent' instead.",
|
||||||
|
name: 'deprecated',
|
||||||
|
type: 'notice',
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
agent: [
|
||||||
|
'conversationalAgent',
|
||||||
|
'openAiFunctionsAgent',
|
||||||
|
'planAndExecuteAgent',
|
||||||
|
'reActAgent',
|
||||||
|
'sqlAgent',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
// Make Conversational Agent the default agent for versions 1.5 and below
|
// Make Conversational Agent the default agent for versions 1.5 and below
|
||||||
{
|
{
|
||||||
...agentTypeProperty,
|
...agentTypeProperty,
|
||||||
|
@ -331,10 +355,17 @@ export class Agent implements INodeType {
|
||||||
displayOptions: { show: { '@version': [{ _cnd: { lte: 1.5 } }] } },
|
displayOptions: { show: { '@version': [{ _cnd: { lte: 1.5 } }] } },
|
||||||
default: 'conversationalAgent',
|
default: 'conversationalAgent',
|
||||||
},
|
},
|
||||||
// Make Tools Agent the default agent for versions 1.6 and above
|
// Make Tools Agent the default agent for versions 1.6 and 1.7
|
||||||
{
|
{
|
||||||
...agentTypeProperty,
|
...agentTypeProperty,
|
||||||
displayOptions: { show: { '@version': [{ _cnd: { gte: 1.6 } }] } },
|
displayOptions: { show: { '@version': [{ _cnd: { between: { from: 1.6, to: 1.7 } } }] } },
|
||||||
|
default: 'toolsAgent',
|
||||||
|
},
|
||||||
|
// Make Tools Agent the only agent option for versions 1.8 and above
|
||||||
|
{
|
||||||
|
...agentTypeProperty,
|
||||||
|
type: 'hidden',
|
||||||
|
displayOptions: { show: { '@version': [{ _cnd: { gte: 1.8 } }] } },
|
||||||
default: 'toolsAgent',
|
default: 'toolsAgent',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -96,6 +96,13 @@ export const reActAgentAgentProperties: INodeProperties[] = [
|
||||||
rows: 6,
|
rows: 6,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Max Iterations',
|
||||||
|
name: 'maxIterations',
|
||||||
|
type: 'number',
|
||||||
|
default: 10,
|
||||||
|
description: 'The maximum number of iterations the agent will run before stopping',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Return Intermediate Steps',
|
displayName: 'Return Intermediate Steps',
|
||||||
name: 'returnIntermediateSteps',
|
name: 'returnIntermediateSteps',
|
||||||
|
|
|
@ -38,6 +38,7 @@ export async function reActAgentAgentExecute(
|
||||||
prefix?: string;
|
prefix?: string;
|
||||||
suffix?: string;
|
suffix?: string;
|
||||||
suffixChat?: string;
|
suffixChat?: string;
|
||||||
|
maxIterations?: number;
|
||||||
humanMessageTemplate?: string;
|
humanMessageTemplate?: string;
|
||||||
returnIntermediateSteps?: boolean;
|
returnIntermediateSteps?: boolean;
|
||||||
};
|
};
|
||||||
|
@ -60,6 +61,7 @@ export async function reActAgentAgentExecute(
|
||||||
agent,
|
agent,
|
||||||
tools,
|
tools,
|
||||||
returnIntermediateSteps: options?.returnIntermediateSteps === true,
|
returnIntermediateSteps: options?.returnIntermediateSteps === true,
|
||||||
|
maxIterations: options.maxIterations ?? 10,
|
||||||
});
|
});
|
||||||
|
|
||||||
const returnData: INodeExecutionData[] = [];
|
const returnData: INodeExecutionData[] = [];
|
||||||
|
|
Loading…
Reference in a new issue