Overview
Agno is a lightweight framework for building AI agents with tools and structured outputs. By wrapping Lyzr Cognis methods as Agno tools, you can build agents that autonomously decide when to store, retrieve, and manage their own memories. What you’ll build: A personal assistant that uses Cognis-backed tools to remember user preferences, search past conversations, and manage its own memory — all driven by the agent’s own reasoning. Why Cognis + Agno? Agno’s@tool decorator makes it trivial to expose Cognis operations as agent capabilities. Unlike injection-based patterns, the agent itself decides when and what to remember — enabling more natural, autonomous memory management.
Prerequisites
Quick Start
Complete Example: Personal Assistant
Step 1: Initialize Cognis and Define Tools
Step 2: Create the Agent
Step 3: Run Multi-Turn Conversations
- Turn 1: Call
add_memoryto store Sarah’s name, job, and preferences - Turn 2: Call
search_memoryfor food preferences, then recommend Italian restaurants - Turn 3: Call
add_memoryto store the Colorado trip plan - Turn 4: Call
get_all_memoriesto show everything it remembers - Turn 5: Call
add_memorywith the updated food preference
Cognis Methods Reference
| Method | Description | When to Use |
|---|---|---|
cog.add(messages, owner_id, session_id, agent_id) | Store conversation messages | When the agent decides to remember |
cog.search(query, owner_id, limit) | Semantic search over memories | When the agent needs context |
cog.get(owner_id, limit) | List all memories for a user | When user asks “what do you know?” |
cog.delete(memory_id, owner_id) | Remove a specific memory | When user asks to forget |
cog.update(memory_id, content) | Update a memory’s content | When correcting information |
cog.context(current_messages, owner_id, session_id) | Server-assembled context | Alternative to manual search |
Advanced Patterns
Context-Aware Tool with Session Tracking
Pass session information through tool parameters for better memory organization:Cross-Session Search
Search across all sessions for comprehensive recall:Summary-Based Memory
Use Cognis summaries for high-level recall:Next Steps
- Cognis + LangChain — LCEL chain integration with memory
- Cognis + LangGraph — Memory as graph nodes
- Cognis + CrewAI — Memory for multi-agent crews
- Lyzr ADK Memory Documentation — Full Cognis API reference