MemoGrafterAgent
MemoGrafterAgent.create()
Resolve configuration, construct a MemoGrafterAgent, initialize its storage, and return the ready-to-use agent.
What it does
Resolve configuration, construct a MemoGrafterAgent, initialize its storage, and return the ready-to-use agent.
When to use it
Use this factory when configuration lives in an explicitly imported
mg.config file or factory.Use the constructor plus
initialize() when your application already has a fully resolved MemoGrafterConfig and wants to control initialization separately.Signature
TypeScript
MemoGrafterAgent.create(config: MemoGrafterConfigSource, overrides?: MemoGrafterConfigOverrides): Promise<MemoGrafterAgent>Parameters
config (MemoGrafterConfigSource) — Provider, storage, and memory behavior used by the new instance.overrides? (MemoGrafterConfigOverrides) — Runtime values merged into the imported project configuration before validation.Behavior
Evaluates the supplied object or configuration factory.
Merges runtime overrides and validates the database, LLM, and embedder requirements.
Constructs
MemoGrafterAgent, calls initialize(), and resolves only when the agent is ready.Errors and empty results
Rejects when the config factory throws, required runtime dependencies are missing, or storage initialization fails.
Example
example.ts
import config from "./memo-grafter/mg.config.js";
const agent = await MemoGrafterAgent.create(config, {
inject: { recallLimit: 10 },
});More examples
Equivalent constructor flow
const resolved = await resolveMemoGrafterConfig(config, overrides);
const agent = new MemoGrafterAgent(resolved);
await agent.initialize();Important behavior
Automatic config discovery is not performed.
Nested settings are merged field by field; adapter overrides replace configured adapters.
queue: false and cache: false disable those services.