Agent / LLM Integration Notes - Content Management
Agent / LLM Integration Notes
When exposing eSearch to an LLM via agent tools:
-
Accept nested JSON, flatten to bracket notation. LLMs naturally generate nested JSON objects:
{"searchParams": {"searchOperator": {"objectType": "...", "searchItems": [...]}}}. Auto-flatten tosearchParams[searchOperator][searchItems][0][objectType]=...at the tool layer. Alternatively, send the JSON body directly withContent-Type: application/json— the API accepts both formats with identical results. -
Split into simple + advanced tools. Provide a simple
search(query, page_size, order_by)tool for keyword searches (90% of requests) and an advancedsearch(search_params)tool for caption timestamps, date ranges, and complex logic. Both call the same underlying API. -
Return the full API response including
itemsData,highlight, andaggregations. Downstream consumers rely on these fields for display and faceting: caption timestamps for clip playback, match context for summarization, faceted counts for dashboard queries. -
Use concrete objectTypes for orderBy.
KalturaESearchOrderByItemis abstract and returnsOBJECT_TYPE_ABSTRACT. UseKalturaESearchEntryOrderByItemfor entry search,KalturaESearchCategoryOrderByItemfor category search,KalturaESearchUserOrderByItemfor user search,KalturaESearchGroupOrderByItemfor group search. -
Caption timestamps for clip playback. When an LLM searches captions, the
itemsData[].items[]array containsKalturaESearchCaptionItemDataobjects withstartsAtandendsAtin milliseconds. Use these to seek a player to the exact moment a topic is discussed. -
Aggregation double nesting. The aggregations parameter path is
searchParams[aggregations][aggregations][0]— easy for an LLM to get wrong. The simple tool should handle common aggregations (by media type, by category) without exposing this complexity.