hindsight-api-slim 0.10.0
Legitimate memory API package
Applies wraps to nested Python functionAstrBot untrusted chunk marker
SHA-2566f7a11fb43735bcc8164d3bee84622690bfa081ca02aaa88e3b88ef72ef3eca3
Evidence
1"""
2Memory System for AI Agents.
3
4Temporal + Semantic Memory Architecture using PostgreSQL with pgvector.
5
6**Importing this package is cheap.** The public names below resolve on first ACCESS, via the
7module ``__getattr__`` of PEP 562, rather than being pulled in at import time. That is a load-time
8property other things depend on, not a preference:
9
10``hindsight-api --workers N`` was killing and respawning its workers forever. uvicorn's
11multiprocess supervisor uses **spawn**, so every child rebuilds ``__main__`` by re-running
12``sys.argv[0]`` — pip's console-script wrapper — whose top line is
13``from hindsight_api.main import main``. That import reached this module, and this module used to
14pul …
38:11… t_api/_thread_limits.py for the rationale.
39from ._thread_limits import apply_default_thread_limits
40
41apply_default_thread_limits()
42
43__version__ = "0.10.0"
44
45# name -> (module, attribute). Kept as data so `__all__`, `__dir__` and the resolver cannot drift.
46_LA …
76:36… le {__name__!r} has no attribute {name!r}") from None
77
78 from importlib import import_module
79
80 value = getattr(import_module(module_name, __name__), attribute)
81 # Bind it so every later access is a plain global lookup rather than anoth …
1"""Concurrency primitives that several event loops in one process can share.
2
3``asyncio.Lock``/``Semaphore`` bind to the event loop that first *waits* on them.
4That is fine for state one loop owns, and wrong for anything process-wide: the first
5contended acquire claims the primitive for its loop, …
24:52… `` between the handoff and the
25waiter resuming. These caps gate LLM calls and llama.cpp server startup — operations
26measured in hundreds of milliseconds to minutes — so that is not measurable. Do not
27reach for this to guard something short and hot; scope the state per loop instead.
28
29**The cost of handing over …
Showing the top 5 files — 7 more files (122 regions) not shown.