Set up
1
Create a key
In Team settings → API keys, create a key. The default read access (
knowledge:read, conversations:read) covers answers, searches, stats and gaps; also turn on quality:read to read test questions and runs. To let the agent apply fixes, also turn on knowledge:write and quality:write.customers:read is off by default, so the analysis endpoints return customer emails and phone numbers as [email] and [phone] and keep them out of the agent’s context.2
Install the CLI and sign in
TOTEBOT_API_KEY in the environment. See the CLI overview.3
Ask
In Claude Code, ask for example: “Analyse the knowledge base of my Shop agent and tell me what to fix.” The Totebot skill and
totebot ai-guide give the agent a step-by-step recipe.What the agent does
The recipe intotebot ai-guide (“Analyse and improve my knowledge base”) walks through these steps:
The API reports data as it is (counts, sources, scores, labels). The analysing agent decides what matters.
To go further than knowledge, with instruction and model changes tested before they are applied and a rollback if results get worse, see Optimize your agents with Claude Code.
What the data means
- Answers. For each customer message: the replies, every knowledge search with the sources it returned and their scores, the tools the bot called, and
usedNoToolwhen the bot answered from its instructions alone. Tool calls come from the stored playground trace when there is one, otherwise from the conversation state (toolCallsSource). - Searches.
originisTOOL(the bot searched),PREFETCH(the automatic search before every answer) orPRODUCT_FINDER.empty: truemeans nothing came back. - Stats.
retrievalShareis the share of customer messages with at least one search.neverReturnedSourceslists live sources no search returned in the range: often outdated, duplicated, or worded differently from how customers ask. - Gaps.
verificationisMISSING(not in the knowledge) orPARTIAL(partly covered).RETRIEVAL_MISSgaps, hidden by default, are covered by the knowledge but search did not find the answer: rewording or a Q&A usually fixes them.signalsshows thumbs-down and handovers.suggestedAnswerDraftcomes from a team member’s reply, with emails and phone numbers masked. - Test questions. Each has the sources search must return and the facts the answer must state. A run reports pass or fail per question. Add
--prompt-filetototebot tests runto try new instructions without saving them.
retrievalDataAvailable is false and the search metrics are null, so they read as not available rather than 0%. Playground conversations are left out of the stats.
What the agent never sees
- Other teams’ data, or agents the key is not allowed to access.
- System notes, raw tool output, visitor ids, IP addresses or message metadata.
- Customer emails and phone numbers, when the key has no
customers:read.
Example session
Plain API
Without the CLI, the same calls are in the typed client (totebot.analysis, totebot.gaps, totebot.tests) and in the API reference: