@n8n/n8n-nodes-langchain
Version:

116 lines (110 loc) • 3.71 kB
text/typescript
/**
* AI Agent Node - Version 2.1
* Generates an action plan and executes it. Can use external tools.
*/
export interface LcAgentV21Params {
promptType?: 'auto' | 'guardrails' | 'define' | Expression<string>;
/**
* Prompt (User Message)
* @builderHint Use expressions to include dynamic data from previous nodes (e.g., "={{ $json.input }}"). Static text prompts ignore incoming data.
* @displayOptions.show { promptType: ["define"] }
*/
text: string | Expression<string>;
hasOutputParser?: boolean;
/**
* Enable Fallback Model
* @default false
*/
needsFallback?: boolean;
/**
* Options
* @default {}
*/
options?: {
/** The message that will be sent to the agent before the conversation starts
* @builderHint Must include: agent's purpose, exact names of connected tools, and response instructions
* @default You are a helpful assistant
*/
systemMessage?: string | Expression<string> | PlaceholderValue;
/** The maximum number of iterations the agent will run before stopping
* @default 10
*/
maxIterations?: number | Expression<number>;
/** Whether or not the output should include intermediate steps the agent took
* @default false
*/
returnIntermediateSteps?: boolean | Expression<boolean>;
/** Whether or not binary images should be automatically passed through to the agent as image type messages
* @default true
*/
passthroughBinaryImages?: boolean | Expression<boolean>;
/** Custom metadata added to tracing events
* @default {}
*/
tracingMetadata?: {
/** Metadata
*/
values?: Array<{
/** Key
*/
key?: string | Expression<string> | PlaceholderValue;
/** The field value type
* @default stringValue
*/
type?: 'arrayValue' | 'booleanValue' | 'numberValue' | 'objectValue' | 'stringValue' | Expression<string>;
/** Value
* @displayOptions.show { type: ["stringValue"] }
*/
stringValue?: string | Expression<string> | PlaceholderValue;
/** Value
* @displayOptions.show { type: ["numberValue"] }
*/
numberValue?: string | Expression<string> | PlaceholderValue;
/** Value
* @displayOptions.show { type: ["booleanValue"] }
* @default true
*/
booleanValue?: 'true' | 'false' | Expression<string>;
/** Value
* @displayOptions.show { type: ["arrayValue"] }
*/
arrayValue?: string | Expression<string> | PlaceholderValue;
/** Value
* @displayOptions.show { type: ["objectValue"] }
* @default ={}
*/
objectValue?: IDataObject | string | Expression<string>;
}>;
};
/** Batch processing options for rate limiting
* @default {}
*/
batching?: {
/** How many items to process in parallel. This is useful for rate limiting, but might impact the log output ordering.
* @default 1
*/
batchSize?: number | Expression<number>;
/** Delay in milliseconds between batches. This is useful for rate limiting.
* @default 0
*/
delayBetweenBatches?: number | Expression<number>;
};
};
}
export interface LcAgentV21SubnodeConfig {
model: LanguageModelInstance | LanguageModelInstance[];
memory?: MemoryInstance;
tools?: ToolInstance[];
/**
* @displayOptions.show { hasOutputParser: [true] }
*/
outputParser?: OutputParserInstance;
}
interface LcAgentV21NodeBase {
type: '@n8n/n8n-nodes-langchain.agent';
version: 2.1;
}
export type LcAgentV21ParamsNode = LcAgentV21NodeBase & {
config: NodeConfig<LcAgentV21Params> & { subnodes: LcAgentV21SubnodeConfig };
};
export type LcAgentV21Node = LcAgentV21ParamsNode;