All skills
redis avatar

/iris-development

@d20b723 official
by redisredis/agent-skills163 stars
30

Iris is Redis's umbrella for AI-focused products. Use this skill when integrating with the Iris Redis Agent Memory (RAM) data plane on Redis Cloud — recording session events for an AI agent, creating or searching long-term memories, configuring a memory store, or tuning background memory promotion. Code examples use the official `redis-agent-memory` (Python) and `@redis-iris/agent-memory` (TypeScript) SDKs.

Use this Skill: https://skilld.dev/gh/redis/agent-skills/iris-development

This session only. Nothing lands on disk.

referencesltm-search.md

≈1.1k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Search Long-Term Memory Semantically with Filters

search_long_term_memory(...) (Python) / searchLongTermMemory(...) (TypeScript) runs a vector search over LTM records and applies structured filters in the same call. Combining both is the supported path — do not pull a wide vector result and filter on the client.

Correct: Pre-filter by the structured fields you already know, then rank by semantic similarity.

Python:

from redis_agent_memory import AgentMemory, models

def recall(
    agent_memory: AgentMemory,
    *,
    owner_id:  str,
    query:     str,
    namespace: str | None = None,
    k:         int        = 5,
):
    filt = {
        "owner_id":    {"eq": owner_id},
        "memory_type": {"in": ["semantic", "episodic"]},
    }
    if namespace is not None:
        filt["namespace"] = {"eq": namespace}

    res = agent_memory.search_long_term_memory(
        text=query,                              # embedded server-side
        similarity_threshold=0.7,                # normalized cosine, 0–1
        filter_op=models.FilterConjunction.ALL,  # AND across filter keys
        filter_=filt,                            # NB: trailing underscore — `filter` is reserved in Python
        limit=k,                                 # 1–100, default 10
    )
    return res.memories

TypeScript:

import { AgentMemory } from "@redis-iris/agent-memory";

async function recall(
  agentMemory: AgentMemory,
  args: { ownerId: string; query: string; namespace?: string; k?: number },
) {
  const res = await agentMemory.searchLongTermMemory({
    text:                args.query,
    similarityThreshold: 0.7,
    filterOp:            "all",                  // AND across filter keys
    filter: {
      ownerId:    { eq: args.ownerId },
      ...(args.namespace ? { namespace: { eq: args.namespace } } : {}),
      memoryType: { in: ["semantic", "episodic"] },
    },
    limit: args.k ?? 5,
  });
  return res.memories;
}

Incorrect: Querying with only text and filtering client-side.

# Bad: pulls up to 100 unrelated records per user, then re-filters in Python.
# Pays the vector-search cost on the full store, and capped at 100 results
# you may miss the one you needed.
hits = agent_memory.search_long_term_memory(text=query, limit=100).memories
for m in hits:
    if m.owner_id == owner_id and m.namespace == namespace:
        ...

Filter operators (per field):

Field Operators
session_id, owner_id, namespace eq, ne, in, all
topics, memory_type eq, ne, in, all (tag filter)
created_at gt, lt, gte, lte, eq (tz-aware datetime / Date)

filter_op / filterOp controls how the top-level filter fields combine: "all" (default, AND) or "any" (OR). Inside one field, eq / ne / in / all are mutually exclusive — set exactly one.

Similarity threshold: Normalized cosine similarity (0–1). Start at 0.7 and tune per workload — too high returns empty pages; too low returns noise.

Pagination: Pass next_page_token / nextPageToken back verbatim. Don't decode it; the server may change the encoding.

def iter_results(agent_memory, *, query: str, owner_id: str):
    token = None
    while True:
        page = agent_memory.search_long_term_memory(
            text=query,
            filter_={"owner_id": {"eq": owner_id}},
            limit=50,
            page_token=token,
        )
        yield from page.memories
        token = page.next_page_token
        if not token:
            return
async function* iterResults(
  agentMemory: AgentMemory,
  args: { query: string; ownerId: string },
) {
  let pageToken: string | undefined;
  while (true) {
    const page = await agentMemory.searchLongTermMemory({
      text: args.query,
      filter: { ownerId: { eq: args.ownerId } },
      limit: 50,
      pageToken,
    });
    yield* page.memories;
    if (!page.nextPageToken) return;
    pageToken = page.nextPageToken;
  }
}

No-query browsing: Omit text to apply only the structured filters (vector ranking is skipped, results are returned in record order).

Source: SKILL.md on GitHub

1 warning1mo3 checks · Risk SAFE
  • Gen Agent Trust Hub1mo

    The skill provides comprehensive documentation and code examples for integrating with Redis Agent Memory (RAM) using official Python and TypeScript SDKs. It follows security best practices for credential management and relies on official Redis infrastructure.

  • Socket1mo

    No alerts

  • Snyk1mo

    Risk: MEDIUM · 1 issue

Signed by skilld at d20b723. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 3 days ago.

Activeupdated 4 months ago
metadata
{
  "author": "redis",
  "version": "1.0.0"
}
  • Python
  • TypeScript
  • redis
  • agent-memory
  • session-memory
  • long-term-memory
  • semantic-search
  • redis-cloud

README badge

README badge for redis/agent-skills/iris-development

Manages session and long-term memory for AI agents on Redis Cloud using the official `redis-agent-memory` (Python) and `@redis-iris/agent-memory` (TypeScript) SDKs. Covers recording conversation events, searching semantically indexed memories, configuring memory stores, and tuning background memory promotion between session and persistent tiers.

Generated from the current SKILL.md.

Does this skill work with both Python and TypeScript?
Yes. The skill provides code examples for both the official `redis-agent-memory` (Python) SDK and `@redis-iris/agent-memory` (TypeScript) SDK.
What is Redis Agent Memory (RAM)?
It is a managed persistent memory service for AI agents on Redis Cloud with two tiers: session memory for conversation history and long-term memory for semantically searchable facts. A background promotion worker extracts durable facts from sessions automatically.
Do I need to set up a Redis Cloud service first?
Yes. You must create a Memory service on Redis Cloud and obtain an API key and store ID, which the SDK reads from `AGENT_MEMORY_API_KEY` and `AGENT_MEMORY_STORE_ID` environment variables.
Can I search memories semantically?
Yes. The skill covers semantic search of long-term memory with filtering using the `search_long_term_memory()` (Python) or `searchLongTermMemory()` (TypeScript) method.
What is the difference between session events and long-term memory?
Session memory is append-only conversation history per session. Long-term memory stores semantically searchable records extracted from sessions by the background promotion worker or created directly; use the skill's session-when-to-use rule to decide which to use.

Generated from the current SKILL.md. These answers refresh after source changes.