Prerequisites
The following example requires theneo4j library.
NEO4J_URI environment variable to the URI of the Neo4j database.
Example
The following agent can interact with Neo4j graph databases:neo4j_tools.py
neo4j_tools.py, then run:
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
The Neo4jTools toolkit enables agents to interact with Neo4j graph databases for querying and managing graph data.
neo4j library.
uv pip install -U neo4j
docker run -d -p 7474:7474 -p 7687:7687 --name neo4j -e NEO4J_AUTH=neo4j/password neo4j
NEO4J_URI environment variable to the URI of the Neo4j database.
export NEO4J_URI=bolt://localhost:7687
export NEO4J_USERNAME=neo4j
export NEO4J_PASSWORD=password
export OPENAI_API_KEY=xxx
uv pip install -U neo4j openai agno
from agno.agent import Agent
from agno.tools.neo4j import Neo4jTools
agent = Agent(
instructions=[
"You are a graph database assistant that helps with Neo4j operations",
"Execute Cypher queries to analyze graph data and relationships",
"Provide insights about graph structure and patterns",
"Help with graph data modeling and optimization",
],
tools=[Neo4jTools()],
)
agent.print_response("Show me the schema of the graph database", stream=True)
neo4j_tools.py, then run:
python neo4j_tools.py
| Parameter | Type | Default | Description |
|---|---|---|---|
uri | Optional[str] | None | Neo4j connection URI. Uses NEO4J_URI if not set, then bolt://localhost:7687. |
user | Optional[str] | None | Neo4j username. Uses NEO4J_USERNAME if not set. |
password | Optional[str] | None | Neo4j password. Uses NEO4J_PASSWORD if not set. |
database | Optional[str] | None | Database name to connect to. Defaults to neo4j. |
enable_list_labels | bool | True | Enable listing node labels. |
enable_list_relationships | bool | True | Enable listing relationship types. |
enable_get_schema | bool | True | Enable schema information retrieval. |
enable_run_cypher | bool | True | Enable Cypher query execution. |
all | bool | False | Enables all functionality when set to True. |
| Function | Description |
|---|---|
list_labels | List all node labels in the graph database. |
list_relationship_types | List all relationship types in the graph database. |
get_schema | Get comprehensive schema information about the graph. |
run_cypher_query | Execute Cypher queries on the graph database. |
Was this page helpful?