Skip to content

Add searchMessages() method to query inside session history #2376

Description

@Navanit-git

Summary

Implement a searchMessages() method across all SDK languages to enable
in-session message filtering and search.

Problem

Users currently has to manually filter through all
session events to find specific messages. This is cumbersome for:

  • Debugging long conversations
  • Finding specific agent responses
  • Building audit/search features on top of the SDK

Proposed Solution

Add async searchMessages(query, options) method that:

  • Accepts string or regex patterns
  • Filters by event type (optional)
  • Supports case-sensitive/insensitive search
  • Returns filtered SessionEvent[] matching criteria

Example Usage

// TypeScript
const results = await session.searchMessages("authentication");
const assistantMsgs = await session.searchMessages("deploy", { 
  eventType: "assistant.message" 
});

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions