Ingest Event

Content: Ingest Event

User Intent

"I want to ingest time-series events or episodic memories into Graphlit for temporal search and recall"

Operation

  • SDK Method: graphlit.ingestEvent()

  • GraphQL: ingestEvent mutation

  • Entity Type: Content (Event subtype)

  • Common Use Cases: User activity logs, calendar events, app events, journal entries, timeline data, audit logs

TypeScript (Canonical)

import { Graphlit } from 'graphlit-client';
import { ContentState, ObservableTypes } from 'graphlit-client/dist/generated/graphql-types';

const graphlit = new Graphlit();

// Ingest an event with timestamp
const response = await graphlit.ingestEvent(
  'User completed onboarding tutorial',    // markdown (event description)
  'Onboarding Completed',                  // name
  'New user finished the onboarding flow', // description (optional)
  new Date('2025-01-15T10:30:00Z')        // eventDate (when it occurred)
);

const eventId = response.ingestEvent.id;
console.log(`Event ingested: ${eventId}`);

// Retrieve the event
const content = await graphlit.getContent(eventId);
console.log(`Event text: ${content.content.markdown}`);
console.log(`Event date: ${content.content.eventDate}`);

Ingest event (snake_case method)

response = await graphlit.ingestEvent( markdown="User completed onboarding tutorial", name="Onboarding Completed", description="New user finished the onboarding flow", event_date=datetime(2025, 1, 15, 10, 30, 0) )

event_id = response.ingest_event.id if response.ingest_event else None

Parameters

Required

  • markdown (string): Event description/content

    • Should be descriptive and searchable

    • Can include markdown formatting

    • This becomes the event's main content

  • name (string): Display name for the event (optional but recommended)

Optional

  • description (string): Additional description of the event

    • Provides context beyond the markdown content

  • eventDate (Date/DateTime): When the event occurred

    • Critical: This is the temporal anchor for the event

    • Used for chronological ordering and time-based queries

    • Must be ISO 8601 format or Date object

    • If omitted, uses current time

  • id (string): Custom ID for the event

  • identifier (string): Custom identifier for deduplication

  • collections (EntityReferenceInput[]): Collections to organize events

  • correlationId (string): For tracking in production systems

Response

Developer Hints

Event vs Text vs Memory: Key Differences

Aspect
ingestEvent
ingestText
ingestMemory

Purpose

Time-series events

General content

Semantic memories

Timestamp

eventDate (specific time)

creationDate only

creationDate only

Use Case

Calendar events, logs

Documents, notes

AI agent memory

Query Pattern

Time-based filtering

Full-text search

Semantic search

Content Type

EVENT

TEXT

MEMORY

When to Use ingestEvent

Use ingestEvent when:

  • Events have a specific timestamp (when it happened matters)

  • Building a timeline or activity log

  • Tracking calendar events or milestones

  • Creating audit trails

  • Need temporal queries (e.g., "what happened last week?")

  • Event occurred at a specific point in time

Use ingestText when:

  • Content is timeless (e.g., documentation)

  • Timestamp is not meaningful

  • Just storing reference information

Use ingestMemory when:

  • Storing semantic memories for AI agents

  • Building conversational context

  • Don't need specific event timestamps

🕐 Understanding Timestamps

Important: Timestamps enable time-range queries when searching memories.

Variations

1. Ingesting User Activity Log

Track user actions for personalization:

2. Ingesting with Entity Extraction

Extract structured data from memory text:

3. Building Conversation History

Store conversation turns as memories:

4. Importing Historical Data

Bulk import past events:

Common Issues

Issue: Memories not appearing in chronological order Solution: Ensure timestamps are correctly set. Use orderBy: 'CREATION_DATE' when querying.

Issue: timestamp parameter not accepted Solution: Ensure you're using a Date object (JavaScript) or datetime (Python), not a string. Or use ISO 8601 string format.

Issue: Cannot filter memories by date range Solution: When querying, use dateRange filter with from and to timestamps.

Issue: Workflow not extracting entities from memories Solution: Ensure workflow extraction.jobs[].connector.type is set to EntityExtractionServiceTypes.ModelText for text-based memory extraction.

Production Example

Server-side memory ingestion:

Activity logging pattern:

Last updated

Was this helpful?