← Back to library

Log every agent action as ok, failed or unknown

ccch713, who runs a dental clinic's booking agent, followed up a double-booking post on the n8n Community forum with the logging that makes such failures findable. Each write logs one of three outcomes and the agent's next move, with no conversation content, and one query should always stay empty. We turn it into a setup guide.

  • OutcomeGive each write an agent makes one structured log line with its attempt ID, request key, an outcome of ok, failed or unknown, and what the agent did next, then keep one saved query for the combination that should never happen, an unknown outcome the agent confirmed to the customer, so a repeat of the incident shows up in minutes.
  • SetupUnder an hour
  • LevelIntermediate
  • Creditccch713
View original
Works with
n8nCustom agentChatGPTClaude

Published Nov 10, 2026Updated Nov 10, 2026AI dry run on sample input: passed Nov 10, 2026Source verified Nov 10, 2026

When should you use it?

  • An agent creates, changes or cancels bookings, orders or records through tools
  • Your logs say success or error, but timeouts and empty replies fall into neither
  • You learned about a past agent failure from a customer rather than from your own monitoring

Not for: Read-only agents, where an ambiguous call does no harm; Teams that want full transcripts for analytics; this log deliberately leaves them out; Systems where you cannot attach a request key to a write

What do you need, and what do you get?

You need

  • The list of write tools your agent can call
  • A stable request key per customer request
  • A table, sheet or log store with a simple query tool
  • A place for a person to pick up unknown outcomes

You get

  • One log line per write attempt: attempt ID, request key, outcome and next move
  • An escalation path for unknown outcomes instead of an automatic retry
  • A saved query for unknown plus confirmed that should return nothing
  • A repeat-key test that runs after every workflow change

How does it work, step by step?

  1. Define three outcomesOk means an explicit confirmation came back, failed means a clear rejection, and unknown covers timeouts, empty replies and anything else you cannot read.
  2. Record the next moveAdd a field for what the agent did after the call: confirmed to the customer, escalated to staff or retried.
  3. Write the status firstIn n8n, put the log step in a sub-workflow that runs just before the write node, so a retry of the write does not replay it.
  4. Send unknowns to a personRoute the unknown outcome to a human task, never into an automatic retry.
  5. Watch the empty querySave a query for outcome unknown with next move confirmed, check it daily, and keep a test that sends the same request key twice and expects one write.

The prompt

Our own prompt, inspired by ccch713 and written to work in n8n, Custom agent, ChatGPT and others. Values in lime are placeholders.

Fill in the blanks (optional; the copied prompt uses your values)

Prompt3 variables
Design the action log for my agent workflow in {platform}. The agent's write tools are: {write_tools}.
For every write attempt, log one line with: attempt_id, request_key, tool, outcome (ok = explicit confirmation, failed = clear rejection, unknown = timeout, empty or unreadable reply) and next_move (confirmed, escalated or retried). Never log conversation text or personal data.
Show me where the log step goes so a retry of the write does not repeat it, how unknown outcomes reach {staff_queue} instead of being retried, the saved query for outcome = unknown AND next_move = confirmed, and a test that sends the same request_key twice and expects exactly one write.

Inspired by ccch713: n8n Community: ok / failed / unknown, what we log so ambiguous failures get found. The prompt above is written by playbooks.bot in our own words; nothing from the original is quoted.

What can go wrong?

  • Logging only success and error hides the one state that causes harm. Without a word for unknown, the incident stays invisible.
  • Putting the log step inside a node that retries makes it repeat with every retry, which reproduces the original bug.
  • Logging conversation text adds privacy risk and no investigative value here. Keep the trail to IDs and decisions.
  • Dashboards are optional. A single line per attempt plus a query you expect to come back empty is enough to start.

Our take

