Integration
Long-term memory for Ax (@ax-llm/ax)
@ax-llm/ax is the typed TypeScript agent framework: `ax()` generators with strict input/output signatures and tool support, no state between invocations. `@lumetra/engram-ax` exposes Engram's REST API as ax-compatible `AxFunction` definitions. Add them to any generator's `functions` and the model can store and recall on its own.
Install
Three steps: sign up for an Engram API key, paste a BYOK LLM-provider key on /models, then drop the snippet below into Ax (@ax-llm/ax).
Three steps to memory in your agent
- Sign up. Free, no card. You'll land on a Getting Started page that walks the next two steps.
- Add your LLM key. Engram is BYOK. Paste an OpenAI / Anthropic / Groq / Together / Fireworks key and we'll route every extraction and query call through your provider. You pay your provider directly. We never see your inference.
- Paste the snippet below into your agent and restart it. Use
Authorization: Bearer <api-key>with the API key from your portal.
@lumetra/engram-ax: Ax (@ax-llm/ax) adapter
Exposes Engram as ax-compatible AxFunction definitions. Drop engramTools(client) into any ax() generator's functions. Source: github.com/lumetra-io/engram-ax · npm: @lumetra/engram-ax.
- Install:
- Export your API key:
- Wire Engram into an
ax()generator: - Default: only the non-destructive tools (store + query) are exposed. Opt in to more via
engramTools(engram, { include: ['list_memories', 'delete_memory', 'clear_bucket'] }).
npm install @lumetra/engram-ax @ax-llm/axexport ENGRAM_API_KEY="<api-key>"import { ax, ai } from "@ax-llm/ax";
import { EngramClient, engramTools } from "@lumetra/engram-ax";
const engram = new EngramClient({
apiKey: process.env.ENGRAM_API_KEY!,
defaultBucket: "my-app",
});
const llm = ai({ name: "openai", apiKey: process.env.OPENAI_API_KEY! });
const assistant = ax(
"userMessage:string -> reply:string",
{ functions: engramTools(engram) },
);
const { reply } = await assistant.forward(llm, {
userMessage: "Remember that I prefer dark mode, then tell me what you know about my preferences.",
});What you can do once memory's wired in
- Add `engramTools(engram)` to an `ax()` assistant generator. The two non-destructive tools (store and query) are exposed by default
- Opt in to the destructive tools (`list_memories`, `delete_memory`, `clear_bucket`) via the `include` array when you trust the agent
- Scope per bucket via `defaultBucket: 'user-42'` on the `EngramClient` constructor
- Use the same `EngramClient` directly (`engram.storeMemory(...)`) outside the ax loop; the same module exports both
FAQ
Why are the destructive tools (`delete_memory`, `clear_bucket`) off by default?
They're footguns when handed to an LLM, since a single bad call wipes a bucket. Opt in via the `include` array if you specifically want them, ideally with an `autoApprove` gate on your side.
Can I use a different default bucket per request?
Yes. Instantiate a new `EngramClient` per request with `defaultBucket: `user-${userId}``, or override on each tool call by passing `bucket` explicitly.
Self-hosted Engram?
Pass `baseUrl: 'https://engram.internal.example.com'` to the `EngramClient` constructor. Same six methods, your endpoint.
Related integrations
Ship durable memory in Ax (@ax-llm/ax) today
Free tier: 10K memories and 50K retrievals per month. No credit card. Same Engram backend powers all 41 integrations, so memories you write from one client are immediately queryable from the rest.