Tool handlers and lifecycle hooks now use the native async client API (aretain, arecall, areflect, acreate_bank) instead of sync wrappers that call loop.run_until_complete(), which deadlocks in async contexts like Discord/Telegram gateways.
54 lines
1.3 KiB
Python
54 lines
1.3 KiB
Python
"""Hindsight-Hermes: Persistent memory for Hermes agents.
|
|
|
|
Provides Hindsight retain/recall/reflect as native Hermes tools via the
|
|
plugin system or manual ``register_tools()`` call. When running on a
|
|
Hermes build that supports lifecycle hooks, the plugin also:
|
|
|
|
- **pre_llm_call** — recalls relevant memories and injects them into the
|
|
system prompt so the model has cross-session context on every turn.
|
|
- **post_llm_call** — retains the user/assistant exchange so it can be
|
|
recalled in future sessions.
|
|
|
|
Plugin usage (auto-discovery)::
|
|
|
|
pip install hindsight-hermes
|
|
export HINDSIGHT_API_URL=http://localhost:8888
|
|
export HINDSIGHT_BANK_ID=my-agent
|
|
|
|
Manual usage::
|
|
|
|
from hindsight_hermes import register_tools
|
|
|
|
register_tools(
|
|
bank_id="my-agent",
|
|
hindsight_api_url="http://localhost:8888",
|
|
)
|
|
"""
|
|
|
|
from .config import (
|
|
HindsightHermesConfig,
|
|
configure,
|
|
get_config,
|
|
reset_config,
|
|
)
|
|
from .errors import HindsightError
|
|
from .tools import (
|
|
get_tool_definitions,
|
|
memory_instructions,
|
|
register,
|
|
register_tools,
|
|
)
|
|
|
|
__version__ = "0.1.0"
|
|
|
|
__all__ = [
|
|
"configure",
|
|
"get_config",
|
|
"reset_config",
|
|
"HindsightHermesConfig",
|
|
"HindsightError",
|
|
"register_tools",
|
|
"register",
|
|
"memory_instructions",
|
|
"get_tool_definitions",
|
|
]
|