AI Agents don't follow the instructions in the prompts

,

Hey Guys!.
I am having issues with my AI Agents. It seem that they are not following the instructions of the prompt. The workflow still use names or words from previous prompts even do not follow the instructions. I have been looking for similar issues on the documentation but I haven’t got anything. In the system prompt I specify just provide links from google jobs, and check that provide just genuine links. Nevertheless the responses include fake links from different websites.
Anyone have had a similar issue? This is my workflow
{
“nodes”: [
{
“parameters”: {
“updates”: [
“message”
],
“additionalFields”: {}
},
“type”: “n8n-nodes-base.telegramTrigger”,
“typeVersion”: 1.2,
“position”: [
576,
0
],
“id”: “878f2c56-c0da-4b81-99de-6b2eb28d19a8”,
“name”: “Telegram Trigger”,
“webhookId”: “b94f67b8-40eb-4784-9734-c978b1f3b0ea”,
“credentials”: {
“telegramApi”: {
“id”: “Slj44UmlaGqZuVlw”,
“name”: “Telegram account 2”
}
}
},
{
“parameters”: {
“promptType”: “define”,
“text”: “=You can read the caption: {{ $json.message.caption }}, or the message: {{ $json.message.text }}, or trigger the process with the id of the document: {{ $json.message.document.file_id }}, and answer to the user accordingly with the System prompt.”,
“options”: {
“systemMessage”: “=Identity: You are "Job Seeker", a professional and friendly UK-based job search assistant. Your mission is to help users find suitable jobs that match their profile.\n\nGoal: Your primary goal is to gather the user’s professional information and provide them with genuine links to job offers, whether that’s a quick text-based search or a detailed document-based analysis.\n\nOperational Mandate:\n\n1.\tWelcome & Information Gathering:\n - Start by greeting the user warmly.\n - Politely ask about their professional skills, experience, and the type of job they are seeking.\n - Simultaneously, offer the option to upload a resume or CV, explaining that this will enable a more thorough and accurate search.\n\n2.\tConditional Job Search (Text-Based):\n - If the user provides their profile details via text, you must use the SerpApi tool to find and present three relevant Google Jobs links.\n - For each link, provide the job title, company, and a working URL.\n - Do not provide a score, detailed analysis, or recommendations at this stage. Keep the response concise and focused on the job opportunities.\n- Provide real job links only from Google Jobs.\n\n3.\tDocument Handling & Workflow Transition:\n - If the user uploads a PDF document with the resume or CV, acknowledge the document politely. Use the tool to process the document and respond to the user. \n - Mandatory Action: Use the PDFReader tool to process the document and answer the user only with the response of the tool.\n\n4. Mock interview:\nThe user can ask you for help to prepare for an interview. Then, you must ask the user if they would like to run a mock interview. If the user agrees, you must start a mock interview related to the user’s field of interest. \n \nConstraints:\n*\tTone: Empathetic, professional, and patient. Keep messages short and easy to read.\n*\tTools: Use SerpApi only for quick job searches on Google Jobs, based on the user’s text input. Use PDFReader exclusively for uploaded documents.\n*\tBehaviour: Do not perform detailed scoring or gap analysis. If a user asks for these, explain that they need to upload a resume first for that level of detail.\n* Your focus is on the job searching; if the user asks for another topic, you must remind them politely that you are just specialised in the job-seeking tasks.\n* Validate the links to be released are genuine and lead the users to real job offerings.”
}
},
“type”: “@n8n/n8n-nodes-langchain.agent”,
“typeVersion”: 2.1,
“position”: [
928,
0
],
“id”: “19e39334-d2f0-4205-be0e-ccd88a4d0829”,
“name”: “AI Agent”
},
{
“parameters”: {
“modelName”: “models/gemini-2.0-flash”,
“options”: {}
},
“type”: “@n8n/n8n-nodes-langchain.lmChatGoogleGemini”,
“typeVersion”: 1,
“position”: [
800,
224
],
“id”: “7e4cfa06-47b9-4d59-be07-2d35b7653188”,
“name”: “Google Gemini Chat Model”,
“credentials”: {
“googlePalmApi”: {
“id”: “w2UNbdWAx4yOMYYR”,
“name”: “Google Gemini(PaLM) Api account”
}
}
},
{
“parameters”: {
“sessionIdType”: “customKey”,
“sessionKey”: “={{ $json.message.chat.id }}”
},
“type”: “@n8n/n8n-nodes-langchain.memoryBufferWindow”,
“typeVersion”: 1.3,
“position”: [
928,
224
],
“id”: “642ea7c0-ec78-4749-98f0-a2778ac16260”,
“name”: “Simple Memory”
},
{
“parameters”: {
“chatId”: “={{ $(‘Telegram Trigger’).item.json.message.chat.id }}”,
“text”: “={{ $json.output }}”,
“additionalFields”: {
“parse_mode”: “HTML”
}
},
“type”: “n8n-nodes-base.telegram”,
“typeVersion”: 1.2,
“position”: [
1392,
-96
],
“id”: “a823751a-778e-483c-8938-7d8f692f4921”,
“name”: “Send a text message”,
“webhookId”: “6c9db662-c56b-475d-ab83-9577c9798ee1”,
“credentials”: {
“telegramApi”: {
“id”: “Slj44UmlaGqZuVlw”,
“name”: “Telegram account 2”
}
}
},
{
“parameters”: {
“description”: “Call this tool if the user is looking to processing a pdf document.”,
“workflowId”: {
“_rl": true,
“value”: “zidDHqKlfcDG5v2Z”,
“mode”: “list”,
“cachedResultName”: “PDFReaderV2”
},
“workflowInputs”: {
“mappingMode”: “defineBelow”,
“value”: {
“message”: “={{ $json.message.caption }}”,
“id”: “={{ $json.message.document.file_id }}”
},
“matchingColumns”: [],
“schema”: [
{
“id”: “message”,
“displayName”: “message”,
“required”: false,
“defaultMatch”: false,
“display”: true,
“canBeUsedToMatch”: true,
“type”: “string”
},
{
“id”: “id”,
“displayName”: “id”,
“required”: false,
“defaultMatch”: false,
“display”: true,
“canBeUsedToMatch”: true,
“type”: “string”
}
],
“attemptToConvertTypes”: false,
“convertFieldsToString”: false
}
},
“type”: “@n8n/n8n-nodes-langchain.toolWorkflow”,
“typeVersion”: 2.2,
“position”: [
1056,
224
],
“id”: “50a9cd67-7b6f-4f57-81ba-fbf4ec1dd31e”,
“name”: “Call n8n Workflow Tool”
},
{
“parameters”: {
“assignments”: {
“assignments”: [
{
“id”: “b462fd24-5115-4e38-96bb-25bd63475343”,
“name”: “message.caption”,
“value”: “={{ $(‘Telegram Trigger’).item.json.message.caption }}”,
“type”: “string”
},
{
“id”: “3acbb537-30cc-4c27-885e-aea3fc58e645”,
“name”: “message.document.file_id”,
“value”: “={{ $(‘Telegram Trigger’).item.json.message.document.file_id }}”,
“type”: “string”
}
]
},
“options”: {}
},
“type”: “n8n-nodes-base.set”,
“typeVersion”: 3.4,
“position”: [
1392,
96
],
“id”: “c5695b5e-37c8-41b4-bd22-3ca9e55378c1”,
“name”: “Edit Fields”
},
{
“parameters”: {
“q”: "={{ $fromAI('Search_Query__q
’, ``, ‘string’) }}”,
“location”: “United Kingdom”,
“additionalFields”: {},
“requestOptions”: {}
},
“type”: “n8n-nodes-serpapi.serpApiTool”,
“typeVersion”: 1,
“position”: [
1184,
224
],
“id”: “446cb5c2-6063-4999-af93-002270db66c7”,
“name”: “Google search in SerpApi”,
“credentials”: {
“serpApi”: {
“id”: “DIvlr5ZbGGetftn8”,
“name”: “SerpApi account”
}
}
}
],
“connections”: {
“Telegram Trigger”: {
“main”: [
[
{
“node”: “AI Agent”,
“type”: “main”,
“index”: 0
}
]
]
},
“AI Agent”: {
“main”: [
[
{
“node”: “Send a text message”,
“type”: “main”,
“index”: 0
},
{
“node”: “Edit Fields”,
“type”: “main”,
“index”: 0
}
]
]
},
“Google Gemini Chat Model”: {
“ai_languageModel”: [
[
{
“node”: “AI Agent”,
“type”: “ai_languageModel”,
“index”: 0
}
]
]
},
“Simple Memory”: {
“ai_memory”: [
[
{
“node”: “AI Agent”,
“type”: “ai_memory”,
“index”: 0
}
]
]
},
“Call n8n Workflow Tool”: {
“ai_tool”: [
[
{
“node”: “AI Agent”,
“type”: “ai_tool”,
“index”: 0
}
]
]
},
“Google search in SerpApi”: {
“ai_tool”: [
[
{
“node”: “AI Agent”,
“type”: “ai_tool”,
“index”: 0
}
]
]
}
},
“pinData”: {},
“meta”: {
“instanceId”: “96a6e4c0b1155927e20c4dd083c7c7dd7230f334e6654d5d810a9dc4990974f9”
}
}

Describe the problem/error/question

What is the error message (if any)?

Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

Information on your n8n setup

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hey @Mauricio_Rodriguez hope all is good. Welcome to the community.

The “cached” information could be coming from the memory node. Do you need it?
Try running without it just for tests.

1 Like

Thank you Jabbson, I will try

1 Like

I would also try a different model beside gemini 2.0 flash, for example gpt 4.1 or gpt-5-mini.

You’re making a “tool call” in order to process the uploaded pdf using PdfreaderV2 and gemini 2.0 flash is not really a great tool caller! It often ignores the call!

openai models are better at that feature in my experience.