Overview
The Agentic Search API facilitates deep, intent-focused search patterns. A user’s query is comprehended by a generative AI agent, which designs a set of search queries around it. The agent retrieves items from a Marqo index and returns a collection of result categories. Clients can then render these categories and offer relevant options to the user. The API streams responses in real-time, providing immediate feedback to the user. Developers can override features like the number of results per category, max number of categories, agent parameters, and search settings.Note: Agentic Search is not publicly available at this time. Please contact us to request access.
Use Cases
This API is ideal for situations where a user’s query could span multiple, potentially non-overlapping product categories. The system interprets a high-level query and generates sub-queries (“head queries”) that organize results by category. Best suited for:- Marqo users with diverse product catalogs
- Applications handling ambiguous or broad user queries
API Endpoint
Paths
GET /indexes/{index_name}/agentic-search
Authentication
- Include the
x-marqo-index-idheader (copy it from the Quick Start code snippets for your index in the Marqo Console).
Request Format
UseGET with URL query parameters due to SSE constraints.
Agentic Search Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
q | String | (required) | The user’s query |
categoryResultLimit | Integer | 12 | Number of results per category (distinct from searchSettings.limit) |
maxCategories | Integer | 5 | Maximum number of categories the agent will attempt to return |
clickableSummary | Boolean | true | Defines if the summary will contain markdown content for interaction |
searchSettings | Dict | see below | Configuration used during search (see below) |
userId | String | null | User ID for personalization |
sessionId | String | null | Session ID for personalization |
Clickable Summary
The agent will incorporate suggested follow-up queries in its summary. If this is set to true, the agent will implant this pattern in the summary:[[button:query=<your_query>]]. Custom markdown renderers can then display that text as a button or other element.
Search Settings
| Parameter | Type | Default | Description |
|---|---|---|---|
limit | Integer | 10 | Maximum number of products to return |
offset | Integer | 0 | Number of products to skip (for pagination) |
filter | String | null | Filter string using Marqo’s query DSL to narrow search results |
attributesToRetrieve | List[String] | ["productTitle", "variantTitle", "price", "variantImageUrl", "collections", "_id", "_score"] | Specific product fields to return. If not specified, returns the default core product fields |
facets | Dict | null | Facet configuration for aggregated results |
sortBy | Dict | null | Sort configuration for results ordering |
Example Request
Step 1: Compose JSON payload (pretty-printed here for readability)payload
Response
JSON Response Structure
| Field | Type | Description |
|---|---|---|
summary | String | AI-generated summary of the category results (may include links/buttons) |
categoryHits | List | List of result categories and associated items (see below) |
hits | List | Non-agentic search results using the provided query |
facets | Dict | Optional facets metadata (if configured) |
categoryHits Structure
| Field | Type | Description |
|---|---|---|
category | String | The category label |
hits | List | Documents returned for this category query |
Streaming Response
- Delivered via Server-Sent Events (SSE).
- Each event sends deltas (incremental updates) to the response.
- The final event is of type
stream-endto indicate the end of the stream.
Automatic Filtering
When automatic filtering is enabled for your index, the AI agent can apply precise filters to search results based on user intent. The agent understands the product attributes available in your catalog (brands, price ranges, categories, etc.) and constructs filters automatically when the user’s query implies specific criteria.How It Works
-
Filter construction: When user intent is clear, the agent constructs filter expressions using Marqo’s filter DSL:
- Exact match:
brand:(Nike) - Multiple values:
(brand:(Nike) OR brand:(Adidas)) - Numeric range:
price:[50 TO 100] - Open-ended range:
price:[* TO 100] - Combined:
brand:(Nike) AND price:[* TO 100]
- Exact match:
-
Filter merging: The agent’s filter is merged with any client-provided
searchSettings.filterusing AND. For example, if the client sendsfilter: "availability:true"and the agent constructsbrand:(Nike), the final filter becomes(availability:true) AND (brand:(Nike)). - Zero-hit fallback: If the merged filter yields no results, the agent’s filter is automatically dropped and the search retries with only the client-provided filter. This ensures users always see relevant products even when the agent’s filter is too restrictive.
Response Metadata
When automatic filtering is active, each category in thecategoryHits response includes filter metadata:
| Field | Type | Description |
|---|---|---|
appliedFilter | string | The filter that was actually used for the search |
filterDropped | boolean | true if the agent’s filter was dropped due to zero results |
originalFilter | string | The original filter before fallback (present when filterDropped is true) |