Organize and manage memory clusters in Nebula for better organization and access control.Clusters in Nebula are organizational units for your memories. Think of them like projects or workspaces — a way to keep related sets of data grouped together. A cluster doesn’t imply that the memories inside are similar or connected; it’s simply a container you define.For example, you might keep separate clusters for Research, Work Notes, and Personal Ideas. These clusters don’t interact unless you explicitly search or manage across them.
Clusters here are not the same as graph clustering algorithms or automatic similarity-based grouping (We still run them under the hood). They’re a manual, developer-controlled way to structure memory.
from nebula_client import NebulaClientclient = NebulaClient(api_key="your-api-key")# Assuming you have created work_cluster and personal_clusterwork_cluster = client.create_cluster("Work", "Work-related memories")personal_cluster = client.create_cluster("Personal", "Personal memories")# Search only in work clusterwork_results = client.search( query="project deadlines", cluster_ids=[work_cluster.id], # Only search work memories limit=10)print(f"Found {len(work_results)} work-related results:")for result in work_results: print(f"- {result.content[:50]}...")# Search only in personal clusterpersonal_results = client.search( query="recipe", cluster_ids=[personal_cluster.id], # Only search personal memories limit=5)print(f"Found {len(personal_results)} personal results:")for result in personal_results: print(f"- {result.content[:50]}...")# Search across multiple specific clustersall_results = client.search( query="important notes", cluster_ids=[work_cluster.id, personal_cluster.id], # Search both clusters limit=15)