diff --git a/agents/connections/neo4j.mdx b/agents/connections/neo4j.mdx index 772e1f85..8b49404a 100644 --- a/agents/connections/neo4j.mdx +++ b/agents/connections/neo4j.mdx @@ -27,18 +27,23 @@ Hypermode agent to Neo4j. ## Prerequisites -Before connecting Neo4j to Hypermode, you'll need: +Before connecting Neo4j to Hypermode Agents, you'll need: -1. A [Neo4j account](https://neo4j.com/) -2. A Neo4j instance (we'll use Neo4j Sandbox for this guide) -3. A [Hypermode workspace](https://hypermode.com/) +1. A Neo4j database instance (free options include + [Neo4j Sandbox](https://sandbox.neo4j.com) and Neo4j Aura free tier) +2. A [Hypermode Agents](https://agents.hypermode.com) account + + + This guide will walk you through the steps of connecting to Neo4j using the + free Neo4j Sandbox, but you can also use Neo4j Aura or a self-hosted instance. + ## Setting up Neo4j ### Step 1: Create a Neo4j Sandbox -First, you need to go to https://sandbox.neo4j.com/ and create an account. When -you get to making a database, select a blank sandbox. +First, navigate to https://sandbox.neo4j.com/ and create an account. Choose +"Blank Sandbox" from the list of available options. ![Create blank sandbox](/images/connections/neo4j/blank-sandbox.png) @@ -47,89 +52,58 @@ you get to making a database, select a blank sandbox. production use, consider Neo4j Aura or a self-hosted instance. -### Step 2: Get your connection details - -Once created (it may take a moment), you can navigate to the HTTP tab and grab -the URL. Note you will have to modify this to use the Neo4j HTTP v2 endpoint: - -- Remove `/db/neo4j/tx/commit` -- Replace it with `/db/neo4j/query/v2` - -For example: +### Step 2: Note your connection details -- Original: `http://52.54.53.148:7474/db/neo4j/tx/commit` -- Modified: `http://52.54.53.148:7474/db/neo4j/query/v2` +Once your Neo4j sandbox instance is created (it may take a moment), you can +navigate to the "Connection details" tab to view the connection credentials for +your Neo4j sandbox instance. -![http tab](/images/connections/neo4j/neo4j-http-connection.png) - -### Step 3: Get authentication credentials - -Save this URL and then move to the connection details to grab the username and -password. - -![Connection details](/images/connections/neo4j/neo4j-user-password.png) - -Now we've got the URL, username, and password we can create a new agent in -Hypermode. +Note the username, password, and Bolt URL - you'll use these in the next step to +create a Neo4j connection in Hypermode Agents. +![Connection details](/images/connections/neo4j/sandbox-credentials.png) ## Creating your Neo4j agent ### Step 1: Create a new agent -From the Hypermode interface, create a new agent: - -1. Click the agent dropdown menu -2. Select "Create new Agent" +From the Hypermode Agents dashboard, create a new agent: -![Navigate to create agent](/images/connections/neo4j/navigate-create-agent.png) - -### Step 2: Configure agent settings - -Use these recommended settings for your Neo4j agent: - -- **Agent Name**: GraphExplorer -- **Agent Title**: Neo4j Graph Analysis Agent -- **Description**: Analyzes graph relationships and patterns in Neo4j -- **Instructions**: You have a connection to a Neo4j graph database. You can - create nodes with any labels and properties, create relationships of any type, - and run Cypher queries. Neo4j is schemaless, so you can dynamically add data - without predefined structures. -- **Model**: GPT-4.1 +1. Select the "Create agent" button +2. Describe your agent in a few sentences, we'll use "The agent is a Neo4j + expert" ![Create agent modal](/images/connections/neo4j/create-agent-modal.png) ### Step 3: View your agent profile -Once created, navigate to your agent's settings page: +Once created, navigate to your agent's details page. Here you can view and edit +the agent instructions that were created from your initial agent description +preceding the agent creation process. ![Agent profile](/images/connections/neo4j/agent-profile.png) +You can update the agent instructions at any time to help align the agent's +background and skills with your use case. + ## Connecting to Neo4j ### Step 1: Add the Neo4j connection -Navigate to the **Connections** tab and add Neo4j: +Navigate to the **Connections** tab in Hypermode Agents and add Neo4j: 1. Click "Add connection" -2. Search for "Neo4j" in the available connections +2. Select the "Connect" button next to Neo4j in the list of available + connections ![Add Neo4j connection](/images/connections/neo4j/add-neo4j-connection.png) ### Step 2: Configure credentials -Enter your Neo4j credentials: - -- **URL**: Your modified HTTP v2 endpoint - (`http://52.54.53.148:7474/db/neo4j/query/v2`) -- **Username**: Your Neo4j username (usually `neo4j`) -- **Password**: Your Neo4j password +Enter your Neo4j credentials from the Neo4j Sandbox details page. ![Neo4j connection modal](/images/connections/neo4j/neo4j-connection-modal.png) - - Ensure you're using the HTTP v2 endpoint format. The connection will fail with - the default transaction endpoint. - +Ensure you're using the Bolt URL endpoint format. ## Understanding Neo4j's schemaless nature @@ -150,6 +124,8 @@ This flexibility makes Neo4j perfect for: - Complex, heterogeneous datasets - Real-world relationship modeling +![Neo4j Graph Model](/images/connections/neo4j/what-data.png) + ## Example graph model Here's a simple example of how nodes and relationships work in Neo4j: @@ -189,8 +165,6 @@ Create these relationships: - GraphApp is BY_COMPANY TechCorp ``` -![Create relationships result](/images/connections/neo4j/create-relationships-result.png) - ### Test 3: Visualize in Neo4j Browser After your agent creates the data, switch to Neo4j Browser to see the results: @@ -212,7 +186,7 @@ Back in your agent thread, use Cypher to explore your data: Run a Cypher query to find all products made by people who work at TechCorp, showing the full relationship path. ``` -![Query result](/images/connections/neo4j/cypher-query-result.png) +![Query result](/images/connections/neo4j/query-your-graph.png) ## Example: Building a dynamic knowledge graph @@ -228,6 +202,8 @@ Let's expand our graph with more data: 5. Add a COMPETES_WITH relationship between the two companies ``` +![Graph with more data](/images/connections/neo4j/dynamic-graph-query-agent.png) + Your agent can dynamically add: - New node types as you discover them @@ -235,6 +211,8 @@ Your agent can dynamically add: - Relationships that make sense in context - No need to predefine any structure! +![Graph with more data](/images/connections/neo4j/dynamic-graph-query-results.png) + ## What you can do With your Neo4j connection and its three core tools, your agent can: @@ -254,7 +232,6 @@ With your Neo4j connection and its three core tools, your agent can: #### Connection refused error -- Verify you're using the HTTP v2 endpoint format - Check if your sandbox is still active (they expire after 3 days) - Ensure the URL includes the correct port (usually 7474) @@ -264,17 +241,8 @@ With your Neo4j connection and its three core tools, your agent can: - Sandbox passwords are auto-generated - copy carefully - Try resetting the password in the sandbox console -#### Tool execution errors - -- Check the - [MCP Neo4j documentation](https://mcp.pipedream.com/app/neo4j_auradb) for - correct parameter formats -- Ensure node IDs exist before creating relationships -- Verify Cypher syntax in your queries - ## Learn more - [Neo4j Documentation](https://neo4j.com/docs/) - [Cypher Query Language](https://neo4j.com/docs/cypher-manual/current/) -- [MCP Neo4j AuraDB Server](https://mcp.pipedream.com/app/neo4j_auradb) -- [Graph Data Science Library](https://neo4j.com/docs/graph-data-science/current/) +- [Tutorial: Using Hypermode Agents to extract and build knowledge graphs](/agents/knowledge-graph-extraction) diff --git a/agents/knowledge-graph-extraction.mdx b/agents/knowledge-graph-extraction.mdx index 3014d5a4..186089ec 100644 --- a/agents/knowledge-graph-extraction.mdx +++ b/agents/knowledge-graph-extraction.mdx @@ -42,8 +42,6 @@ interact with external services, and perform complex tasks on your behalf. Unlike traditional chatbots, Hypermode Agents can actually take actions—like scraping websites, querying databases, and transforming data. -![Screenshot of Hypermode Agents interface showing an Agent card with connections](/images/tutorials/knowledge-graph-extraction/agent-profile.png) - ### Key features for this tutorial - **Natural Language Understanding**: Give instructions in plain English @@ -88,6 +86,12 @@ By extracting Product Hunt data into Neo4j, you can: ## Step 1: Set up Neo4j Sandbox + + Refer to the [Hypermode Agents Neo4j connection + guide](/agents/connections/neo4j) for more details on how to connect your + agent to Neo4j. + + ### Create a Neo4j Sandbox First, you need to go to https://sandbox.neo4j.com/ and create an account. When @@ -100,55 +104,41 @@ you get to making a database, select a blank sandbox. production use, consider Neo4j Aura or a self-hosted instance. -### Get your connection details - -Once created (it may take a moment), you can navigate to the HTTP tab and grab -the URL. Note you will have to modify this to use the Neo4j HTTP v2 endpoint -when adding the Neo4j connection in Hypermode Agents. +### Note your connection details -- Remove `/db/neo4j/tx/commit` -- Replace it with `/db/neo4j/query/v2` +Once your Neo4j sandbox instance is created (it may take a moment), you can +navigate to the "Connection details" tab to view the connection credentials for +your Neo4j sandbox instance. -For example: +Note the username, password, and Bolt URL - you'll use these in the next step to +create a Neo4j connection in Hypermode Agents. +![Connection details](/images/connections/neo4j/sandbox-credentials.png) -- Original: `http://52.54.53.148:7474/db/neo4j/tx/commit` -- Modified: `http://52.54.53.148:7474/db/neo4j/query/v2` +## Creating your Neo4j agent -![Connection details](/images/tutorials/knowledge-graph-extraction/neo4j-http-connect.png) +### Step 1: Create a new agent - - The Neo4j connection in Hypermode Agents uses the [Neo4j Query HTTP API v2 - endpoint](https://neo4j.com/docs/query-api/current/), not the now deprecated - HTTP v1 endpoint, which is why we need to modify the URL. Refer to the - [Hypermode Agents Neo4j connection guide](/agents/connections/neo4j) for more - information. - +From the Hypermode Agents dashboard, create a new agent: -### Get authentication credentials +1. Select the "Create agent" button +2. Describe your agent in a few sentences, we'll use "Extracts product data from + Product Hunt and builds knowledge graphs in Neo4j" -Save this URL and then move to the connection details to grab the username and -password. +![Create agent modal](/images/tutorials/knowledge-graph-extraction/create-agent.png) -Make sure to note these details - you'll need them when setting up the -connection in Hypermode. +### Step 2: View your agent profile -## Step 2: Create your knowledge graph Agent +Once created, navigate to your agent's details page. Here you can view and edit +the agent instructions that were created from your initial agent description +preceding the agent creation process. -### Manual Agent creation +![Agent profile](/images/tutorials/knowledge-graph-extraction/agent-profile.png) -Let's create an Agent specifically designed for knowledge graph extraction. -Navigate to your Hypermode workspace and create a new agent with these settings: +You can update the agent instructions at any time to help align the agent's +background and skills with your use case. -- **Agent Name**: KnowledgeGraphBuilder -- **Agent Title**: Product Hunt Knowledge Graph Extractor -- **Description**: Extracts product data from Product Hunt and builds knowledge - graphs in Neo4j - -![Agent creation form](/images/tutorials/knowledge-graph-extraction/agent-creation.png) - -### System prompt - -Use this comprehensive system prompt for your agent: +For example, you can update the agent instructions to include more explicit +workflows: ```text Identity: @@ -207,53 +197,27 @@ Not all products will have the same information, so create flexible queries that Always maintain data accuracy and provide clear explanations of the graph structure you're creating. ``` -### Select your model - -For this use case, we recommend **Claude 4 Sonnet** or **GPT-4.1** as they excel -at: - -- Understanding complex data structures -- Writing accurate Cypher queries -- Managing multi-step workflows - -## Step 3: Add connections - -Your agent needs key connections to function properly: - -### Add Neo4j connection - -1. Navigate to your agent's connections tab -2. Click "Add connection" -3. Search for "Neo4j" and select it - -![Add Neo4j connection](/images/tutorials/knowledge-graph-extraction/add-neo4j.png) - -Configure the Neo4j connection with your Sandbox details: - -- **URL**: Your modified HTTP v2 endpoint -- **Username**: `neo4j` (or your custom username) -- **Password**: Your Sandbox password +## Connecting to Neo4j -![Neo4j MCP connection setup](/images/tutorials/knowledge-graph-extraction/neo4j-mcp-connect-http.png) +### Step 1: Add the Neo4j connection -### Add LinkedIn connection +Navigate to the **Connections** tab in Hypermode Agents and add Neo4j: -For enriching founder and company data: +1. Click "Add connection" +2. Select the "Connect" button next to Neo4j in the list of available + connections -1. Add the "LinkedIn" connection -2. Complete the OAuth flow to authorize access -3. This enables the agent to gather professional information +![Add Neo4j connection](/images/connections/neo4j/add-neo4j-connection.png) -![Add LinkedIn connection](/images/tutorials/knowledge-graph-extraction/add-linkedin.png) +### Step 2: Configure credentials -### Add Product Hunt connection +Enter your Neo4j credentials from the Neo4j Sandbox details page. -For direct Product Hunt API access (if available): +![Neo4j connection modal](/images/connections/neo4j/neo4j-connection-modal.png) -1. Add the "Product Hunt" connection if available in your workspace -2. This provides structured access to Product Hunt data +Ensure you're using the Bolt URL endpoint format. -![Add Product Hunt connection](/images/tutorials/knowledge-graph-extraction/add-product-hunt.png) +### Step 3: Update your agent instructions ## Step 4: Test the connection @@ -762,7 +726,7 @@ Always provide the graph traversal logic used for recommendations and offer to e Read more about knowledge graphs on the Hypermode blog diff --git a/images/connections/neo4j/add-neo4j-connection.png b/images/connections/neo4j/add-neo4j-connection.png index 68b95065..8e7133bc 100644 Binary files a/images/connections/neo4j/add-neo4j-connection.png and b/images/connections/neo4j/add-neo4j-connection.png differ diff --git a/images/connections/neo4j/agent-profile.png b/images/connections/neo4j/agent-profile.png index 1e8c6c1a..1bea39cc 100644 Binary files a/images/connections/neo4j/agent-profile.png and b/images/connections/neo4j/agent-profile.png differ diff --git a/images/connections/neo4j/create-agent-modal.png b/images/connections/neo4j/create-agent-modal.png index 33babc37..4e06a469 100644 Binary files a/images/connections/neo4j/create-agent-modal.png and b/images/connections/neo4j/create-agent-modal.png differ diff --git a/images/connections/neo4j/create-nodes-result.png b/images/connections/neo4j/create-nodes-result.png index e398d9d9..94b4b3df 100644 Binary files a/images/connections/neo4j/create-nodes-result.png and b/images/connections/neo4j/create-nodes-result.png differ diff --git a/images/connections/neo4j/dynamic-graph-query-agent.png b/images/connections/neo4j/dynamic-graph-query-agent.png new file mode 100644 index 00000000..b6c85324 Binary files /dev/null and b/images/connections/neo4j/dynamic-graph-query-agent.png differ diff --git a/images/connections/neo4j/dynamic-graph-query-results.png b/images/connections/neo4j/dynamic-graph-query-results.png new file mode 100644 index 00000000..5d012b1e Binary files /dev/null and b/images/connections/neo4j/dynamic-graph-query-results.png differ diff --git a/images/connections/neo4j/neo4j-browser-graph-view.png b/images/connections/neo4j/neo4j-browser-graph-view.png index 039df504..2aab18af 100644 Binary files a/images/connections/neo4j/neo4j-browser-graph-view.png and b/images/connections/neo4j/neo4j-browser-graph-view.png differ diff --git a/images/connections/neo4j/neo4j-connection-modal.png b/images/connections/neo4j/neo4j-connection-modal.png index 48221f9a..4e18d96a 100644 Binary files a/images/connections/neo4j/neo4j-connection-modal.png and b/images/connections/neo4j/neo4j-connection-modal.png differ diff --git a/images/connections/neo4j/query-your-graph.png b/images/connections/neo4j/query-your-graph.png new file mode 100644 index 00000000..ca963229 Binary files /dev/null and b/images/connections/neo4j/query-your-graph.png differ diff --git a/images/connections/neo4j/sandbox-credentials.png b/images/connections/neo4j/sandbox-credentials.png new file mode 100644 index 00000000..671e1ea7 Binary files /dev/null and b/images/connections/neo4j/sandbox-credentials.png differ diff --git a/images/connections/neo4j/what-data.png b/images/connections/neo4j/what-data.png new file mode 100644 index 00000000..dea2adf0 Binary files /dev/null and b/images/connections/neo4j/what-data.png differ diff --git a/images/tutorials/knowledge-graph-extraction/agent-profile.png b/images/tutorials/knowledge-graph-extraction/agent-profile.png index 4465cceb..031a3fcf 100644 Binary files a/images/tutorials/knowledge-graph-extraction/agent-profile.png and b/images/tutorials/knowledge-graph-extraction/agent-profile.png differ diff --git a/images/tutorials/knowledge-graph-extraction/create-agent.png b/images/tutorials/knowledge-graph-extraction/create-agent.png new file mode 100644 index 00000000..5ee545da Binary files /dev/null and b/images/tutorials/knowledge-graph-extraction/create-agent.png differ diff --git a/images/tutorials/knowledge-graph-extraction/query-neo4j-empty.png b/images/tutorials/knowledge-graph-extraction/query-neo4j-empty.png index 77842e52..95f20f04 100644 Binary files a/images/tutorials/knowledge-graph-extraction/query-neo4j-empty.png and b/images/tutorials/knowledge-graph-extraction/query-neo4j-empty.png differ diff --git a/images/tutorials/knowledge-graph-extraction/search-product-hunt.png b/images/tutorials/knowledge-graph-extraction/search-product-hunt.png index 799fa30c..482ee36a 100644 Binary files a/images/tutorials/knowledge-graph-extraction/search-product-hunt.png and b/images/tutorials/knowledge-graph-extraction/search-product-hunt.png differ