Switch node always goes to second branch

Hello!
I’m using n8n to build a chatbot. I have a Switch node that is supposed to check whether the assistant knows the answer or not:

  • If the assistant knows the answer → go through the first branch and respond via HTTP
  • If the assistant doesn’t know → go through the second branch and send the question to Google Sheets and Telegram

However, the Switch always follows the second branch, even when the assistant knows the answer. Both branches show green, but the first branch is never executed.

I’m using the contains operation with the value "Извините, я не могу ответить" — if this phrase is present, that means the assistant doesn’t know.

Please help me understand what could be wrong. I can share screenshots or export the workflow if needed.

Thank you!

You could explicitly mention the AI Agent to pass a “knows-answer” as true or false. Further use an output parser so you can directly compare with that !



1 Like


У меня возникла проблема с AI Agent в n8n.

Я использую AI Agent вместе с OpenAI ChatModel, и хочу подключить после него Structured Output Parser, чтобы обрабатывать ответ с полями known и output.

Но выход (output) от AI Agent не даёт подключить Structured Output Parser — узел просто не соединяется, как будто нет доступного output.

This happens because Structured Output Parser is not a tool. In order to connect it to the AI Agent you will need to enable “Require Specific Output Format” in the AI Agent node.
Then the node will gain an additional leg, which you will be able to connect Structured Output Parser to.

Это происходит из-за того, что Structured Output Parser - это не инструмент. Для того, чтобы подключить его к AI Agent, Вы должны будете включить опцию “Require Specific Output Format” внутри AI Agent. Затем у AI Agent появится дополнительный коннектор для подключения Structured Output Parser.

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