{"id":5950,"library":"graphiti-core","title":"Graphiti Core","description":"Graphiti Core is a Python library for building and querying temporal context graphs, primarily designed for AI agents. It enables real-time, incremental updates to knowledge graphs, tracking how facts and relationships evolve over time without requiring full recomputation. It supports hybrid search (semantic, keyword, graph traversal) and integrates with various graph databases and LLM providers. The current version is 0.28.2, with frequent updates addressing new features, performance, and security.","status":"active","version":"0.28.2","language":"en","source_language":"en","source_url":"https://github.com/getzep/graphiti","tags":["graph","temporal-graph","knowledge-graph","LLM","AI","agent-memory","RAG"],"install":[{"cmd":"pip install graphiti-core","lang":"bash","label":"Base Installation"},{"cmd":"pip install graphiti-core[falkordb]","lang":"bash","label":"With FalkorDB support"},{"cmd":"pip install graphiti-core[kuzu]","lang":"bash","label":"With Kuzu support"},{"cmd":"pip install graphiti-core[neptune]","lang":"bash","label":"With Amazon Neptune support"},{"cmd":"pip install graphiti-core[anthropic,groq,google-genai]","lang":"bash","label":"With multiple LLM providers"}],"dependencies":[{"reason":"Required Python version.","package":"python","version":">=3.10, <4","optional":false},{"reason":"Optional graph database backend. Install with `[falkordb]` extra.","package":"falkordb","optional":true},{"reason":"Optional graph database backend. Install with `[kuzu]` extra.","package":"kuzu","optional":true},{"reason":"Optional graph database backend. Install with `[neptune]` extra.","package":"amazon-neptune","optional":true},{"reason":"Default LLM provider for inference and embedding. Requires `OPENAI_API_KEY`.","package":"openai","optional":false},{"reason":"Optional LLM provider. Install with `[anthropic]` extra.","package":"anthropic","optional":true},{"reason":"Optional LLM provider. Install with `[groq]` extra.","package":"groq","optional":true},{"reason":"Optional LLM provider. Install with `[google-genai]` extra.","package":"google-genai","optional":true}],"imports":[{"symbol":"Graphiti","correct":"from graphiti_core import Graphiti"},{"symbol":"EpisodeType","correct":"from graphiti_core.nodes import EpisodeType"}],"quickstart":{"code":"import asyncio\nimport os\nfrom datetime import datetime\nfrom graphiti_core import Graphiti\nfrom graphiti_core.nodes import EpisodeType\n\n# Ensure OPENAI_API_KEY and FALKORDB_URI are set in your environment\n# Example: export OPENAI_API_KEY=\"sk-...\"\n# Example: docker run -p 6379:6379 -p 3000:3000 -it --rm falkordb/falkordb:latest\n\nasync def main():\n    # Initialize Graphiti with FalkorDB driver (default to localhost)\n    graphiti = Graphiti(\n        uri=os.environ.get('FALKORDB_URI', \"falkor://localhost:6379\")\n    )\n\n    # Build indices (run once during setup)\n    print(\"Building indices and constraints...\")\n    await graphiti.build_indices_and_constraints()\n    print(\"Indices built.\")\n\n    # Add an episode (information to be stored in the graph)\n    episode_body = (\n        \"Alice met Bob at the AI conference in San Francisco on March 15, 2024. \"\n        \"They discussed the latest developments in graph databases and decided \"\n        \"to collaborate on a new project using Graphiti and FalkorDB.\"\n    )\n    print(\"Adding episode...\")\n    await graphiti.add_episode(\n        name=\"Conference Meeting\",\n        episode_body=episode_body,\n        episode_type=EpisodeType.text,\n        reference_time=datetime(2024, 3, 15),\n        source_description=\"Conference notes\"\n    )\n    print(\"Episode added.\")\n\n    # Search the knowledge graph\n    print(\"Searching the graph...\")\n    search_results = await graphiti.search(\n        query=\"What did Alice and Bob discuss?\",\n        num_results=3\n    )\n\n    print(\"\\nSearch Results:\")\n    if search_results:\n        for i, result in enumerate(search_results):\n            print(f\"- Result {i+1}: {result.node.summary}\")\n    else:\n        print(\"No search results found.\")\n\n    # Close the connection\n    await graphiti.close()\n    print(\"Connection closed.\")\n\nif __name__ == \"__main__\":\n    # Set a dummy API key if not already set, for local testing without network\n    if not os.environ.get('OPENAI_API_KEY'):\n        print(\"Warning: OPENAI_API_KEY environment variable not set. Using a dummy key.\")\n        os.environ['OPENAI_API_KEY'] = 'dummy-key-for-test'\n    \n    asyncio.run(main())","lang":"python","description":"This quickstart demonstrates how to initialize Graphiti with a FalkorDB backend, build necessary indices, add a text-based episode, and perform a natural language search. It requires a running FalkorDB instance and an OpenAI API key set in your environment."},"warnings":[{"fix":"Upgrade to `graphiti-core>=0.28.2`.","message":"Graphiti-core versions prior to 0.28.2 contain a Cypher injection vulnerability. It is critical to update to 0.28.2 or later to mitigate this security risk.","severity":"breaking","affected_versions":"<0.28.2"},{"fix":"Review cache implementations and migrate any direct `diskcache` interactions to the new `sqlite-based` mechanism or other supported caching strategies.","message":"Version 0.28.1 replaced the `diskcache` dependency with a `sqlite-based cache` to resolve a CVE. If your application directly interacted with `diskcache` or relied on specific `diskcache` configurations, this change might require adjustments.","severity":"breaking","affected_versions":"All versions before 0.28.1 if using diskcache features."},{"fix":"Set the `OPENAI_API_KEY` environment variable or install and configure an alternative LLM provider as described in the documentation.","message":"Graphiti defaults to using OpenAI for LLM inference and embedding. An `OPENAI_API_KEY` environment variable must be set for the library to function correctly unless an alternative LLM provider is explicitly configured and installed (e.g., `graphiti-core[anthropic]`).","severity":"gotcha","affected_versions":"All versions"},{"fix":"Consult the release notes and documentation for 0.28.0 to understand the new driver architecture and adapt custom implementations.","message":"Version 0.28.0 introduced a 'driver operations architecture redesign'. Users with custom database drivers or those who extensively customized database interactions might need to review and update their implementations to align with the new architecture.","severity":"gotcha","affected_versions":"Pre-0.28.0 custom driver implementations"},{"fix":"Adjust the `SEMAPHORE_LIMIT` environment variable to a higher value after carefully considering the rate limits of your LLM provider and your application's requirements.","message":"Graphiti is designed for high concurrency in its ingestion pipelines. By default, concurrency is set low to prevent LLM Provider 429 (Rate Limit) errors. If performance is critical, increase concurrency via the `SEMAPHORE_LIMIT` environment variable.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Set up and connect to a supported graph database as detailed in the Graphiti documentation. Use the `uri` parameter in the `Graphiti` constructor.","message":"Graphiti requires an external graph database (e.g., Neo4j, FalkorDB, Kuzu, Amazon Neptune) to operate. Ensure a compatible database is running and accessible with the correct connection parameters.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Consider deploying `graphiti-core` operations within a separate process or microservice, accessed via an HTTP API, to maintain event loop integrity and stability of the main application.","message":"Due to `graphiti-core`'s asynchronous nature and persistent connections, integrating it directly into applications with incompatible concurrency models (e.g., certain web frameworks) can lead to 'Event loop is closed' errors. For production, isolating `graphiti-core` in its own process, such as via a dedicated API service, is recommended for stability.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-14T00:00:00.000Z","next_check":"2026-07-13T00:00:00.000Z","problems":[]}