Skip to main content

1. Choose simulation or a real backend

No-key simulation

From a fresh clone of the repository:
This uses local fixtures and requires no SDK, API key, model or running backend. It demonstrates the shape of a governed-context workflow. It does not verify ingestion, authentication, retrieval or model behavior. Keep simulation results separate from live evidence.

Real integration

Create a workspace and API key in the dashboard, then follow Integration setup. Use https://api.memoryo.dev for the hosted API or your own instance URL for self-hosting. For self-hosted exploration, follow the repository’s local beta instructions. That profile uses isolated Docker resources and exposes its API at http://127.0.0.1:18000. Dependency/image downloads need internet. Ingestion and some retrieval paths can use paid extraction/embedding providers; a chat-model stub alone does not make the backend free. Do not reuse another project’s database, queues or credentials. No agent registration, Memory Passport or Clerk account is required for the tenant API-key example below.

2. Install the SDK and configure your server

Set MEMORYOS_API_KEY, MEMORYOS_API_URL and MEMORYOS_TEST_OWNER in your server environment. Set MEMORYOS_API_URL=https://api.memoryo.dev for hosted use, or use your self-hosted API root without a trailing /v1; use the backend API address, not a dashboard or MCP gateway URL. Keep credentials out of browser code and source control.

3. Verify one save outside the chat loop

This section is a setup-verification script. wait_for_job(timeout=120) can block this script for up to two minutes; it is not a recommended wait inside each live chat response. The timeout is a client-side bound, not a processing-time guarantee. For interactive use, follow the chat lifecycle.
Use one fresh synthetic owner and keep its ID stable when reopening the application. The sample statement is evidence for extraction, not a forced storage result.
If polling times out, retain the job ID and inspect it later. Do not submit another save merely to make polling succeed. A new key is a new operation. For a network retry, reuse the same key and identical authorized request; see write replay.

4. Retrieve before answering

Use the same client/owner variables as above, in the same process or after reopening with the same environment.
A completed job can still be followed by processing visibility while publication catches up. Do not report successful recall until a subsequent authorized read actually returns the expected current record. These examples make no chat-model calls. For corrections, inspect source review or the explicit preference contract, rather than assuming a second sentence automatically replaces the first.

5. Connect the read to your chatbot

This compact Python adapter accepts your existing reply function; it does not choose a model or create another agent framework. owner must come from your server-side authenticated user mapping. Reuse the client configured above.
generate_reply(question, context) is your application’s existing model call. It must treat context as data and apply your answer policy. This adapter conservatively stops a memory-dependent answer without context; unrelated questions can use your own no-memory path. Retrieval errors should become a clear unavailable response, not reuse of old context. The OpenAI and Anthropic guides show provider calls. Chat lifecycle explains when to capture completed turns and how to handle an immediate follow-up while processing continues.