Knowledge Graph
β±οΈ Time to Complete: 20 minutes π― Level: Intermediate π» Language: TypeScript
What You'll Build
A knowledge graph that automatically extracts:
β Entities (people, organizations, places, events, products)
β Relationships between entities
β Queryable structure from unstructured content
β Multi-hop reasoning across sources
π Knowledge graph example app
Why Knowledge Graphs Matter
Traditional search: "Find documents mentioning Sarah" Knowledge graph: "Find all interactions between Sarah Chen at Acme Corp and our Sales team, including meetings, emails, and Slack conversations"
The difference:
β Entity recognition (Sarah Chen = person, Acme Corp = organization)
β Relationship tracking (Sarah works at Acme, spoke with Sales)
β Semantic understanding (group related mentions across sources)
β Structured queries on unstructured data
Real-world example: Zine uses knowledge graphs to answer "Who from Acme Corp have we talked to?" across Slack, email, meetings, and CRM notes.
Prerequisites
Complete the Quickstart tutorial
Graphlit project with API credentials configured in
.envnpm install graphlit-client dotenv
Step 1: Extract Entities from Content
Create a workflow, ingest content, and extract entities - all in one script:
What happens:
Creates extraction specification (GPT-5, temperature 0 for deterministic results)
Creates workflow with entity extraction
Ingests sample text with the workflow
Automatically extracts entities (people, organizations, places, etc.)
Lists all extracted entities
Run: npx tsx extract-entities.ts
Step 2: Explore Relationships in the Graph
Query content and visualize the entity relationships:
This renders the knowledge graph for a document. Each node represents a person, organization, or event; edges capture relationships Graphlit inferred (e.g., "Sarah Chen β worksFor β Acme Corp").
Step 3: Find Every Document Mentioning an Entity
Filtering by observations lets you answer questions like "Show me every asset where Sarah Chen appears" or "Find all notes referencing Salesforce".
Production Patterns
Batch Ingestion + Polling
Build Collections from Entities
Keep Graph Conversations Focused
Real-World Examples
1. Customer 360
Aggregate Slack, email, and meeting notes per account
Surface key contacts + topics before every call
Feed a sales agent that remembers context across teams
2. Incident Response Watchtower
Track mentions of outages across Sentry, Slack, and PagerDuty
Connect incidents to affected services and owners
Push summaries to on-call staff in real time
3. Market Intelligence Radar
Monitor competitor names across research docs and news
Attach relationships between mentions, products, and regions
Drive alerts when new entities (people or products) appear
Next Steps
Knowledge Graph Use Cases β Deep-dive patterns for extraction, enrichment, and queries
Context Engineering β Feed knowledge graph insights into retrieval
Full Example: Production Agent
See the complete Next.js agent in graphlit-samples:
Visual knowledge-graph explorer with streaming chat
Entity filtering and relationship queries in the UI
Production-ready environment configuration and error handling
Build agents that understand your data model. Build with Graphlit.
Last updated
Was this helpful?