Debug AI Agent Tool Calls with OpenRouter, Calculator & Webhook
Debug AI Agent Tool Calls with OpenRouter, Calculator & Webhook
Regular price
£17.99
Regular price
£17.99
Sale price
Unit price
/
per
⬇
Instant Digital Download
∞
Unlimited Downloads
★
Lifetime Access in Your Account
Couldn't load pickup availability
🔥
128+ Sold
Popular with n8n builders
⚡
23 people viewing
High interest right now
✅
9 added today
Fast-moving digital product
Debug AI Agent Tool Calls with OpenRouter, Calculator & Webhook
Regular price
£17.99
Regular price
£17.99
Sale price
Unit price
/
per
Debug tool calls in your n8n AI support agent—using Calculator, a simulated Order Lookup, and an incoming Webhook
This n8n workflow helps you verify whether your AI Agent correctly calls tools, by comparing a correct arithmetic result, a found order response, and an empty order lookup that can still “succeed.” It’s Exercise 4 from the n8n Production AI Playbook on Audit & Trace.
What this workflow does
- Receives a POST Webhook with a natural-language query.
- Runs “Support Agent”, an AI Agent using an OpenRouter chat model, which decides whether to call a tool.
- Uses the Calculator tool to handle arithmetic questions (e.g., “47 times 89”).
- Uses the Order Lookup Tool to return a simulated order record, or an empty string when the order does not exist—useful for tracing “empty lookup” behaviors.
- Responds back to the webhook caller with the agent’s final answer.
Use cases
- Audit & Trace tool calling: confirm the agent calls Calculator for math and Order Lookup for order questions.
- Detect misleading “success”: compare replies when an order lookup returns an empty value (e.g., ORD-8888) versus a found record (e.g., ORD-1001).
- Support automation QA: validate end-to-end behavior before deploying a tool-using agent in production.
Technical details
-
n8n nodes:
webhook,n8nn8n-nodes-langchainagent(Support Agent),respond to webhook, and tool nodes includingn8nn8n-nodes-langchaintool codeandn8nn8n-nodes-langchaintool calculator. - OpenRouter integration: add an OpenRouter API credential to “OpenRouter - Agent” and choose a model that supports tool calling.
- Optional tracing: enable OpenTelemetry tracing in Settings > OpenTelemetry to view spans per tool call.
Quick setup & customization
Test via the Webhook Test URL using queries like {"query":"What is 47 times 89?"} and {"query":"How much was order ORD-8888? Tell the customer the amount."}. For clearer outcomes, you can customize the Order Lookup Tool to return "No order found" instead of an empty string.
