|
| 1 | +--- |
| 2 | +alwaysopen: false |
| 3 | +categories: |
| 4 | +- docs |
| 5 | +- operate |
| 6 | +- rc |
| 7 | +description: Create a Context Retriever service in Redis Cloud to expose schema-first retrieval tools to AI agents. |
| 8 | +hideListLinks: true |
| 9 | +linktitle: Create service |
| 10 | +title: Create a Context Retriever service |
| 11 | +weight: 5 |
| 12 | +--- |
| 13 | + |
| 14 | +Redis Context Retriever helps teams expose operational context to AI agents through schema-first retrieval. This guide walks you through creating and configuring a Context Retriever service in Redis Cloud. |
| 15 | + |
| 16 | +## Prerequisites and limitations |
| 17 | + |
| 18 | +To create a Redis Context Retriever service, you will need a Redis Cloud database that already has relevant data. If you don't have one, see [Create a database]({{< relref "/operate/rc/databases/create-database" >}}). If your source data lives in a relational database, use [Redis Data Integration (RDI)]({{< relref "/operate/rc/databases/rdi" >}}) to ingest it into a Redis Cloud database first. |
| 19 | + |
| 20 | +{{< note >}} |
| 21 | +Agent Memory does not support the following databases during public preview: |
| 22 | +- [Redis Flex]({{< relref "operate/rc/databases/create-database/create-flex-database">}}) databases |
| 23 | +- [Active-Active]({{< relref "/operate/rc/databases/active-active" >}}) databases |
| 24 | +{{< /note >}} |
| 25 | + |
| 26 | +## Create a Context Retriever service |
| 27 | + |
| 28 | +From the [Redis Cloud console](https://cloud.redis.io/), select **Context Retriever** from the left-hand menu. |
| 29 | + |
| 30 | +If you have not already created a Context Retriever service, you'll see a page with an introduction to Context Retriever. Otherwise, select **New service** to go to the Context Retriever introduction page. |
| 31 | + |
| 32 | +{{<image filename="images/rc/langcache-new-service.png" alt="The New service button." width="150px" >}} |
| 33 | + |
| 34 | +From here, you can either: |
| 35 | + |
| 36 | +- Select **Get started** to follow a step-by-step guide using the `ctxctl` CLI, which is installed with the [Context Surfaces Python Client](https://pypi.org/project/context-surfaces/). |
| 37 | +- Select **Create custom service** to manually configure your own context retriever settings. |
| 38 | + |
| 39 | +For this guide, select **Create custom service**. |
| 40 | + |
| 41 | +### General settings |
| 42 | + |
| 43 | +The **General settings** section defines basic properties of your service. |
| 44 | + |
| 45 | +{{<image filename="images/rc/context-retriever-general-settings.png" alt="The General settings section." >}} |
| 46 | + |
| 47 | +| Setting name | Description | |
| 48 | +|:-------------|:------------| |
| 49 | +| **Service name** | Enter a name for your Context Retriever service. We recommend you use a name that describes your service's purpose. | |
| 50 | +| **Select database** | Select the Redis Cloud database to use for this service from the list. | |
| 51 | +| **Description** | Enter a description for your context retriever. | |
| 52 | + |
| 53 | +Select **Entities** to continue. |
| 54 | + |
| 55 | +### Define entities |
| 56 | + |
| 57 | +In the **Define Entities** step, you'll define the objects that Context Retriever will use to generate retrieval tools. |
| 58 | + |
| 59 | +{{<image filename="images/rc/context-retriever-define-entities.png" alt="The Entities section." >}} |
| 60 | + |
| 61 | +Select **Add Entity** to add an entity. |
| 62 | + |
| 63 | +{{<image filename="images/rc/context-retriever-define-entities-table.png" alt="The Entity table with the Entity Name, Key template, and description." >}} |
| 64 | + |
| 65 | +- In the **Entity name** field, enter the name of one of the business objects that is in your database. |
| 66 | + |
| 67 | + For example, your database might have a bunch of product information with keys like `product:1` or `product:2`. In this case, the entity name would be "Product". |
| 68 | + |
| 69 | +- In the **Key Template** field, enter the key template for your entity. Use `{id}` to denote where in the key pattern the ID is located. |
| 70 | + |
| 71 | + For the example above, the key template would be `product:{id}`. |
| 72 | + |
| 73 | +- You can also enter a description to describe the entity. |
| 74 | + |
| 75 | +- Select the checkmark to confirm the entity. |
| 76 | + |
| 77 | +After you are done adding all of the entities, select **Fields** to continue. |
| 78 | + |
| 79 | +### Configure fields |
| 80 | + |
| 81 | +In the **Configure fields** step, you'll define the fields of each entity and the relationships between them. |
| 82 | + |
| 83 | +From here, you can either: |
| 84 | + |
| 85 | +- Select **Auto-detect fields** to scan your database automatically using a model that will detect the fields for you. |
| 86 | + |
| 87 | + You'll need to agree to let the model scan your key names and schemas to automatically populate the fields. |
| 88 | + |
| 89 | + {{< note >}} |
| 90 | +If you use Auto-detect fields, make sure that the fields and relationships that the model generates are accurate. |
| 91 | + {{< /note >}} |
| 92 | + |
| 93 | +- Select **Manually enter fields** to manually enter the fields yourself. |
| 94 | + |
| 95 | +{{<image filename="images/rc/context-retriever-fields.png" alt="The Configure fields step." >}} |
| 96 | + |
| 97 | +Expand each entry to view the currently defined fields for that entry. Select **Add field** to add a field. |
| 98 | + |
| 99 | +{{<image filename="images/rc/context-retriever-add-field.png" alt="The Add field table." >}} |
| 100 | + |
| 101 | +- Enter the field name in the **Field** cell. |
| 102 | +- Select the **PK** checkbox if the field is a primary key. You must have at least one primary key. |
| 103 | +- If the field is related to any other defined entities, select it from the **Related Entity** dropdown. This is usually set if the field contains primary keys of another entity. For example, you might have an |
| 104 | +- Select the field's **Type** from the dropdown. |
| 105 | +- In the **Index** cell, select one or more index types to enable searching and filtering on that field. |
| 106 | +- You can also add a description in the **Description** cell. |
| 107 | + |
| 108 | +After you set all fields for all of your entities, select **Create** to create your Context Retriever service. |
| 109 | + |
| 110 | +## Next steps |
| 111 | + |
| 112 | +After your service is created, you can call the MCP tools Context Retriever exposes from your agent. See the [Context Surfaces Python Client](https://pypi.org/project/context-surfaces/) for more information on how to call your tools. |
| 113 | + |
| 114 | +You can also [view your service]({{< relref "/operate/rc/context-engine/context-retriever/view-service" >}}). |
0 commit comments