Building an OpenSearch Research Agent at Scale - Alfonso Graziano, Nearform

Mastra
761 views •

Alfonso Graziano, tech lead at Nearform, takes the stage at the TypeScript AI Conference in London to show how they built an OpenSearch research agent for a client in a regulated industry. The problem sounds trivial: a user asks a question in natural language and gets an answer. In practice, it breaks in three places. The schema can break the agent because field names carry no meaning. The context window can break because there are hundreds of indexes and some mappings are too large to send at all. And queries can also break constantly, because the agent is writing the DSL itself against a schema it has only just discovered. You'll see how they tackled this through a meta index that pairs every field with a written description and injects it at runtime, a two-tier architecture that discovers the search space before it ever writes a query, and a self-healing execution loop that starts broad and rewrites its own DSL when it comes back malformed. You'll also see the proxy sitting between the agent and the cluster, handling role-based access control, rate limiting, and session restrictions through Mastra's request context. Recorded at the TypeScript AI Conference in London, July 23, 2026, presented by Mastra. Recorded at the TypeScript AI Conference in London, July 23, 2026, presented by Mastra. 🔗 MENTIONED IN THIS TALK Nearform: https://nearform.com OpenSearch: https://opensearch.org Fastify: https://fastify.dev Pino: https://getpino.io 📚 MASTRA RESOURCES https://mastra.ai https://x.com/mastra_ai https://mastra.ai/community/discord https://github.com/mastra-ai Learn Mastra: https://mastra.ai/learn https://mastra.ai/books/principles-of-building-ai-agents https://mastra.ai/books/patterns-of-building-ai-agents WHAT IS MASTRA Mastra is an open-source TypeScript framework designed for building and shipping AI-powered applications and agents with minimal friction. It supports the full lifecycle of agent development — from prototype to production. CHAPTERS 00:00 Intro 00:58 The wider multi-agent system 02:17 The problem that sounds trivial 03:19 Three places it breaks 04:54 The meta index 06:17 A two-tier architecture 06:52 Progressive discovery 09:29 Execution: broad query, then filters 10:33 Self-healing when queries break 11:49 The OpenSearch proxy 13:21 A real world run 14:01 Nearform and open source

Keyboard shortcuts

On. Switch them off if they collide with your assistive tools; ? still opens this sheet.

Go to

Press g then the letter.

  • gh Latest
  • gs Sources
  • gm Media
  • gv Videos
  • gp Podcasts
  • gc Calendar
  • gd Decoder
  • gz Dataviz
  • ga Datasets
  • gb Blog
  • gk Markets
  • gj Careers
  • gn Prompt Notebook

On this page

  • / Focus search, where there is one
  • t Back to top
  • ? This list
  • Esc Close