n8n-chatbot-AI_agent

Hi Everyone, I want to know if gemma3:27b may have limitations with tool calling in AI agents. Because when I use it, it doesn’t call tool connected with AI agent. The response is also in JSON format. But when I use gpt-oss-120b, the output in chatbot shows {“output”:“”} only. I use chat model from ollama hosted in my company.

Hey @thangoun Welcome to the n8n community!

When you have a moment, could you share the system prompt for the AI agent? I’d also be interested to understand the reasoning for using gpt-oss-120b.

it is simple like this.

You are a ClickHouse database assistant for manufacturing analytics.

Rules

Always use the query_clickhouse tool

Always include context columns (date, product, line, location)

Use correct column names (verify with DESCRIBE TABLE if needed)

Default limits: 100 for details, 10–20 for summaries

Order recent data by date descending

Use ‘YYYY-MM-DD’ date format

Quote strings; do not quote numbers

Be clear, conversational, and explain results

Tool

query_clickhouse: executes SQL and returns JSON results

we can get a better prompt from gpt also.

Hi @thangoun! Hope you’re doing well. As far as I know, Gemma returns JSON as plain text instead of emitting real tool calls, and that is the limitation. If you plan to use it, the recommended approach is to avoid the AI Agent node and use the HTTP Request node or explicit workflow logic instead.

@tamy.santos thank you for ur suggestion. I need chatbot to answer the user questions related to database. Without AI agent, can I just use chat model?

@thangoun , Yes, you can. Use the workflow to fetch the data and use the Chat Model only to respond to the user based on those results.

1 Like

Hey @thangoun Thank you for sharing your system prompt!

It looks like your system prompt pretty intensive and involves multiple tool calls with some computational power needed and a really small model like gpt-oss-120b is NOT capable for doing that job.

I suggest you use gpt-4o or 4.1 these tend to have 12 billion parameters which can get the job done easily because they can understand the system prompt word to word.
and Hence they can talk to user while keeping the understanding of tool calling and the instructions received in the system prompt.

I hope this helps you @thangoun

1 Like

@Deepankar yes, thank you for your suggestion. But when I choose other gpt model, the chatbot shows {“output”:“”} only and it didn’t even say a normal reply like “Hi, how can I help you”.

Hey @thangoun !

Can you please share your workflow here so that i can debug it properly here.
Because i sense there could be and issue of the output not being parsed out properly but the ai agnt would be prcessing it.

It is like that @Deepankar

1 Like

Gemma returns JSON as plain text instead of emitting real tool calls, and that is the limitation.

Thanks @thangoun for sharing your workflow !

I just implementd the same exact workflow just switched the model from gpt-oss one to gpt-4o and it is working for me.

Please copy the one that i have embedded here and let me know if you face any problems.

Also have you updated your n8n instance ?

1 Like

@Deepankar thank you for your reply. As I am using local ollama model from hosting in my job, it has limitation on calling tools.

1 Like

@thangoun Oh thanks for the clarification there but you can also try to model there right , or am i missing something.

the chat model I choose from my ollama server is not working in n8n when I add tools in AI agent. Without tools in AI agent, it works. But that same chat model is working well in Flowise. Both n8n and Flowise are running on my company hosting. I also got this feedback from Eric.

”As for gpt-oss-120b, the {“output”: “”} response usually means: • The model attempted to comply with a tool schema • But the hosting layer (Ollama + agent framework) swallowed the response due to: • Strict output validation • Missing function-call metadata • Model not emitting the expected tool-call token format In short: • Open-source models ≠ drop-in replacements for tool-calling agents • Tool calling depends on model architecture + serving layer + agent runtime • Most OSS models need prompt shims, JSON repair, or router layers to work reliably”