What different about search_previous_sessions_history vs add_history_to_messages

what different about search_previous_sessions_history vs add_history_to_messages, I have confused.

Hi @firstagent, thank you for your question

search_previous_sessions_history

  • Purpose: Enables searching through previous sessions (not just the current session)
  • Scope: Looks across multiple past sessions to find relevant information
  • How it works: Adds a tool that allows the agent to search through the last N sessions when needed
  • Control: The agent decides when to search previous sessions based on the user’s query
  • Configuration: Used with num_history_sessions parameter to limit how many past sessions to include

add_history_to_messages

  • Purpose: Automatically adds chat history from the current session to every message sent to the model
  • Scope: Only includes messages from the current session
  • How it works: Directly appends the last N runs/messages to the message list sent to the model
  • Control: Always includes history automatically - no agent decision involved
  • Configuration: Used with num_history_runs or num_history_responses to control how many recent messages to include

I hope this answers your question.Let me know if you have doubts