Skip to content

there is something wrong with AI Agent Call Code Tool #15719

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
llw168 opened this issue May 27, 2025 · 3 comments
Open

there is something wrong with AI Agent Call Code Tool #15719

llw168 opened this issue May 27, 2025 · 3 comments
Labels
in linear Issue or PR has been created in Linear for internal review

Comments

@llw168
Copy link

llw168 commented May 27, 2025

Bug Description

"Cannot read properties of undefined (reading 'content')"

Image

Image

To Reproduce

{
"nodes": [
{
"parameters": {
"public": true,
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"typeVersion": 1.1,
"position": [
-760,
-120
],
"id": "bd982f13-0712-451a-b9ab-ba5e9cab649f",
"name": "When chat message received",
"webhookId": "5dd02ca8-3943-4a78-b1f4-c9763e9f51c9"
},
{
"parameters": {
"model": {
"__rl": true,
"value": "nebulacoder-v6.0",
"mode": "list",
"cachedResultName": "nebulacoder-v6.0"
},
"options": {
"temperature": 0,
"timeout": 60000
}
},
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"typeVersion": 1.2,
"position": [
-580,
120
],
"id": "2a47cd48-6a0f-4e4e-81c6-ed7c8bc7a704",
"name": "OpenAI Chat Model",
"credentials": {
"openAiApi": {
"id": "5xc8sEfOfRVrmv4G",
"name": "NebulaCoder60"
}
}
},
{
"parameters": {},
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"typeVersion": 1.3,
"position": [
-180,
100
],
"id": "af8d82e7-eced-4ad7-977c-943f26d7a285",
"name": "Simple Memory",
"disabled": true
},
{
"parameters": {
"promptType": "define",
"text": "={{ $json.chatInput }}",
"options": {}
},
"id": "8fbf3834-056c-4d33-b433-8db77ea6104e",
"name": "AI Agent1",
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 1.7,
"position": [
-280,
-100
],
"retryOnFail": false,
"maxTries": 2
},
{
"parameters": {
"description": "转换成大写字母"
},
"type": "@n8n/n8n-nodes-langchain.toolCode",
"typeVersion": 1.2,
"position": [
-20,
100
],
"id": "89498b5b-4520-4a13-b54d-8c4716dca831",
"name": "CodeTool-Upper",
"retryOnFail": false
},
{
"parameters": {
"description": "转换成小写字母",
"jsCode": "// Example: convert the incoming query to uppercase and return it\nreturn query.toLowerCase()"
},
"type": "@n8n/n8n-nodes-langchain.toolCode",
"typeVersion": 1.2,
"position": [
140,
80
],
"id": "4e22dbf8-2e0e-466a-be51-af0cd8684613",
"name": "CodeTool-Lower"
},
{
"parameters": {
"model": "=deepseek-chat",
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.lmChatDeepSeek",
"typeVersion": 1,
"position": [
-380,
140
],
"id": "56e3b70f-ef1a-4cc5-95a1-de0a5e604353",
"name": "DeepSeek Chat Model",
"credentials": {
"deepSeekApi": {
"id": "kE1IWx8LVXwiQKT2",
"name": "DeepSeek account"
}
}
}
],
"connections": {
"When chat message received": {
"main": [
[
{
"node": "AI Agent1",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent1",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Simple Memory": {
"ai_memory": [
[
{
"node": "AI Agent1",
"type": "ai_memory",
"index": 0
}
]
]
},
"AI Agent1": {
"main": [
[]
]
},
"CodeTool-Upper": {
"ai_tool": [
[
{
"node": "AI Agent1",
"type": "ai_tool",
"index": 0
}
]
]
},
"CodeTool-Lower": {
"ai_tool": [
[
{
"node": "AI Agent1",
"type": "ai_tool",
"index": 0
}
]
]
},
"DeepSeek Chat Model": {
"ai_languageModel": [
[]
]
}
},
"pinData": {},
"meta": {
"templateCredsSetupCompleted": true,
"instanceId": "ebe24453bfcbfa9d4c406f11f08412aebd5e2a2ef2785d0da8c93c6340379075"
}
}

Expected behavior

111

Operating System

windows 10

n8n Version

1.93.0

Node.js Version

v22.15.1

Database

SQLite (default)

Execution mode

main (default)

@Joffcom
Copy link
Member

Joffcom commented May 27, 2025

Hey @llw168,

We have created an internal ticket to look into this which we will be tracking as "GHC-2183"

@Joffcom Joffcom added the in linear Issue or PR has been created in Linear for internal review label May 27, 2025
@roger-Guo
Copy link

@llw168
I replaced the large language model with deepseek, and changed the prompt word to convert "good" into uppercase. It works OK, so it should be a problem with the model. I suggest you change the model.

Image

@llw168
Copy link
Author

llw168 commented May 28, 2025

@roger-Guo
Thank you for your reply. The n8n I am using is locally deployed and used a privately deployed model. The same workflow can also be run on the official website of n8n, but it cannot be run locally. There is no apparent reason from the logs.

Or can I edit the input and output of the Agent to the LLM model?

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in linear Issue or PR has been created in Linear for internal review
Projects
None yet
Development

No branches or pull requests

3 participants