This is a follow-up to a post we featured yesterday, and it earns a separate page because it answers a different question. The first post was about stopping the double booking. This one is about making sure you would notice if anything like it happened again. The insight is in the vocabulary. Most logs have words for success and failure but none for not knowing, and the not-knowing case is exactly where agents get into trouble by sounding sure. Adding the agent's next move to the same line is the clever part, because the harmful pattern becomes one searchable combination. We also like the restraint: no transcripts, no new dashboards, just IDs, outcomes and decisions. That keeps patient data out of the log and keeps the setup small enough to maintain. The n8n detail about placing the log step outside the retried node is worth reading twice if you build there. In our dry run, a mock of three bookings with one forced timeout produced three log lines, routed the unknown to staff, and the never-happen query returned nothing.

Where the time goes back: When something odd happens, one filter on one table shows every ambiguous action and what the agent did about it, instead of hours spent reading transcripts.

FAQ

Why is a timeout not just an error?
Because the action may have gone through. An error says it did not happen; a timeout means you cannot tell, so it needs a different response.
Did it help?
The author reports no duplicate bookings since the change, and says the repeat-key test has caught two regressions in other workflows before users saw them.
Is this related to the earlier double-booking guide?
Yes. It is the same author's follow-up. The earlier entry covers the agent's reply and request keys; this one covers the logging that makes a recurrence easy to find.

Source and credit

Inspired by ccch713. We describe the idea in our own words, link to the original, and wrote the prompt ourselves; nothing is quoted.

Inspired by
n8n Community: ok / failed / unknown, what we log so ambiguous failures get found
Creator
ccch713
Published on
n8n Community
Original date
Nov 10, 2026
License
Not openly licensed (the poster keeps all rights), so we quote nothing and link to the original
Originally for
n8n
AI dry run
Nov 10, 2026: passed. Dry-run tested by our AI test agent on sample input. Three log lines, unknown routed to staff, repeat key wrote nothing, never-happen query empty.
AI dry run on sample data; not run with live connected accounts. The playbooks.bot test agent filled the prompt with synthetic inputs, produced the output and checked it against the page's stated outputs and guardrails.
Verified
Nov 10, 2026: source link resolves to the original, the credited creator published it, our excerpt or prompt matches it, and the license allows our use.

Are you the creator? Claim or correct this page.

More in Operations & Admin

All 203 Operations & Admin playbooks →

Related playbooks

Operations & AdminWorkflow✓ AI dry run

Pin your agent's write path with one contract test

Build a single fast test workflow that sends the same request key to your agent's booking or order write twice against a stand-in backend, then confirms from an append-only log that exactly one write happened, that the repeat ends as a deliberate skip, and that a forced timeout still lands as unknown and reaches a person, so refactors cannot quietly bring back duplicate writes.

Credit: ccch713

An afternoon+
Operations & AdminWorkflow✓ AI dry run

Gate after-hours dental phone triage and booking

Calls are answered and booked against the real schedule, emergencies reach the dentist, and reminders and recalls run without front-desk time.

Credit: u/anassy1 on r/AiAutomations

An afternoon+
Operations & AdminWorkflow✓ AI dry run

Catch the emails your AI inbox assistant never processed

Run your AI email triage workflow as usual, label every message it handles, and add a second, independent workflow that once a day searches the inbox for recent mail without that label and sends you the list, alongside retries on the model steps and a production-status sign-in so the trigger does not silently expire.

Credit: Huzaifa_Aamish

Under an hour
Operations & AdminWorkflow✓ AI dry run

Confirm tables on WhatsApp against a live book

Guests book a table by chatting on WhatsApp, staff see bookings on a table plan, and reminders go out automatically.

Credit: u/begylewis on r/micro_saas

An afternoon+
Operations & AdminSkill✓ AI dry run

Write an NCR that scopes and locates every suspect part

Use the ncr-writeup skill from Anthropic's Claude for Manufacturing plugin to turn an inspector's finding or a customer complaint into a nonconformance report that records the measured condition, cites the exact requirement at the revision the part was built to, works out how many parts are suspect and why, checks all five places they could be, searches earlier reports for the same problem and drafts a customer notice when bad parts may have shipped.

Credit: anthropics

Under an hour