ATOM Documentation

← Back to App

GraphRAG

GraphRAG (Graph-based Retrieval Augmented Generation) combines knowledge graphs with intelligent search to provide context-aware information that enhances agent reasoning and decision-making.

Overview

GraphRAG improves agent intelligence by:

  • Knowledge Graphs: Understanding how information connects
  • Semantic Search: Finding information by meaning, not just keywords
  • Contextual Retrieval: Providing relevant background for decisions
  • Relationship Discovery: Uncovering hidden connections

Core Concepts

What is GraphRAG?

Think of GraphRAG as a smart research assistant that:

  1. Remembers Relationships: Knows how entities connect
  2. Finds Context: Provides relevant background information
  3. Discovers Patterns: Identifies trends across data
  4. Answers Questions: Responds to natural language queries

Knowledge Graphs

Information is stored as connected nodes:

Customer "Acme Corp" ──[placed_order]──> Order "Order-123"
                                           │
                                      [contains_product]
                                           │
                                           ▼
                                    Product "Widget-X"

Smart Search

Three search modes work together:

ModeHow It WorksBest For
KeywordExact word matchingFinding specific terms
SemanticMeaning-based searchConceptual queries
GraphFollows relationshipsMulti-hop connections

How GraphRAG Works

Information Storage

1. Extract Entities
   - Identify people, organizations, concepts
   - Extract properties and attributes

2. Find Relationships
   - Discover how entities connect
   - Classify relationship types

3. Create Embeddings
   - Convert text to mathematical vectors
   - Enable semantic search

4. Store in Knowledge Graph
   - Nodes: Entities with properties
   - Edges: Relationships between entities
   - Vectors: Semantic representations

Query Processing

User Question
    ↓
Understand Intent
    ↓
Search Strategy
    ├─ Keyword Search (exact matches)
    ├─ Semantic Search (similar meanings)
    └─ Graph Traversal (follow relationships)
    ↓
Combine Results
    ↓
Rank by Relevance
    ↓
Return Contextual Answer

Relationship Traversal

Follow connections to discover insights:

Question: "What products do enterprise customers buy?"

Traversal:
1. Find enterprise customers
2. Follow "placed_order" relationships
3. Follow "contains_product" relationships
4. Aggregate products
5. Rank by frequency

Answer: "Enterprise customers primarily buy:
- Product A (45% of orders)
- Product B (32% of orders)
- Product C (23% of orders)"

Query Types

Local Retrieval

Find directly relevant information:

  • Use Case: "Tell me about Acme Corp"
  • Returns: Acme Corp entity + directly related information
  • Speed: Fast, focused results

Global Retrieval

Traverse multiple relationship levels:

  • Use Case: "Show the complete order chain"
  • Returns: Customer → Orders → Products → Suppliers
  • Speed: Slower, but comprehensive

Hybrid Retrieval (Recommended)

Combines both approaches:

  • Use Case: Most queries
  • Returns: Direct matches + related context + patterns
  • Speed: Balanced, rich results

Automatic Learning

Entity Extraction

GraphRAG automatically learns from documents:

Document Uploaded
    ↓
AI Analyzes Content
    ↓
Extracts Entities
    - Names, dates, amounts
    - Organizations, locations
    - Concepts, topics
    ↓
Finds Relationships
    - "works for"
    - "located in"
    - "purchased from"
    ↓
Adds to Knowledge Graph

Continuous Improvement

The system gets smarter over time:

  • Learn from Queries: Understand what information is important
  • User Feedback: Improve result relevance
  • Pattern Recognition: Identify recurring relationships
  • Knowledge Expansion: Grow the graph organically

Usage Patterns

Customer 360 View

Query: "Tell me everything about Acme Corp"

GraphRAG Returns:
- Company profile
- Order history
- Support tickets
- Communications
- Related companies
- Market insights
- Recommendations

Benefits:
- Complete picture in one query
- Discover hidden connections
- Make informed decisions

Impact Analysis

Query: "What happens if we discontinue Product X?"

GraphRAG Traverses:
1. Find customers who bought Product X
2. Calculate revenue impact
3. Identify related products
4. Find alternative products
5. Assess customer satisfaction risk

Returns:
- Revenue at risk: $250K/year
- Affected customers: 15
- Recommended alternatives: Product Y, Product Z
- Retention strategy: Proactive outreach

Recommendation Engine

Query: "What should we recommend to Acme Corp?"

GraphRAG Analyzes:
1. Acme Corp's purchase history
2. Similar customers' purchases
3. Product relationships
4. Current trends
5. Seasonal patterns

Returns:
- Product recommendations with confidence scores
- Bundling opportunities
- Upsell suggestions
- Timing recommendations

Integration with Agent Intelligence

Enhanced Reasoning

GraphRAG provides context for agent decisions:

Agent wants to send promotional email
    ↓
GraphRAG checks:
    - Has customer been contacted recently?
    - What are their interests?
    - What have they purchased?
    - What are their preferences?
    ↓
Agent makes informed decision:
    - Personalize content
    - Choose right timing
    - Select relevant offers
    - Avoid over-messaging

Memory and Learning

GraphRAG integrates with agent memory:

Agent completes task
    ↓
GraphRAG records:
    - What entities were involved
    - What actions were taken
    - What was the outcome
    ↓
Future queries benefit:
    - Agent remembers context
    - Applies past learnings
    - Makes better decisions

API Overview

Query Operations

  • Natural language query
  • Keyword search
  • Semantic search
  • Graph traversal
  • Hybrid retrieval

Entity Operations

  • Extract entities from text
  • Create entities manually
  • Update entity properties
  • Delete entities

Relationship Operations

  • Create relationships
  • Find related entities
  • Traverse connections
  • Analyze relationship patterns

Analytics

  • Entity statistics
  • Relationship insights
  • Trend analysis
  • Pattern discovery

Best Practices

  1. Start with Hybrid: Use hybrid retrieval for most queries
  2. Provide Context: Include relevant details in queries
  3. Iterate: Refine queries based on results
  4. Explore Relationships: Follow connections to discover insights
  5. Give Feedback: Help the system learn what's relevant

Common Scenarios

Due Diligence

Query: "What should we know about Acme Corp before partnering?"

GraphRAG Returns:
- Company background
- Financial health
- Market position
- Related companies
- News and events
- Risk factors
- Partnership history

Decision: Make informed partnership decision

Root Cause Analysis

Query: "Why are customers churning?"

GraphRAG Analyzes:
- Churned customer profiles
- Common patterns
- Related events
- Support tickets
- Product usage
- Market changes

Returns:
- Top churn reasons
- At-risk customers
- Recommended actions
- Prevention strategies

Opportunity Discovery

Query: "Are there cross-sell opportunities?"

GraphRAG Finds:
- Products frequently bought together
- Customers missing related products
- Complementary product patterns
- Timing trends
- Customer segments

Returns:
- Cross-sell recommendations
- Target customer lists
- Expected revenue impact
- Implementation strategy

See Also