Lesson 2. Logging: How to Understand What's Happening#
Goal: learn to log agent actions so you can quickly find and fix errors.
What Is Logging#
Logging is recording all important events in the agent's work:
- who contacted the agent and when
- what the agent did (read data, sent a message, called an API)
- what errors occurred
- how long each operation took
Why it matters:
- Debugging: if the agent breaks, you can check the logs and see where the error happened
- Monitoring: you see how many requests the agent handles, which requests are most popular
- Security: you spot suspicious activity (e.g., too many requests from one IP)
What to Log#
Always log:
-
Incoming requests:
- date and time
- user ID (or anonymous identifier)
- request text (or its essence)
-
Agent actions:
- which API was called
- what data was sent (no sensitive data!)
- result (success / error)
-
Errors:
- date and time
- error description
- error stack (if available)
- what the agent was doing when the error occurred
-
Metrics:
- request execution time
- requests per hour / day
- error count
Never log:
- passwords
- payment data (card numbers, CVV)
- full personal data (passports, tax IDs) — only hashes or IDs
How to Log in No-Code Tools#
1. Google Sheets (simple option)
Create a "Logs" table with columns:
| Timestamp | UserID | Action | Details | Status | ErrorMessage |
|---|---|---|---|---|---|
| 2026-02-03 10:15:00 | 12345 | send_email | to: ivan@example.com | success | |
| 2026-02-03 10:16:00 | 12346 | call_api | API: OpenAI, model: GPT-5.2 | failed | Rate limit exceeded |
Each time the agent performs an action — a new row is added.
How to implement:
- in Zapier / Make / n8n add a "Google Sheets → Add Row" step after each important action
- pass to the table: timestamp, userID, action, details, status
2. Airtable (better for analysis)
Create a "Logs" base with fields:
- Timestamp (date and time)
- UserID (link to Users table)
- Action (single select: send_email, call_api, create_record)
- Status (single select: success, failed)
- ErrorMessage (long text)
Benefits: you can filter, group, and build views (errors only, successes only).
3. Built-in Platform Logs
Many platforms have built-in logs:
- n8n: Executions (workflow run history)
- Zapier: Task History (Zap run history)
- Make: History (scenario history)
- Zapier Chatbots: Logs (in the chatbot dashboard)
Use built-in logs for debugging, but for long-term storage and analysis it's better to duplicate to your own table.
How to Read Logs#
Scenario 1: agent didn't send email
- Open the logs table
- Find the record with
Action = send_email - Check
StatusandErrorMessage - If
Status = failed,ErrorMessage = "Invalid email address"→ problem with email format - Fix the data (or validation) and test again
Scenario 2: agent became slow
- Check the "Execution time" metric (if you log it)
- Find the step that takes the most time
- Optimize that step (caching, batch requests, switching to a faster API)
Practical Example: Support Bot Logging#
Logic:
- User sends a question to the bot
- Agent logs:
Timestamp, UserID, Action: "incoming_message", Details: "How do I request a refund?", Status: "received" - Agent searches for an answer in the knowledge base
- Agent logs:
Action: "search_kb", Details: "query: refund", Status: "success" - Agent sends a response to the user
- Agent logs:
Action: "send_response", Details: "response sent", Status: "success"
If something breaks:
- open the logs table
- filter by
Status = failed - see which step failed
- fix it