Create Lens

Create Lens in Redis Cloud, create the keys your agents and readers use, open Lens in the console, and delete it.

Lens records each turn your agent handles, so you can open it later and see what the agent recalled, what it sent to the model, and what came back. This guide walks you through creating Lens in the Redis Cloud console, connecting an agent, and opening its sessions.

Before you begin

Each Redis Cloud account has one Lens instance, which stores its data in two databases you choose:

Database Holds Requirements
Records database Turns, sessions, and their search indexes. A Redis Cloud Essentials or Pro database.
Content database Captured prompts, responses, and tool payloads. Any Redis Cloud database, including Redis Flex.

If you don't have a database, see Create a database.

If a database's Classless Inter-Domain Routing (CIDR) allow list blocks Lens, the Create Lens dialog lists the Internet Protocol (IP) addresses to add, and you can't create Lens until you add them. Add them under Security in the database's settings.

Create Lens

  1. From the Redis Cloud console, select Lens under Iris in the menu.

    If you haven't created Lens yet, you see an introduction to Lens.

  2. Select New lens.

    New lens is unavailable until your account has a database for each role in Before you begin. If you don't see it, you don't have permission to create Lens.

  3. In the Create Lens dialog, choose a Records database and a Content database. You can't change them after you create Lens.

  4. Select Create.

When Lens is ready, the Lens is ready dialog shows the Instance ID and the Endpoint, with the steps to connect your agent:

  1. Install the Redis Iris software development kit (SDK).
  2. Set IRIS_LENS_ENDPOINT to the endpoint, and IRIS_LENS_API_KEY to an agent's API key.
  3. Add Lens to your agent: call lens.init once, and wrap each turn in lens.turn.

Copy each step's code with Copy code. See Instrument an agent for what to record in a turn.

If one of the databases is unavailable, the dialog shows a warning in place of the endpoint and the connection steps.

Select Open Lens to go to Lens, or I'll do this later to close the dialog.

Create API keys

Agents send turns to Lens with an API key that has the ingest scope. Readers, such as the read application programming interface (API) client, need a key with the read scope. An agent that also reads turns needs a key with both, the full scope. Give each agent its own key. If one agent's key leaks, you can revoke or rotate that key without interrupting your other agents.

To create an agent's key:

  1. In the Lens is ready dialog, select Create API key. The console opens Create API key with ingest already selected for your Lens instance.
  2. Enter a Key name. Use letters, numbers, periods, underscores, or hyphens.
  3. Choose an Expiration. The default is 90 days.
  4. Select Create key.
  5. Copy the key from the API Key Generated dialog, and then select Close.

To create a read key:

  1. Select Access & Identity under Iris in the console menu.
  2. Select New API key.
  3. Enter a Key name and choose an Expiration.
  4. Under Access, expand Lens and select Lens instance. ingest is selected by default.
  5. Select read, and then clear ingest.
  6. Select Create key, and copy the key from the API Key Generated dialog.
Warning:

The console shows a key only once, in the API Key Generated dialog. Save it to a secure location before you select Close.

See Configure Lens for the environment variables each key goes in.

Open Lens

Select Lens under Iris in the Redis Cloud console menu. Then select an agent to see its sessions. Sessions appear as soon as the agent handles a turn.

See Inspect sessions to find a session and read each turn's steps.

Delete Lens

Deleting Lens removes the Lens instance and its Lens data from both databases. You can't undo it. Because you can't change the databases of an existing Lens, delete Lens and create it again to use different databases.

  1. In Lens, select Lens actions , and then select Delete lens instance.
  2. Select Yes, I want to delete this resource.
  3. Select Delete lens instance.

The console returns to the Lens introduction.

Next steps

RATE THIS PAGE
Back to top ↑