Hyperspell

Hyperspell is a memory management platform for AI applications, providing persistent memory and context management for LLM-powered products. Respan gives you full observability over how context is stored, retrieved, and used across conversations.

Create an account at platform.respan.ai and grab an API key.

Run npx @respan/cli setup to set up with your coding agent.

Hyperspell doesn’t expose a Python instrumentor. Wrap your memory operations in @task and @workflow decorators to trace them with Respan.

Setup

1

Install dependencies

$pip install respan-ai hyperspell
2

Set environment variables

$export HYPERSPELL_API_KEY="YOUR_HYPERSPELL_API_KEY"
$export RESPAN_API_KEY="YOUR_RESPAN_API_KEY"

HYPERSPELL_API_KEY is used for memory operations. RESPAN_API_KEY is used to export traces to Respan.

3

Initialize and run

1import os
2from hyperspell import Hyperspell
3from respan import Respan, workflow, task
4
5respan = Respan()
6client = Hyperspell(api_key=os.environ["HYPERSPELL_API_KEY"])
7
8@task(name="store_memory")
9def store_memory(user_id: str, content: str):
10 return client.memories.create(user_id=user_id, content=content)
11
12@task(name="retrieve_memory")
13def retrieve_memory(user_id: str, query: str):
14 return client.memories.search(user_id=user_id, query=query)
15
16@workflow(name="memory_workflow")
17def memory_workflow():
18 store_memory("user_123", "I prefer Python over JavaScript.")
19 return retrieve_memory("user_123", "programming language preference")
20
21print(memory_workflow())
22respan.flush()
4

View your trace

Open the Traces page to see your memory workflow with store, retrieve, and search spans.

Configuration

ParameterTypeDefaultDescription
api_keystr | NoneNoneFalls back to RESPAN_API_KEY env var.
base_urlstr | NoneNoneFalls back to RESPAN_BASE_URL env var.
customer_identifierstr | NoneNoneDefault customer identifier for all spans.
metadatadict | NoneNoneDefault metadata attached to all spans.
environmentstr | NoneNoneEnvironment tag (e.g. "production").

Attributes

With propagate_attributes

1from respan import Respan, propagate_attributes
2
3respan = Respan()
4
5def handle_request(user_id: str, query: str):
6 with propagate_attributes(
7 customer_identifier=user_id,
8 thread_identifier="conv_abc_123",
9 metadata={"plan": "pro"},
10 ):
11 return retrieve_memory(user_id, query)
AttributeTypeDescription
customer_identifierstrIdentifies the end user in Respan analytics.
thread_identifierstrGroups related messages into a conversation.
metadatadictCustom key-value pairs. Merged with default metadata.