Question on AI Agent execution

Describe the problem/error/question

I have a simple AI Agent, that is supposed to ask few questions from the user to find out where the user would like to travel. After the AI agent there is a HTTP request node.

My issue is when executing, it does not ask all the questions from the user, it pass the execution for the HTTP request node, ideally what I want is for the agent to ask questions from user and collect the information and then pass the execution to the HTTP request node. If disconnect the HTTP node after the AI Agent node it executes perfectly and ask questions from user repeatedly to clarify all the details.

Can someone help me to figure out what I am doing wrong?

Scenario 1: (When a node is connected after the AI Agent)

-User chat: Plan a trip to Japan

-AI Chat model returns a question like “When would you like to go?”, but it is not shown to the user in the chat, it passes the execution to the node attached after the AI Agent.

Scenario 2: (When a NO node is connected after the AI Agent)

-User chat: Plan a trip to Japan

-AI Chat model returns a question like “When would you like to go?”, but it is shown to the user.

-User reply: I want to go in Spring

-AI Chat model returns a question like “What is your budget?” and shown to the user

-Then user replies and so on, AI Agent asks all the questions and get user input.

Ideally I want the AI Agent to clarify everything like in scenario 2 and then pass the execution to the next attached node, but when a node is attached after the AI node it does not ask these questions from user, it just pass the execution to next node.

Thank you for your help.

What is the error message (if any)?

Please share your workflow

Share the output returned by the last node

Information on your n8n setup

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

hey @NadeeraJ try this:

Thank you @moosa for the reply. I tried your approach, that gives the final output to the user but, user can’t have a longer conversation. As I have mentioned above in Scenario 2, if there are no nodes after the AI Agent, user and AI Agent can continue to have a discussion until all the information is collected. That is the behavior I want to achieve, and when all the information is collected move to the next step(Node after the AI Agent Node)

Thank you again for the response.

then you should do a if statement after ai agent,
it will work like this, ai agent collects all information and add a extra column in sheet which indicates if all required data is collected(true/false or 1/0) if that is true then continue forward else nothing.

Thank you @moosa I will try that.

1 Like

If that works for you do consider marking it as solution.

If it works I will mark it. Thank you.

1 Like

This option does not work either, since it does not ask the repeated questions it does not collect all the information, but passes the execution to the if Node after the AI Agent node, because of that no info is available in the google sheet.

System prompt in AI agent is cruccially in this cases.

And here example:

@Parintele_Damaskin Thank you for the response. I tried your suggestion also but it does not work. I tried the exact prompt and tools, but it only ask the question once and then go to the Respond Node, so continuous conversation does not happen.
May be conceptually what I am doing is wrong. What do you think, if I want to continue the conversation, should I implement like you mentioned and then add a loop back to the AI Agent?

But actually THAT is a conversation… he asks all the relevant questions, all the conversation is stored in simple memory, and when agent has all the info, can use a tool to save and send to last node as confirmation.

Do you want that agent sends you all the questions at once? and you should respond to all of them, then go to last node? (again prompting will help).

I am a bit confused honestly… :face_with_spiral_eyes:

@Parintele_Damaskin that is exactly my problem, it is not asking all the questions, it only ask the first question and then move out of the AI Node. In fact the OpenAI Chat model returns the next question to ask like ‘when do you want to go?” but the AI Agent does not ask that question in the chat, but it passes the execution to the Node after the AI Node.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.