Skip to content

Module 3: Context Retriever

Vector search finds documents. But questions like "Why is my order late?" need live data that changes constantly. Context Retriever connects your agent directly to that data.

Vector Search Context Retriever
Data Static documents Live business data
Query "What's your refund policy?" "Why is my order late?"
How Searches by meaning Queries orders, drivers, customers directly

You define your entities. Context Retriever generates the tools. Your agent calls them at runtime.


Cloud setup

1. Create Service

  1. In the Redis Cloud console, find Context Retriever in the left sidebar and click Create custom service.

  2. Fill in the general settings:

    • Service name: digital-native
    • Database: select your workshop database
  3. Click Entities, then Add Entity:

    • Entity name: Customer
    • Key Template: reddash_customer:{customer_id}

This tells Context Retriever how your records are stored in Redis.

  1. Click Fields, then Auto-Detect Fields.

    Auto-detect fields

    Define entities

  2. Click Create.

2. Get your credentials

Now that your surface exists, you need two things from the Console:

  1. Surface ID — copy the Surface ID at the end of the URL bar: app.redislabs.com/#/context-retriever/<surface-id>

  2. Click back to Context Retriever Surfaces

    Back to services

  3. Admin Key — Click the Admin Keys tab and create a new key.

    Admin keys list

Add both to your .env:

CTX_ADMIN_KEY=<your-admin-key>
CTX_SURFACE_ID=<your-surface-id>

3. Complete the surface and load data

You defined one entity. The app needs all 9 (Customer, Order, Restaurant, Driver, Payment, DeliveryEvent, OrderItem, SupportTicket, Policy).

Run these scripts to automatically add the remaining entities for you.

make setup-surface
make load-data
.\workshop.ps1 setup-surface
.\workshop.ps1 load-data

Explore the Tools & Entities

Go back to your Context Retriever service in the Redis Cloud console and scroll down.

You defined the entities and Redis created the pathways for the agent to retrieve data in line with your business logic via MCP tools.

9 entities, each mapped to your Redis keys with full field definitions, types, and relationships:

Entities view

Expand any entity. Context Retriever understands every field and how entities relate to each other (e.g. Order.driver_idDriver).

62 auto generated MCP tools

Generated MCP tools

Your agent now has filter_customer_by_city, get_order_by_order_id, search_restaurant_by_name, and 59 more, all backed by sub millisecond Redis queries.


Try it

Restart with make dev, then open localhost:3040.

The mode toggle now shows Real-time Context and the top-right button says Redis Iris.

  1. Click Redis Iris to open the activity panel
  2. Ask: "Why is my order running late?" — watch the agent chain multiple MCP tools to pull your order, your driver, and your delivery events
  3. Try: "Show me my order history"
  4. Switch back to Simple RAG and ask the same question. Notice the difference