Guide
How to give each user a private memory
Every person who uses your app should see only their own memory. Without per-user scoping, one person's facts can reach another person's AI. This guide shows how your server gives each user a separate memory with Harny.
The problem
Your app's AI needs to remember things about each person. If all of those facts sit in one shared store, a question from one person can surface another person's details. You need a separate memory for each person who uses the app.
End users do not need a Harny account. You keep one user id per person and tell Harny which person each request is for.
How it works in Harny
Your app calls the Memory API with its app key. Each request names the person with an X-Harny-User header. Harny keeps each person's memory separate, and every request is checked against the key.
Call the Memory API from your server, never from a browser. Your server sets the X-Harny-User header, not the model. Team-shared facts go under a user of their own, such as your id for the team.
Step by step
- Give each person one stable user id in your own system, such as demo-user.
- Store your app key on the server, in a file the browser never reads. The app key starts with fsa_.
- When a person sends a message, have your server write the new fact to that person's memory:
POST /v1/memory/ingest. - Check that the write finished before you rely on it:
GET /v1/memory/ingest/{ingestionId}. - Before the AI answers, recall only from that person's memory:
POST /v1/memory/recall. - Put facts that the whole team may read under a user for the team, not into a person's memory.
- When a person asks to be erased, delete their data:
DELETE /v1/users/{user_id}/data.
What can go wrong
- A browser holds the app key, so anyone who gets the key can call the API. Keep all calls on the server.
- The model sets the user id, so a request can name the wrong person. Set
X-Harny-Userin your server code only. - Team facts written to one person's memory belong to that person's memory. Use a user for the team for shared facts.
Example: Nadia at Acme
Nadia at Acme joins the Acme pilot on March 14. Your server sends her facts with her user id, demo-user. Her budget starts at 32k, then changes to 40k. Her AI reads her own memory, which is separate from every other person's memory.
Above 500 monthly-active end users, the price is $0.30 per person per month, flat.
Frequently asked questions
Can an end user see another user's memory?
Each person's memory is separate, and every request is checked against the key. Your server names the person on each request.
Do my users need a Harny account?
No. End users need no Harny account. Your server makes the calls for them.
Where does the user id come from?
Your app sets it. Use one user id per person, and set the X-Harny-User header on your server.
Go on. Get Harny.
The first 500 monthly-active end users are free for good. Create an app key and make your first call in minutes.