Checking the context and token usage of a conversation

Check how full the context window is and how many tokens a conversation used in Cloudera Agent Studio, so that you can decide whether to compact a long conversation.

The /context command shows the current occupancy of the context window. The /usage command shows the cumulative token totals that Agent Studio recorded. The two values measure different things, so do not compare them directly. See Context, compaction, and token usage.

  • Open a chat with an available agent, and wait until the chat is ready. See Slash commands in chat.
  • Make sure that the conversation exists. Both commands need an existing conversation.
  • If an agent run is in progress, wait until the run finishes.
  1. In the message box, enter /context, and then press Enter.
    A command card shows the context percentage, the number of context tokens, the size of the context window, the number of messages, and the model. When an auto-compaction threshold is available, the card shows it. If a restore paused automatic compaction, the threshold tile shows paused.
  2. Review the card.
  3. Optional: In the message box, enter /usage, and then press Enter.
    A command card shows the input and output token totals, the number of messages, the model, and the cost.
  4. Continue the conversation with an ordinary message.
    The command cards disappear when the message starts a run.

The cards show the state of the conversation when you submitted the commands. Neither command changes the conversation.

If the context window is nearly full, compact the conversation. See Compacting a conversation.