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-bulk-create.md

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

Create Long-Term Memories in Bulk with Idempotent IDs

bulk_create_long_term_memories (Python) / bulkCreateLongTermMemories (TypeScript) accepts up to 100 records per call. The client supplies the id for each record so a retry never creates a duplicate. The response splits into created (IDs that landed) and errors (per-ID failures).

Correct: Generate a deterministic ID per logical fact and batch up to 100.

Python:

import uuid
from redis_agent_memory import AgentMemory, models

def upsert_facts(agent_memory: AgentMemory, facts: list[dict]):
    # Cap at 100 per call — the API enforces this.
    res = agent_memory.bulk_create_long_term_memories(memories=[
        {
            "id":          fact["id"],                           # stable, deterministic
            "text":        fact["text"],                         # 1–50000 chars
            "memory_type": fact.get("memory_type", models.MemoryType.SEMANTIC),
            "session_id":  fact.get("session_id"),
            "owner_id":    fact.get("owner_id"),
            "namespace":   fact.get("namespace"),
            "topics":      fact.get("topics", []),
        }
        for fact in facts[:100]
    ])
    # res.created = [...ids...], res.errors = [BulkOperationError(...)]
    return res

# Deterministic IDs make retries safe: same fact → same id → no duplicate.
facts = [{
    "id":         f"user-42-pref-{uuid.uuid5(uuid.NAMESPACE_OID, 'theme:dark')}",
    "text":       "User 42 prefers dark mode.",
    "owner_id":   "user-42",
    "topics":     ["profile", "ui-preferences"],
}]
upsert_facts(agent_memory, facts)

TypeScript:

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

async function upsertFacts(
  agentMemory: AgentMemory,
  facts: Array<{
    id: string; text: string;
    memoryType?: "semantic" | "episodic" | "message";
    sessionId?: string; ownerId?: string; namespace?: string;
    topics?: string[];
  }>,
) {
  const res = await agentMemory.bulkCreateLongTermMemories({
    memories: facts.slice(0, 100).map((f) => ({
      id:         f.id,
      text:       f.text,
      memoryType: f.memoryType ?? "semantic",
      sessionId:  f.sessionId,
      ownerId:    f.ownerId,
      namespace:  f.namespace,
      topics:     f.topics ?? [],
    })),
  });
  // res.created: string[], res.errors?: Array<{id: string; error: string}>
  return res;
}

Incorrect: One call per memory, or random IDs on every retry.

# Bad: N round-trips + N embedding calls — slow and hammers your rate limit.
for fact in facts:
    agent_memory.bulk_create_long_term_memories(memories=[{
        "id":   str(uuid.uuid4()),            # <-- new id on every retry → duplicates on transient failures
        "text": fact["text"],
    }])

Partial-success contract — always inspect errors:

res = upsert_facts(agent_memory, facts)
if res.errors:
    for err in res.errors:
        log.warning("LTM create failed", id=err.id, reason=err.error)
    # res.created IS persisted; do not retry those.
    failed_ids = {e.id for e in res.errors}
    retry_later([f for f in facts if f["id"] in failed_ids])
const res = await upsertFacts(agentMemory, facts);
if (res.errors?.length) {
  for (const err of res.errors) {
    console.warn("LTM create failed", err.id, err.error);
  }
  const failedIds = new Set(res.errors.map((e) => e.id));
  await retryLater(facts.filter((f) => failedIds.has(f.id)));
}

Constraints:

  • memories: 1–100 items per call.
  • id: 1–64 chars, [a-zA-Z0-9-].
  • text: 1–50000 chars.
  • memory_type / memoryType: semantic | episodic | message.
  • topics: up to 50, each 1–100 chars.
  • TTL: defaults to 1 year (31_536_000 seconds) unless the store's long-term-memory TTL overrides it.

To update a record's text or tags later, use update_long_term_memory(memory_id=...) / updateLongTermMemory(memoryId, ...) rather than re-creating with the same ID.

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.