Library / AI Agents & Assistants
AI Agents & Assistants
Log OpenAI agent runs as hash-chained receipts in Data Tables per client
Receives client prompts by webhook, runs an OpenAI AI Agent, and stores each run in a per-client, hash-chained Data Table log so later edits can be detected.
What it does
## Log every AI agent run per client and check it later For agencies and freelancers who run an AI agent for paying clients and want to show a client later what the agent was asked, what it answered, and that the record has not been edited since. ### How it works 1. Your app POSTs { "client_id", "prompt" } to Agent request. 2. The AI Agent runs with Max Iterations and a token limit from Settings. 3. Every run, whether answered, failed or refused, becomes one entry in that client's chain in the agent_run_log Data table: SHA-256 of prompt and answer, model, model and tool calls, outcome, prev_hash and entry_hash. Raw text is not stored unless you turn on store_text. 4. The caller gets the answer plus a receipt (seq, entry_hash). If the entry can't be written, the answer is withheld (503) and you get an email. 5. Every night the whole log is checked again. You get an email naming the first break, or a daily anchor (last hash per client) that is your copy outside n8n. 6. Verify request returns one client's chain status, safe to show that client. ### Setup steps 1. Create the two Data tables in the note below. 2. Credentials: OpenAI on Chat model, Header Auth on both webhooks, SMTP on the three email nodes. 3. Fill in Settings and Daily check settings. 4. Publish, then run the examples in Try it.
The steps
- Agent request
- Settings
- Validate request
- Route the request
- Reject: bad request
- Client AI agent
- Chat model
- Calculator tool
- Build the log entry
- Read the chain head
- Link and hash the entry
- Append to the log
- Re-read around the entry
- Confirm the position
39 steps in total.
Similar automations
AI Agents & AssistantsAnswer Vapi order-status calls and log callbacks in Data Tables24 stepsCode, Git & Developer ToolsTrack LLM token spend per workflow with n8n API, data tables, and Slack alerts11 stepsEmail AutomationChase UK late invoice payments with Data Tables, GOV.UK and SMTP email21 stepsEmail AutomationSend incident digest emails from Statuspage vendors with SMTP and Data Tables11 steps