Skip to main content

Client

The main client class.
from hx import Client

client = Client()
Reads HX_API_KEY from environment. Org, workspace, and environment are extracted from the token.

Properties

PropertyTypeDescription
org_idstrOrganization ID from token
workspace_idstrWorkspace ID from token
environment_idstrEnvironment ID from token

Knowledge

Access via client.knowledge. Search a knowledge store.
results = client.knowledge.search(
    store_id: str,           # Knowledge store ID
    query: str,              # Search query (1-10000 chars)
    *,
    top_k: int = 10,         # Results to return (1-100)
    score_threshold: float = None,  # Min score (0.0-1.0)
    metadata_filter: dict = None    # Filter by metadata
)

Memory

Access via client.memory.

add()

Add memories from messages.
client.memory.add(
    store_id: str,           # Memory store ID
    messages: list,          # List of {role, content} dicts
    *,
    user_id: str = None,     # User identifier
    agent_id: str = None,    # Agent identifier
    run_id: str = None,      # Run/session identifier
    metadata: dict = None    # Additional metadata
)

search()

Search memories.
results = client.memory.search(
    store_id: str,
    query: str,
    *,
    user_id: str = None,
    agent_id: str = None,
    run_id: str = None,
    filters: dict = None,
    top_k: int = 10
)

list()

List all memories.
memories = client.memory.list(
    store_id: str,
    *,
    user_id: str = None,
    agent_id: str = None,
    run_id: str = None
)

get()

Get a specific memory.
memory = client.memory.get(
    store_id: str,
    memory_id: str
)

update()

Update a memory.
memory = client.memory.update(
    store_id: str,
    memory_id: str,
    data: str,               # New memory content
    *,
    metadata: dict = None
)

delete()

Delete a memory.
result = client.memory.delete(
    store_id: str,
    memory_id: str
)

delete_all()

Delete all memories matching filters.
result = client.memory.delete_all(
    store_id: str,
    *,
    user_id: str = None,
    agent_id: str = None,
    run_id: str = None
)

history()

Get memory change history.
history = client.memory.history(
    store_id: str,
    memory_id: str
)

reset()

Reset all memories in a store.
result = client.memory.reset(store_id: str)
reset() permanently deletes ALL memories in the store.