Skip to main content

Python SDK for Muninn - Agent memory system with 99.1% LOCOMO accuracy. Edge-native, persistent memory for AI agents.

Project description

Muninn SDK (Python)

Python SDK for Muninn — Agent memory system with 99.1% LOCOMO accuracy.

Installation

pip install muninn-sdk

Quick Start

from muninn import MuninnClient

client = MuninnClient(api_key="muninn_xxx")  # Get from https://muninn.au/dashboard

# Store a memory
client.store("James works at TechCorp as a Senior Engineer")

# Search memories
results = client.search("James workplace")
print(results)
# [{'id': '...', 'content': 'James works at TechCorp...', 'score': 0.95}]

API

store(content, memory_type='semantic', metadata=None, entities=None)

Store a memory in Muninn.

client.store(
    "Content to remember",
    memory_type="semantic",  # semantic, episodic, procedural
    metadata={"source": "conversation"}
)

search(query, limit=10, search_type='hybrid')

Search memories using hybrid search (keyword + semantic).

results = client.search("James workplace", limit=10, search_type="hybrid")

list(limit=50)

List all memories.

memories = client.list(limit=50)

delete(memory_id)

Delete a memory by ID.

client.delete("memory_id_here")

get_entity_facts(entity_name)

Get all facts about an entity.

facts = client.get_entity_facts("James")
# [{'predicate': 'works_at', 'object': 'TechCorp', 'confidence': 0.95}]

Integration Examples

LangChain

from muninn.langchain import MuninnMemory, MuninnEntityMemory
from langchain.agents import initialize_agent

memory = MuninnMemory(
    api_key="muninn_xxx",
    organization_id="my-agent"
)

agent = initialize_agent(
    tools=tools,
    llm=llm,
    memory=memory,
    agent="zero-shot-react-description"
)

LlamaIndex

from muninn.llamaindex import MuninnChatMemory, MuninnVectorMemory
from llama_index.core.agent import AgentRunner

memory = MuninnChatMemory(
    api_key="muninn_xxx",
    organization_id="my-agent"
)

agent = AgentRunner.from_llm(llm=llm, memory=memory)

Custom Agent

class MyAgent:
    def __init__(self, api_key: str):
        self.memory = MuninnClient(api_key)
    
    def chat(self, message: str) -> str:
        # Retrieve relevant context
        context = self.memory.search(message)
        
        # Generate response with context
        response = self.llm.generate(
            prompt=message,
            context=[m['content'] for m in context]
        )
        
        # Store the conversation
        self.memory.store(f"User: {message}\nAgent: {response}")
        
        return response

Links

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

muninn_sdk-2.0.0.tar.gz (14.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

muninn_sdk-2.0.0-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

Details for the file muninn_sdk-2.0.0.tar.gz.

File metadata

  • Download URL: muninn_sdk-2.0.0.tar.gz
  • Upload date:
  • Size: 14.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for muninn_sdk-2.0.0.tar.gz
Algorithm Hash digest
SHA256 a48c8f83d70f8fb50d2821e94ae0d28e2381895f8ffd4e63e83ecf49b397d3fc
MD5 e73d72c86d36aff4f79b312400ce777c
BLAKE2b-256 b8cee99a6f742fa319c75c51f77dd10b8a27e9c9a32a8f30f68c47a353966260

See more details on using hashes here.

File details

Details for the file muninn_sdk-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: muninn_sdk-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 14.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for muninn_sdk-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7743af8cf128e245c23f6f547eac3b6abc38d974ecd2db9b66465225ff50469b
MD5 d825cbaa96490ba95456d9bedbd737b4
BLAKE2b-256 50005c84efc410a06787c9983f3c0220499b0dae6b017561be389d262ac0596f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page