r/aiagents • u/Murky_Key2306 • 2d ago
Tested an async agent memory API in a quick script before wiring it into a workshop tool
Before adding persistent memory to a furniture workshop's reporting tool, I wrote a throwaway script to test the API by itself. Debugging memory calls and report generation together sounded miserable, so I used one sample requirement from the shop notes: all dimensions in future reports had to be in millimeters.
The MemoraX API docs showed that async Add returns HTTP 202 and a task_id while extraction runs in the background. Out of habit from synchronous databases, I nearly called Search right after Add. I caught the 202 and put a short poll on the task endpoint instead, waiting for the top-level status to reach success (and exiting early on failed or a timeout).
For the test run, I sent the workshop note to Add with a dedicated test user_id and content_type: "work". Once the task returned success, I ran Search with the same project and user_id, asking "Which unit did the workshop specify for dimensions?" and printed the result right beneath the original note. Seeing the millimeter requirement come back clearly in stdout was what I needed to start wiring it into the app.
If you use async memory endpoints in an agent loop, how do you handle a write when the next user turn might need it right away?
1
u/Orechova-Vinal 13h ago
Polling inside a live user turn is gonna kill your latency. A common pattern is keeping an optimistic local cache of unindexed facts from the current session and merging those into the prompt alongside whatever comes back from the search endpoint