Hands on lab for Neo4j and Amazon Bedrock
Hands-On Lab: Neo4j and Amazon Bedrock
Build Generative AI and GraphRAG Agents with Neo4j and AWS.
Neo4j is the leading graph database vendor. We've worked closely with AWS engineering for years. Our products, AuraDB and AuraDS, are offered as managed services available on AWS through the AWS Marketplace.
Overview
In this hands-on lab, you'll learn about Neo4j, Amazon Bedrock, and the Model Context Protocol (MCP). The lab is designed for data scientists, data engineers, and AI developers who want to master GraphRAG (Graph Retrieval-Augmented Generation) techniques and build production-ready agentic AI applications.
In today's landscape, organizations need AI systems that can extract deep insights from unstructured documents, understand complex entity relationships, and build intelligent systems that can autonomously reason over vast information networks. This hands-on lab addresses this need directly by providing mastery in the most powerful pattern available for complex document intelligence: Graph Retrieval-Augmented Generation (GraphRAG).
You'll work with a real-world dataset of SEC 10-K company filings to learn fundamental GraphRAG patterns. We'll start with a pre-built knowledge graph containing extracted entities from unstructured text. Then you'll implement multiple retrieval strategies: vector similarity search for semantic retrieval, graph-enhanced retrievers that leverage entity relationships, and natural language to Cypher query generation. Finally, you'll build intelligent agents using LangGraph and Strands that can autonomously reason over your knowledge graph to answer complex questions.
By the end of this lab, you'll have hands-on experience with:
- Exploring knowledge graphs built from unstructured documents
- Implementing semantic search with vector embeddings
- Creating graph-enhanced retrieval patterns for richer context
- Building no-code AI agents with Neo4j Aura Agents
- Developing agentic AI systems using the Model Context Protocol
- Calling Aura Agents programmatically via REST API
- Deploying GraphRAG applications on AWS infrastructure
Starting the Lab
To get started, follow the labs in the agenda below in order.
Quick Start Options:
- No-Code Track Only: Complete Part 1 (Labs 0-2) to explore Neo4j and AI agents without coding
- Intro to Agents and GraphRAG: Complete Parts 1 and 2 (Labs 0-5) to learn GraphRAG fundamentals
- Full Workshop: Complete all three parts for the complete GraphRAG development experience
Prerequisites
You'll need a laptop with a web browser. Your browser will need to be able to access the AWS Console and the Neo4j Aura Console. If your laptop has a firewall you can't control, you may want to bring your personal laptop.
Agenda
Part 1 - No-Code Getting Started
This section requires no coding. You'll use visual tools and pre-built interfaces to explore Neo4j and AI agents.
- Introductions
- Lecture - Introduction to Neo4j
- Break
Part 2 - Introduction to Agents and GraphRAG with Neo4j
This section introduces you to building AI agents with Python and the fundamentals of GraphRAG (Graph Retrieval-Augmented Generation) using the official neo4j-graphrag library.
What You'll Learn:
- How AI agents use tools to interact with external systems
- The neo4j-graphrag library architecture and components
- Multiple retrieval strategies (Vector, VectorCypher, Hybrid, Text2Cypher)
- Building complete RAG pipelines with the GraphRAG class
- LangGraph: Framework for building stateful, multi-step AI agents
- neo4j-graphrag: Neo4j's official Python library for GraphRAG applications
- VectorRetriever: Semantic similarity search using embeddings
- VectorCypherRetriever: Vector search enhanced with graph traversal
- GraphRAG: Orchestration class combining retrieval with LLM generation
- Lecture - Neo4j and Generative AI
Important Note: The pre-built knowledge graph uses OpenAI embeddings (1536 dimensions), which are not compatible with Amazon Titan embeddings (1024 dimensions). AWS Bedrock embedding models do not provide an OpenAI-compatible API. Therefore, in Lab 5 we reset the database and rebuild the vector index using Amazon Titan embeddings. This demonstrates a real-world scenario where you need to match embedding dimensions between your index and query embeddings.
* Load data and create embeddings with Amazon Titan * Build vector indexes in Neo4j * Implement VectorRetriever for semantic search * Use VectorCypherRetriever for graph-enhanced context * Build complete GraphRAG pipelinesPart 3 - Advanced Agents and API Integration
This section covers advanced topics including programmatic access to Aura Agents and building AI agents that query Neo4j using the Model Context Protocol (MCP).
What You'll Learn:
- Calling Aura Agents via REST API for application integration
- The Model Context Protocol (MCP) standard for tool integration
- Building LangGraph agents that can query knowledge graphs
- Using the Neo4j MCP Server via AgentCore Gateway
- Neo4j Aura Agents API: REST API for invoking your no-code agents programmatically
- Model Context Protocol (MCP): Open standard for connecting AI models to data sources
- Neo4j MCP Server: Official Neo4j tool server exposing Cypher query capabilities
- AgentCore Gateway: AWS service for hosting and managing MCP servers
- Questions and Next Steps
Architecture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ YOUR AGENTS โ
โโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Part 1 (No-Code) โ Part 2 (GraphRAG) โ Part 3 (Advanced) โ
โ โโโโโโโโโโโโโโโโโ โ โโโโโโโโโโโโโโโโโโโโโโโ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Aura Agents โ โ โ neo4j-graphrag โ โ โ Aura Agents API โ โ
โ โ โข Templates โ โ โ โข VectorRetriever โ โ โ โข REST API Access โ โ
โ โ โข Similarity โ โ โ โข VectorCypherR. โ โ โ โข OAuth2 Auth โ โ
โ โ โข Text2Cypher โ โ โ โข GraphRAG Class โ โ โ LangGraph + MCP โ โ
โ โโโโโโโโโโโโโโโโโ โ โโโโโโโโโโโโโโโโโโโโโโโ โ โ โข Neo4j MCP Server โ โ
โ โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Neo4j Aura โ
โ SEC 10-K Knowledge Graph โ
โ โข Companies & Risk Factors โ
โ โข Asset Manager Ownership โ
โ โข Vector Embeddings โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Knowledge Graph Data Model
The knowledge graph contains SEC 10-K filings from major technology companies:
- Companies: Apple, Microsoft, NVIDIA, and more
- Risk Factors: Extracted risk disclosures from SEC filings
- Asset Managers: Institutional investors and their holdings
- Financial Metrics: Key financial data mentioned in filings
- Vector Embeddings: Pre-computed embeddings for semantic search
- "What risk factors do Apple and Microsoft share?"
- "Which asset managers have the largest tech portfolios?"
- "What do companies say about AI and machine learning in their filings?"
Graph Structure
NEXT_CHUNK
โโโโโโโโโโโโโโโโโโโโ
โ โ
v โ
โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ
โ Chunk โโโโโโโ>โ Chunk โโโโโโโ>โ Chunk โ
โ โ โ โ โ โ
โ text โ โ text โ โ text โ
โ embeddingโ โ embeddingโ โ embeddingโ
โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ
โ โ โ
โ FROM_DOCUMENT โ โ
v v v
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Document โ
โ โ
โ path: "sec-10k-filings/apple-10k.pdf" โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
^ ^ ^ โ FROM_CHUNK โ โ โ โ โ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ โ Company โ โ Product โ โRiskFactorโ โ โ โ โ โ โ โ Apple โ โ iPhone โ โ Supply โ โ Inc. โ โ โ โ Chain โ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ โ ^ โ FACES_RISK โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Node Types
| Node Label | Description | Key Properties | |------------|-------------|----------------| | Document | Source PDF file | path, createdAt | | Chunk | Text segment from document | text, index, embedding | | Company | Extracted company entity | name, ticker | | Product | Products/services mentioned | name | | RiskFactor | Business risks identified | name | | Executive | Key personnel | name, title | | FinancialMetric | Financial data points | name, value | | AssetManager | Institutional investors | managerName |
Relationship Types
| Relationship | Direction | Description | |--------------|-----------|-------------| | FROM_DOCUMENT | (Chunk)->(Document) | Links chunk to source document | | NEXT_CHUNK | (Chunk)->(Chunk) | Sequential chunk ordering | | FROM_CHUNK | (Entity)->(Chunk) | Provenance: where entity was extracted | | FACES_RISK | (Company)->(RiskFactor) | Company faces this risk | | OFFERS | (Company)->(Product) | Company offers this product | | HAS_EXECUTIVE | (Company)->(Executive) | Company has this executive | | REPORTS | (Company)->(FinancialMetric) | Company reports this metric | | OWNS | (AssetManager)->(Company) | Investor owns shares in company |
Search Indexes
The knowledge graph includes indexes to support different retrieval strategies:
| Index Name | Type | Target | Purpose | |------------|------|--------|---------| | chunkEmbeddings | Vector | Chunk.embedding | Semantic similarity search | | chunkText | Fulltext | Chunk.text | Keyword search for hybrid retrieval | | search_entities | Fulltext | Entity .name properties | Entity lookup by name |
Retrieval Strategies
1. Vector Search - Find semantically similar content using embeddings:
CALL db.index.vector.queryNodes('chunkEmbeddings', 5, $embedding) YIELD node, score RETURN node.text, score
2. Graph-Enhanced Retrieval - Combine vector search with graph traversal:
-- Find chunks, then traverse to related entities CALL db.index.vector.queryNodes('chunkEmbeddings', 5, $embedding) YIELD node AS chunk, score MATCH (company:Company)-[:FROM_CHUNK]->(chunk) OPTIONAL MATCH (company)-[:FACES_RISK]->(risk:RiskFactor) RETURN chunk.text, company.name, collect(risk.name) AS risks
3. Hybrid Search - Combine keyword and semantic search:
-- Uses both chunkEmbeddings (vector) and chunkText (fulltext) indexes -- Alpha parameter controls the balance: 1.0 = pure vector, 0.0 = pure keyword
4. Text2Cypher - Natural language to Cypher query generation using LLM.
This hybrid architecture enables rich, context-aware retrieval that leverages both the semantic understanding from embeddings and the structural relationships in the knowledge graph.
Improving the Labs
We'd appreciate your feedback! Open an issue at github.com/neo4j-partners/hands-on-lab-neo4j-and-bedrock/issues.