# Chat History

All messages generated by AI Agents are logged and available for review under **Chat History**.\
This feature provides complete visibility into user conversations, execution traces, and decision-making logic used by the Agent.\
It is designed for **debugging**, **training optimization**, and **behavior auditing**.

Each conversation entry displays:

* User and Agent messages
* Message timestamps
* Channel source (e.g., WhatsApp, Widget, API)
* Credit usage (if applicable)

### **Message Inspection**

Selecting any Agent message opens the **Inspection Panel**, a technical trace viewer that exposes the full reasoning path of the AI model.\
This panel displays:

| Parameter              | Description                                                                        |
| ---------------------- | ---------------------------------------------------------------------------------- |
| **Model Used**         | The LLM responsible for generating the response (e.g., Claude Sonnet 4.5, GPT-4o). |
| **Execution Time**     | Duration in seconds for message completion.                                        |
| **Reasoning Steps**    | Internal thinking layers, including Planning, Task Selection, and Tool Calls.      |
| **Inputs and Outputs** | Structured JSON view of the input data, LLM prompts, and resulting output.         |
| **Credits Used**       | Platform credit consumption for the operation.                                     |

The Inspection view helps technical teams trace *why* the Agent responded a certain way — mapping each reasoning phase from **prompt parsing → tool usage → final output**.

> **Note:** This feature is critical for understanding hallucinations, context loss, or suboptimal responses and allows for precise prompt refinement.

***

### **Agent Optimization**

By studying conversation logs and inspections, developers and operations teams can identify:

* Frequent escalation patterns (topics leading to human handoffs).
* Long reasoning loops or high credit usage per task.
* Prompt sections that cause redundant or low-quality outputs.

Data from Chat History can be used to:

* Rewrite system prompts.
* Adjust model temperature and effort parameters.
* Improve Task logic and condition definitions.
* Train Agents on realistic interaction data.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.zaia.app/inbox/chat-history.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
