Spaces:
Running
Running
File size: 1,099 Bytes
b2d9e47 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | """Minimal agentmemory usage via iii-sdk.
Prerequisites:
pip install iii-sdk
npx -y @agentmemory/agentmemory # daemon at ws://localhost:49134
Run:
python examples/python/quickstart.py
"""
from iii import register_worker
def main() -> None:
iii = register_worker("ws://localhost:49134")
iii.connect()
iii.trigger(
{
"function_id": "mem::remember",
"payload": {
"project": "demo",
"title": "auth-stack",
"content": "Service uses HMAC bearer tokens; refresh every 24h.",
"concepts": ["auth", "hmac", "refresh"],
},
}
)
hits = iii.trigger(
{
"function_id": "mem::smart-search",
"payload": {
"project": "demo",
"query": "how do tokens refresh",
"limit": 5,
},
}
)
for memory in hits.get("results", []):
print(f"[{memory.get('score', 0):.3f}] {memory.get('title')}: {memory.get('content')}")
if __name__ == "__main__":
main()
|