Skip to main content
Cognis is Lyzr’s memory layer for AI agents. It lets agents remember things across conversations: user preferences, past decisions, resolved issues, and facts extracted from prior sessions. Without Cognis, every conversation starts blank. A user who told your agent they are vegetarian has to say so again next time. A support agent that resolved a billing issue has no memory of it when the same user returns. Cognis closes that gap.

How it works

  1. Your agent sends conversation messages (user and assistant turns) to Cognis.
  2. Cognis extracts discrete facts automatically using LLM-powered extraction with auto-categorization.
  3. Before responding, your agent searches Cognis. The most relevant facts are returned using hybrid search (vector similarity plus BM25 keyword matching, fused with Reciprocal Rank Fusion).
  4. Memories persist across sessions, scoped by owner_id, agent_id, and session_id.
🖼️ VISUAL, Diagram, high priority Show: the four-step flow: agent sends messages to Cognis, Cognis extracts facts, agent queries Cognis before responding, facts returned to agent context. Why it helps: the add/search loop is the core usage pattern and is easier to follow as a diagram than prose. Alt text: Diagram showing the Cognis memory loop: messages flow into Cognis for extraction, then the agent queries Cognis and receives relevant memories before generating a response.

Core capabilities

Cognis provides hybrid search using Matryoshka vector embeddings and BM25 keyword matching, fused with Reciprocal Rank Fusion for relevance ranking. The LLM extraction layer automatically pulls discrete facts from conversations and categorizes them by type (identity, preferences, work context, interests, and more). Memory records are scoped with owner_id, agent_id, and session_id identifiers so the right context reaches the right agent for the right user. The context assembly method combines short-term conversation history with long-term memories into a single LLM-ready string.

Quick example

from lyzr import Cognis, CognisMessage

cog = Cognis(api_key="sk-your-api-key")

cog.add(
    messages=[
        CognisMessage(role="user", content="My name is Alice. I'm vegetarian and love hiking."),
        CognisMessage(role="assistant", content="Nice to meet you, Alice!"),
    ],
    owner_id="user_alice",
)

results = cog.search(query="food preferences", owner_id="user_alice")
for r in results:
    print(r.content)
# "Alice is vegetarian"
Cognis is available as a hosted API via pip install lyzr-adk and as an open-source library via pip install lyzr-cognis. The core extraction and search architecture is the same in both.

Next steps

Quickstart

Install Cognis and run your first memory operations in 3 minutes.

Memory types

Understand session, long-term, and cross-session memory scoping.

Add Memories

Full method reference for storing conversations.

Search Memories

Retrieve relevant facts before your agent responds.