Skip to main content
When an agent gives a wrong or incomplete answer, two tools help you find the cause:
  • Search Lab shows which documents your knowledge base returns for a question, without running the agent.
  • Self-improve analyzes a real conversation, explains what went wrong and suggests fixes you can apply in one click.

Search Lab

Use Search Lab to check whether the right documents come up for a question.
1

Open Search Lab

Go to Knowledge > Advanced > Search Lab.
2

Run a search

Type the user’s question in Message, select the agent (its knowledge sources are searched), set Results to the number of documents to return, then click Search or press Ctrl + Enter (⌘ + Enter on Mac).
3

Review the results

Documents are ranked from the closest match to the furthest. Each result shows its title, its source and a Similarity score: the higher the score, the closer the match. The score is green above 0.7 (High), amber from 0.4 to 0.7 (Medium) and grey below (Low). Click a row to read the full document.
To compare two embedding models, open Advanced Settings, turn on Compare Models, and choose Model 1 and Model 2. The results of both are lined up rank by rank, and Only in this model marks the documents that just one of them found. Try several phrasings of the same question. If the right document only appears for some of them, add those phrasings to the document as related questions.

Self-improve

Self-improve analyzes a conversation and proposes changes to your agent’s instructions or to your documents.

Open Self-improve

  1. Open a conversation in the admin interface.
  2. In the conversation sidebar, add an evaluation comment that describes what went wrong.
  3. Open the conversation menu and choose Self-improve.
You can also click Self-improve on a test result in Simulation Testing. Then choose an analysis mode:

What Auto Analysis looks at

The analysis reads the first ten messages of the conversation, the documents that were retrieved, and the tool calls the agent made: which tool or agent was called, with which arguments, whether it succeeded, and what it returned. This tells apart a failed action from a wrong answer built on a correct tool result. Router clarifying questions and the reply options they offered are included too. Very long tool inputs and results are shortened. The result shows the identified issue, a confidence level, and the most similar documents in your knowledge base with their similarity scores.

Apply a suggested fix

Each suggested action shows what it will change. Review it, then click Apply. When you edit proposed instructions, click Enter fullscreen to get a larger editor, and expand Current Prompt to compare with the existing instructions. Exit fullscreen or Escape returns to the smaller dialog without losing your edits. For an Improve Document analysis, review the explanation, the document link and the proposed changes before applying them.

Common problems

  1. Run the user’s exact question in Search Lab with the same agent.
  2. If the document is missing from the results, check that its source is synced and assigned to the agent.
  3. If it appears low in the list, add the user’s phrasing as a related question, or improve the document’s title and headings.
Make the right document’s title and headings more specific, and split documents that cover several unrelated topics.
Run Auto Analysis on the conversation. If no documents were retrieved, the agent had no context to answer from. Otherwise, make the tool’s description more precise and state in the agent’s instructions when to use it. See Writing Tool Descriptions.
Compare the retrieved documents across conversations. Lower the agent’s temperature for more consistent answers, and pin the documents the agent must always see.