Prerequisites
- Python 3.8 or later.
- A Lyzr API key for the hosted version, or API keys for Gemini (embeddings) and OpenAI (fact extraction) for the open-source version.
1. Install
- Hosted (lyzr-adk)
- Open Source (lyzr-cognis)
2. Set API keys
- Hosted (lyzr-adk)
- Open Source (lyzr-cognis)
3. Add memories
Send conversation messages to Cognis. It extracts and stores discrete facts automatically.- Hosted (lyzr-adk)
- Open Source (lyzr-cognis)
4. Search memories
Retrieve the most relevant facts before your agent responds.- Hosted (lyzr-adk)
- Open Source (lyzr-cognis)
5. Get context for your LLM
Assemble both short-term conversation history and long-term memories into a single string for your system prompt.- Hosted (lyzr-adk)
- Open Source (lyzr-cognis)
What just happened
Cognis stored your raw messages, then the extraction layer pulled discrete facts and auto-categorized them (identity, preferences, interests, and more). Each fact was embedded and indexed for hybrid search using 70% vector similarity and 30% BM25 keyword matching. Thecontext / get_context call assembled both short-term messages and long-term memories into a ready-to-use LLM context string.
Next steps
- Memory types: understand session, long-term, and cross-session scoping.
- Add Memories reference: full parameter and response documentation.
- Search Memories reference: scoring, filtering, and limit options.