Ingesting Data (Basics)

The ingest() method is the lifeblood of Libro. It tells the engine to memorize a piece of information for a specific user.

Basic Payload

The minimum required fields are userId and content.

await ctx.ingest({
  userId: "user_456",
  content: "User mentioned they are allergic to peanuts."
});

When to Ingest?

We recommend ingesting data asynchronously in the background after a user action, rather than blocking the main thread. For example, if you are building an AI chatbot, use waitUntil() in Next.js or edge workers to ingest the conversation summary without slowing down the user's response time.