Skip to main content

Why a second memory

OpenAI’s Agents API (public beta, September 2026) runs agents on the Codex harness with durable sessions, auto-compaction and a sandbox memory. That memory is per workspace: summaries and notes in the sandbox, a small memory_summary.md injected at run start, keyword search on demand, and consolidation that keeps the newest notes and drops older ones. A product with returning users needs memory per user — what this customer prefers, what was decided with them, what broke last time — that survives longer than the newest notes, and that is the same memory whether the agent runs on OpenAI, on Claude, or in your own code. Mengram is that memory, attached as an MCP server.

One connection per end user

Every remember, recall and context_for on that connection belongs to cust_1042, isolated from every other user of your product. The model never has to pass a user_id itself. There is no cap on the number of end users on any plan. X-Mengram-User accepts letters, digits and . _ : @ + -, up to 200 characters; anything else falls back to default. When headers are not configurable, send ?user_id=cust_1042 on the URL instead.

Hosted MCP tool

If OpenAI manages the connection (Responses API / Agents API JSON):

Keep the context small

context_for takes max_tokens (default 1200). Memory is cut in rank order to fit and the pack ends with one line saying what was left out — see max_tokens. A support bot that used to replay 4,500 tokens of history per request sends the 600 that matter.

Full example

examples/openai-agents-api — a support agent for a car-rental company, one command to run.