MemoGrafterAgent
invoke()
Recall memory, call the configured LLM, update history, and ingest the exchange.
What it does
Recall memory, call the configured LLM, update history, and ingest the exchange.
When to use it
Use for the complete conversational path when MemoGrafter should own recall, prompt injection, the model call, chat history, and ingestion.
Signature
TypeScript
invoke(userMessage: string): Promise<string>Parameters
userMessage: the new user turn.Result
A promise containing the assistant response.
Behavior
Recalls relevant active facts, adds memory context to the configured system prompt, calls the LLM adapter, appends both turns to in-memory history, then ingests the completed exchange.
Queue mode returns the assistant answer after ingestion is submitted, not after graph extraction finishes.
Side effects and completion
Adds the user and assistant messages to local history and creates or queues persistent graph memory.
Errors and empty results
Rejects provider authentication, rate-limit, transport, storage, or queue-submission failures. A rejected call does not return a partial assistant string.
Example
example.ts
const answer = await agent.invoke("What city did I move to?");More examples
Use the response and inspect history
const answer = await agent.invoke("What city did I move to?");
console.log(answer);
console.log(agent.getHistory().at(-1));