Skip to content

Manage messages·

inspect and compact the running agent's own conversationtools/manage_messages.py, 1 tool.

From the module docstring

Manage agent.messages — list/drop/compact/clear/stats.

tool does
manage_messages Manage the current agent's conversation history.

manage_messages·

manage_messages(
    action: str = 'stats',
    turns: Optional[str] = None,
    start: Optional[int] = None,
    end: Optional[int] = None,
    role: Optional[str] = None,
    summary_len: int = 100,
    **kwargs,
) -> str

Manage the current agent's conversation history.

Actions

  • "stats": show counts (messages, turns, total chars)
  • "list": show all messages with index + role + preview
  • "list_turns": show turn-grouped view
  • "drop": remove turns by index. Use turns="0,2,5" or start+end.
  • "compact": strip toolUse/toolResult blocks from turns, keeping text only. Use turns="0,1,2" or start+end. Default: compact all but last 3.
  • "clear": remove ALL messages (full reset)

source: tools/manage_messages.py:63