Use TIE’s memory as a standalone service from any backend — even if your users never sign in to TIE and your app runs its own LLM. Two endpoints cover the whole loop: write facts into a user’s knowledge graph, and retrieve a prompt-ready context block with the same recall quality as TIE’s own chat agents.
Before You Start
| What | Where to get it |
|---|---|
| AUTH_SECRET | Issued by the TIE team — see Service accounts. |
| Stable user IDs | Any string identifier from your own system (database ID, CRM ID). TIE derives a deterministic user UUID from it — no TIE sign-up needed. |
Send your user’s ID in the X-External-User-Id header on every call. The value is case-sensitive and must stay stable — see the header rules.
Step 1 — Write memories
Push facts into the user’s knowledge graph whenever something worth remembering happens in your app — a profile update, an onboarding answer, a meaningful conversation turn.
curl -X POST https://your-tie-host/memories/graph \
-H "Authorization: Bearer $AUTH_SECRET" \
-H "X-External-User-Id: crm-user-8841" \
-H "Content-Type: application/json" \
-d '{
"data": "User runs a bakery in Penang and wants to automate invoicing.",
"type": "text",
"agent_id": "chatbot",
"source_description": "CRM profile sync"
}'Returns 202 immediately; entity extraction runs in the background. Pass "wait": true to block until ingestion completes (useful in tests). Extraction quality depends on how you phrase the data — write declarative statements, not questions. See Formatting Data for Extraction.
Step 2 — Retrieve context for your LLM
Before each of your own LLM calls, fetch the user’s memory context:
curl -X POST https://your-tie-host/memories/retrieve \
-H "Authorization: Bearer $AUTH_SECRET" \
-H "X-External-User-Id: crm-user-8841" \
-H "Content-Type: application/json" \
-d '{
"query": "how can I save time on paperwork?",
"agent_id": "chatbot",
"display_name": "Aisha"
}'This runs the exact pipeline TIE uses for automatic memory injection in its own chat endpoint — a cached session-context block plus a per-message graph search. The response includes two rendered prompt strings; append them to your system prompt as-is:
context = response["context"]["prompt"] # "## Known Entities ... ## Known Facts ..."
retrieval = response["retrieval"]["prompt"] # "## Relevant memories for this message ..."
system_prompt = f"{your_instructions}\n\n{context}\n\n{retrieval}"Full request/response reference: Retrieve Memory Context. If you only want raw ranked facts to format yourself, use Search Memory instead.
Optional — warm the cache on app open
The context block is cached for 5 minutes per user. To make the first retrieve of a session fast, warm the cache when the user opens your app. Note the warm endpoint takes the derived UUID in its path, not your external ID — in practice it’s simpler to let the first retrieve call warm the cache itself.
Good to know
- One ID, one graph — everywhere. The same external ID always maps to the same user, across all apps sharing the TIE instance. Namespace app-local IDs (
myapp:42) if they aren’t globally meaningful. - Case-sensitivity.
Aliceandaliceare different users. Canonicalize before sending. - Writes are eventually consistent. A
202means accepted, not ingested — allow a few seconds before expecting new facts in retrieval, or use"wait": true.