Skip to main content
This demo is a movie recommendation chatbot built with @meilisearch/ai-sdk and the Vercel AI SDK. Describe the evening you have in mind, and the agent decides which searches to run against the movies index before recommending anything. The agentic movie search demo running two searches and recommending auteur films

Key features

  • Agent-driven queries: The model writes its own search queries instead of searching for the user’s words. Asking for “films d’auteur, nothing boring” leads it to search for “auteur art house drama” and “Quentin Tarantino”. This is the core idea behind agentic search.
  • Multiple searches per question: The agent keeps searching until it has enough material to answer, running up to five steps per turn to cover different angles.
  • Two search tools: meilisearchSearch looks up movies by title or description, and meilisearchSearchSimilar finds related titles through the /similar endpoint from a movie the user already likes.
  • Hybrid search under the hood: The search tool is configured with hybrid search and a semanticRatio of 0.5, so queries such as “art house” match on meaning as well as on keywords.
  • Visible search steps: Every search appears above the answer as “20 results found for …”. Expand any step to see the exact documents Meilisearch returned, which is the same idea as displaying source documents in your own agent.
  • Rich results: The model interleaves prose with movie blocks, which the interface renders as cards with posters and release years instead of a plain list of titles.
  • Conversational refinement: Follow-up messages keep the context, and the agent suggests ways to narrow down, such as choosing between more cerebral and more kinetic picks. Its behavior is steered by a system prompt, as described in optimize chat prompts.
  • Genre shortcuts: The home screen offers 12 genres for visitors who would rather browse than describe what they want.

Example conversation

  1. “A friend is coming over tonight and he loves films d’auteur. What would you recommend? Nothing boring please.” The agent searches for “auteur art house drama” and “Quentin Tarantino”, then recommends Pulp Fiction, Django Unchained, and Inglourious Basterds, explaining why each one fits.
  2. “Something more cerebral” Runs a new search and moves toward Kubrick and slower-burn titles, keeping the earlier constraints in mind.

How it works

The application is a Next.js app. Its chat route gives Claude Sonnet 4.5 two Meilisearch tools and lets the model decide when to call them:
Both tools use an embedder named small and a search API key scoped to the movies index. Responses stream back with streamText. The stopWhen: stepCountIs(5) option stops the tool-calling loop after five model steps, which is what limits how many searches the agent can chain together. Reaching that limit ends the loop, so it does not by itself guarantee a final answer. The movies dataset is public, so you can clone the repository and run the same demo locally. To build the same thing step by step with your own data, follow the agentic search getting started guide.

Try the demo

Ask for a recommendation and watch the agent search

Source code

Next.js application on GitHub

AI SDK integration

Give your own agent a Meilisearch search tool

Agentic search

Learn how agentic search works with Meilisearch
Looking for classic search on the same kind of movie data? See the Where to Watch demo, which showcases hybrid search, recommendations, and custom ranking rules.