agentic-graphrag 0.0.1__tar.gz → 0.0.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (198) hide show
  1. agentic_graphrag-0.0.3/PKG-INFO +418 -0
  2. agentic_graphrag-0.0.3/README.md +344 -0
  3. agentic_graphrag-0.0.3/agrag/agents/__init__.py +6 -0
  4. agentic_graphrag-0.0.3/agrag/agents/build.py +276 -0
  5. agentic_graphrag-0.0.3/agrag/agents/errors.py +16 -0
  6. agentic_graphrag-0.0.3/agrag/agents/harness.py +54 -0
  7. agentic_graphrag-0.0.3/agrag/agents/ledger.py +113 -0
  8. agentic_graphrag-0.0.3/agrag/agents/middleware.py +289 -0
  9. agentic_graphrag-0.0.3/agrag/agents/model.py +125 -0
  10. agentic_graphrag-0.0.3/agrag/agents/prompts.py +91 -0
  11. agentic_graphrag-0.0.3/agrag/agents/result.py +21 -0
  12. agentic_graphrag-0.0.3/agrag/agents/settings.py +106 -0
  13. agentic_graphrag-0.0.3/agrag/agents/subagents.py +79 -0
  14. agentic_graphrag-0.0.3/agrag/agents/tools/__init__.py +91 -0
  15. agentic_graphrag-0.0.3/agrag/agents/tools/aggregate.py +66 -0
  16. agentic_graphrag-0.0.3/agrag/agents/tools/search.py +465 -0
  17. agentic_graphrag-0.0.3/agrag/agents/tools/traversal.py +333 -0
  18. agentic_graphrag-0.0.3/agrag/agents/tracing.py +134 -0
  19. agentic_graphrag-0.0.3/agrag/agents/verification.py +92 -0
  20. agentic_graphrag-0.0.3/agrag/chunking/__init__.py +38 -0
  21. agentic_graphrag-0.0.3/agrag/chunking/_docling_adapters.py +69 -0
  22. agentic_graphrag-0.0.3/agrag/chunking/_text.py +159 -0
  23. agentic_graphrag-0.0.3/agrag/chunking/base.py +239 -0
  24. agentic_graphrag-0.0.3/agrag/chunking/docling.py +200 -0
  25. agentic_graphrag-0.0.3/agrag/chunking/extras.py +182 -0
  26. agentic_graphrag-0.0.3/agrag/chunking/heading.py +137 -0
  27. agentic_graphrag-0.0.3/agrag/chunking/parent_child.py +105 -0
  28. agentic_graphrag-0.0.3/agrag/chunking/recursive.py +72 -0
  29. agentic_graphrag-0.0.3/agrag/chunking/rules.py +119 -0
  30. agentic_graphrag-0.0.3/agrag/chunking/sentence.py +51 -0
  31. agentic_graphrag-0.0.3/agrag/chunking/token.py +49 -0
  32. agentic_graphrag-0.0.3/agrag/chunking/turns.py +115 -0
  33. agentic_graphrag-0.0.3/agrag/common/__init__.py +1 -0
  34. agentic_graphrag-0.0.3/agrag/common/data_models/__init__.py +6 -0
  35. agentic_graphrag-0.0.3/agrag/common/data_models/chunk.py +189 -0
  36. agentic_graphrag-0.0.3/agrag/common/data_models/community.py +65 -0
  37. agentic_graphrag-0.0.3/agrag/common/data_models/cutover_job.py +63 -0
  38. agentic_graphrag-0.0.3/agrag/common/data_models/data_point.py +22 -0
  39. agentic_graphrag-0.0.3/agrag/common/data_models/document.py +317 -0
  40. agentic_graphrag-0.0.3/agrag/common/data_models/entity.py +93 -0
  41. agentic_graphrag-0.0.3/agrag/common/data_models/extraction.py +103 -0
  42. agentic_graphrag-0.0.3/agrag/common/data_models/graph_record.py +148 -0
  43. agentic_graphrag-0.0.3/agrag/common/data_models/graph_schema.py +183 -0
  44. agentic_graphrag-0.0.3/agrag/common/data_models/normalization.py +25 -0
  45. agentic_graphrag-0.0.3/agrag/common/data_models/provenance.py +74 -0
  46. agentic_graphrag-0.0.3/agrag/common/data_models/query_value.py +13 -0
  47. agentic_graphrag-0.0.3/agrag/common/data_models/relation.py +44 -0
  48. agentic_graphrag-0.0.3/agrag/common/data_models/resolved_entity.py +50 -0
  49. agentic_graphrag-0.0.3/agrag/common/data_models/search_result.py +49 -0
  50. agentic_graphrag-0.0.3/agrag/common/data_models/stage_failure.py +77 -0
  51. agentic_graphrag-0.0.3/agrag/common/data_models/vector_record.py +74 -0
  52. agentic_graphrag-0.0.3/agrag/common/text.py +13 -0
  53. agentic_graphrag-0.0.3/agrag/common/validation.py +139 -0
  54. agentic_graphrag-0.0.3/agrag/cypher/__init__.py +5 -0
  55. agentic_graphrag-0.0.3/agrag/cypher/_pending_filter.py +28 -0
  56. agentic_graphrag-0.0.3/agrag/cypher/community_read.py +41 -0
  57. agentic_graphrag-0.0.3/agrag/cypher/community_write.py +19 -0
  58. agentic_graphrag-0.0.3/agrag/cypher/cutover_job_read.py +32 -0
  59. agentic_graphrag-0.0.3/agrag/cypher/cutover_job_write.py +319 -0
  60. agentic_graphrag-0.0.3/agrag/cypher/entities.py +551 -0
  61. agentic_graphrag-0.0.3/agrag/cypher/relations.py +443 -0
  62. agentic_graphrag-0.0.3/agrag/cypher/resolution_read.py +141 -0
  63. agentic_graphrag-0.0.3/agrag/cypher/resolution_write.py +171 -0
  64. agentic_graphrag-0.0.3/agrag/cypher/safety.py +141 -0
  65. agentic_graphrag-0.0.3/agrag/cypher/schema.py +280 -0
  66. agentic_graphrag-0.0.3/agrag/embedding/__init__.py +51 -0
  67. agentic_graphrag-0.0.3/agrag/embedding/base.py +96 -0
  68. agentic_graphrag-0.0.3/agrag/embedding/errors.py +35 -0
  69. agentic_graphrag-0.0.3/agrag/embedding/fastembed_bm25.py +162 -0
  70. agentic_graphrag-0.0.3/agrag/embedding/sentence_transformers.py +173 -0
  71. agentic_graphrag-0.0.3/agrag/embedding/settings.py +32 -0
  72. agentic_graphrag-0.0.3/agrag/embedding/sparse_base.py +53 -0
  73. agentic_graphrag-0.0.3/agrag/eval/__init__.py +109 -0
  74. agentic_graphrag-0.0.3/agrag/eval/adapter.py +112 -0
  75. agentic_graphrag-0.0.3/agrag/eval/answer.py +516 -0
  76. agentic_graphrag-0.0.3/agrag/eval/extraction.py +421 -0
  77. agentic_graphrag-0.0.3/agrag/eval/judge.py +108 -0
  78. agentic_graphrag-0.0.3/agrag/eval/resolution.py +201 -0
  79. agentic_graphrag-0.0.3/agrag/eval/settings.py +112 -0
  80. agentic_graphrag-0.0.3/agrag/eval/trajectory.py +708 -0
  81. agentic_graphrag-0.0.3/agrag/eval/verifier.py +176 -0
  82. agentic_graphrag-0.0.3/agrag/graphdb/__init__.py +61 -0
  83. agentic_graphrag-0.0.3/agrag/graphdb/base.py +279 -0
  84. agentic_graphrag-0.0.3/agrag/graphdb/errors.py +77 -0
  85. agentic_graphrag-0.0.3/agrag/graphdb/neo4j.py +1044 -0
  86. agentic_graphrag-0.0.3/agrag/graphdb/serialize.py +85 -0
  87. agentic_graphrag-0.0.3/agrag/graphdb/settings.py +52 -0
  88. agentic_graphrag-0.0.3/agrag/ingestion/__init__.py +6 -0
  89. agentic_graphrag-0.0.3/agrag/ingestion/_clustering.py +36 -0
  90. agentic_graphrag-0.0.3/agrag/ingestion/_cutover.py +482 -0
  91. agentic_graphrag-0.0.3/agrag/ingestion/_document_lifecycle.py +115 -0
  92. agentic_graphrag-0.0.3/agrag/ingestion/_ingest_pipeline.py +1826 -0
  93. agentic_graphrag-0.0.3/agrag/ingestion/_lexical_backbone.py +114 -0
  94. agentic_graphrag-0.0.3/agrag/ingestion/_resume.py +327 -0
  95. agentic_graphrag-0.0.3/agrag/ingestion/community.py +669 -0
  96. agentic_graphrag-0.0.3/agrag/ingestion/extract.py +831 -0
  97. agentic_graphrag-0.0.3/agrag/ingestion/graph.py +2073 -0
  98. agentic_graphrag-0.0.3/agrag/ingestion/materialize.py +593 -0
  99. agentic_graphrag-0.0.3/agrag/ingestion/merge.py +869 -0
  100. agentic_graphrag-0.0.3/agrag/ingestion/reports/__init__.py +20 -0
  101. agentic_graphrag-0.0.3/agrag/ingestion/reports/add_result.py +67 -0
  102. agentic_graphrag-0.0.3/agrag/ingestion/reports/community_detection_report.py +25 -0
  103. agentic_graphrag-0.0.3/agrag/ingestion/reports/consolidation_report.py +26 -0
  104. agentic_graphrag-0.0.3/agrag/ingestion/reports/reevaluation_report.py +28 -0
  105. agentic_graphrag-0.0.3/agrag/ingestion/reports/update_result.py +25 -0
  106. agentic_graphrag-0.0.3/agrag/ingestion/resolve/__init__.py +48 -0
  107. agentic_graphrag-0.0.3/agrag/ingestion/resolve/batch_validation.py +50 -0
  108. agentic_graphrag-0.0.3/agrag/ingestion/resolve/candidate_source.py +330 -0
  109. agentic_graphrag-0.0.3/agrag/ingestion/resolve/comparators.py +23 -0
  110. agentic_graphrag-0.0.3/agrag/ingestion/resolve/exact_groups.py +33 -0
  111. agentic_graphrag-0.0.3/agrag/ingestion/resolve/resolver.py +917 -0
  112. agentic_graphrag-0.0.3/agrag/ingestion/resolve/zone_classifier.py +99 -0
  113. agentic_graphrag-0.0.3/agrag/ingestion/resolved_embeddings.py +418 -0
  114. agentic_graphrag-0.0.3/agrag/ingestion/settings.py +21 -0
  115. agentic_graphrag-0.0.3/agrag/ingestion/stats/__init__.py +26 -0
  116. agentic_graphrag-0.0.3/agrag/ingestion/stats/chunking.py +77 -0
  117. agentic_graphrag-0.0.3/agrag/ingestion/stats/extraction.py +27 -0
  118. agentic_graphrag-0.0.3/agrag/ingestion/stats/ingest.py +17 -0
  119. agentic_graphrag-0.0.3/agrag/ingestion/stats/merge.py +33 -0
  120. agentic_graphrag-0.0.3/agrag/ingestion/stats/resolution.py +22 -0
  121. agentic_graphrag-0.0.3/agrag/ingestion/stats/storage.py +32 -0
  122. agentic_graphrag-0.0.3/agrag/llm/baml_client/__init__.py +60 -0
  123. agentic_graphrag-0.0.3/agrag/llm/baml_client/async_client.py +317 -0
  124. agentic_graphrag-0.0.3/agrag/llm/baml_client/config.py +102 -0
  125. agentic_graphrag-0.0.3/agrag/llm/baml_client/globals.py +35 -0
  126. agentic_graphrag-0.0.3/agrag/llm/baml_client/inlinedbaml.py +24 -0
  127. agentic_graphrag-0.0.3/agrag/llm/baml_client/parser.py +94 -0
  128. agentic_graphrag-0.0.3/agrag/llm/baml_client/runtime.py +361 -0
  129. agentic_graphrag-0.0.3/agrag/llm/baml_client/stream_types.py +89 -0
  130. agentic_graphrag-0.0.3/agrag/llm/baml_client/sync_client.py +324 -0
  131. agentic_graphrag-0.0.3/agrag/llm/baml_client/tracing.py +22 -0
  132. agentic_graphrag-0.0.3/agrag/llm/baml_client/type_builder.py +535 -0
  133. agentic_graphrag-0.0.3/agrag/llm/baml_client/type_map.py +45 -0
  134. agentic_graphrag-0.0.3/agrag/llm/baml_client/types.py +113 -0
  135. agentic_graphrag-0.0.3/agrag/llm/baml_client/watchers.py +44 -0
  136. agentic_graphrag-0.0.3/agrag/llm/baml_src/community.baml +48 -0
  137. agentic_graphrag-0.0.3/agrag/llm/baml_src/extraction.baml +74 -0
  138. agentic_graphrag-0.0.3/agrag/llm/baml_src/generators.baml +6 -0
  139. agentic_graphrag-0.0.3/agrag/llm/baml_src/merge.baml +21 -0
  140. agentic_graphrag-0.0.3/agrag/llm/baml_src/resolution.baml +37 -0
  141. agentic_graphrag-0.0.3/agrag/llm/baml_src/retrieval.baml +31 -0
  142. agentic_graphrag-0.0.3/agrag/llm/client_config.py +57 -0
  143. agentic_graphrag-0.0.3/agrag/llm/client_registry.py +69 -0
  144. agentic_graphrag-0.0.3/agrag/llm/retry.py +126 -0
  145. agentic_graphrag-0.0.3/agrag/llm/tracing.py +158 -0
  146. agentic_graphrag-0.0.3/agrag/loaders/corpus/__init__.py +41 -0
  147. agentic_graphrag-0.0.3/agrag/loaders/corpus/_walk.py +348 -0
  148. agentic_graphrag-0.0.3/agrag/loaders/corpus/base.py +79 -0
  149. agentic_graphrag-0.0.3/agrag/loaders/corpus/decode.py +88 -0
  150. agentic_graphrag-0.0.3/agrag/loaders/corpus/errors.py +59 -0
  151. agentic_graphrag-0.0.3/agrag/loaders/corpus/readers/_common.py +284 -0
  152. agentic_graphrag-0.0.3/agrag/loaders/corpus/readers/chat.py +168 -0
  153. agentic_graphrag-0.0.3/agrag/loaders/corpus/readers/html.py +64 -0
  154. agentic_graphrag-0.0.3/agrag/loaders/corpus/readers/prose.py +220 -0
  155. agentic_graphrag-0.0.3/agrag/loaders/corpus/readers/records.py +303 -0
  156. agentic_graphrag-0.0.3/agrag/loaders/corpus/registry.py +104 -0
  157. agentic_graphrag-0.0.3/agrag/loaders/corpus/types.py +196 -0
  158. agentic_graphrag-0.0.3/agrag/loaders/docling/__init__.py +34 -0
  159. agentic_graphrag-0.0.3/agrag/loaders/docling/loader.py +139 -0
  160. agentic_graphrag-0.0.3/agrag/observability.py +100 -0
  161. agentic_graphrag-0.0.3/agrag/retrieval/__init__.py +1 -0
  162. agentic_graphrag-0.0.3/agrag/retrieval/community_context.py +207 -0
  163. agentic_graphrag-0.0.3/agrag/retrieval/errors.py +65 -0
  164. agentic_graphrag-0.0.3/agrag/retrieval/filters.py +101 -0
  165. agentic_graphrag-0.0.3/agrag/retrieval/fusion.py +92 -0
  166. agentic_graphrag-0.0.3/agrag/retrieval/identity.py +98 -0
  167. agentic_graphrag-0.0.3/agrag/retrieval/methods/__init__.py +1 -0
  168. agentic_graphrag-0.0.3/agrag/retrieval/methods/traversal.py +348 -0
  169. agentic_graphrag-0.0.3/agrag/retrieval/methods/vector.py +131 -0
  170. agentic_graphrag-0.0.3/agrag/retrieval/recipes.py +57 -0
  171. agentic_graphrag-0.0.3/agrag/retrieval/rerank/__init__.py +1 -0
  172. agentic_graphrag-0.0.3/agrag/retrieval/rerank/cross_encoder.py +138 -0
  173. agentic_graphrag-0.0.3/agrag/retrieval/rerank/node_distance.py +105 -0
  174. agentic_graphrag-0.0.3/agrag/retrieval/resolved_entities.py +97 -0
  175. agentic_graphrag-0.0.3/agrag/retrieval/retrievers/__init__.py +1 -0
  176. agentic_graphrag-0.0.3/agrag/retrieval/retrievers/base.py +27 -0
  177. agentic_graphrag-0.0.3/agrag/retrieval/retrievers/bfs.py +156 -0
  178. agentic_graphrag-0.0.3/agrag/retrieval/retrievers/chunk.py +252 -0
  179. agentic_graphrag-0.0.3/agrag/retrieval/retrievers/community.py +131 -0
  180. agentic_graphrag-0.0.3/agrag/retrieval/retrievers/entity.py +402 -0
  181. agentic_graphrag-0.0.3/agrag/retrieval/retrievers/text2cypher.py +737 -0
  182. agentic_graphrag-0.0.3/agrag/retrieval/search_engine.py +558 -0
  183. agentic_graphrag-0.0.3/agrag/retrieval/settings.py +83 -0
  184. agentic_graphrag-0.0.3/agrag/retrieval/tracing.py +182 -0
  185. agentic_graphrag-0.0.3/agrag/vectordb/__init__.py +85 -0
  186. agentic_graphrag-0.0.3/agrag/vectordb/base.py +252 -0
  187. agentic_graphrag-0.0.3/agrag/vectordb/errors.py +44 -0
  188. agentic_graphrag-0.0.3/agrag/vectordb/milvus.py +933 -0
  189. agentic_graphrag-0.0.3/agrag/vectordb/qdrant.py +869 -0
  190. agentic_graphrag-0.0.3/agrag/vectordb/settings.py +133 -0
  191. agentic_graphrag-0.0.3/agrag/vectordb/weaviate.py +691 -0
  192. {agentic_graphrag-0.0.1 → agentic_graphrag-0.0.3}/pyproject.toml +87 -6
  193. {agentic_graphrag-0.0.1 → agentic_graphrag-0.0.3}/pyproject.toml.orig +88 -7
  194. agentic_graphrag-0.0.1/PKG-INFO +0 -54
  195. agentic_graphrag-0.0.1/README.md +0 -35
  196. {agentic_graphrag-0.0.1 → agentic_graphrag-0.0.3}/LICENSE +0 -0
  197. {agentic_graphrag-0.0.1 → agentic_graphrag-0.0.3}/agrag/__init__.py +0 -0
  198. {agentic_graphrag-0.0.1 → agentic_graphrag-0.0.3}/agrag/py.typed +0 -0
@@ -0,0 +1,418 @@
1
+ Metadata-Version: 2.4
2
+ Name: agentic-graphrag
3
+ Version: 0.0.3
4
+ Summary: Agentic GraphRAG: graph-based retrieval-augmented generation with agentic reasoning.
5
+ Keywords: graphrag,rag,knowledge-graph,agents,retrieval
6
+ Author: Ashwin Mathur, Varun Mathur
7
+ Author-email: Ashwin Mathur <ashwinm400@gmail.com>, Varun Mathur <varunm500@gmail.com>
8
+ License-Expression: Apache-2.0
9
+ License-File: LICENSE
10
+ Classifier: Programming Language :: Python
11
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
12
+ Requires-Dist: pydantic>=2.0
13
+ Requires-Dist: pydantic-settings>=2.0
14
+ Requires-Dist: python-dotenv>=1.0
15
+ Requires-Dist: chonkie>=1.7
16
+ Requires-Dist: opentelemetry-api>=1.20
17
+ Requires-Dist: openinference-semantic-conventions
18
+ Requires-Dist: charset-normalizer>=3.4
19
+ Requires-Dist: markdown-it-py>=3.0
20
+ Requires-Dist: selectolax>=0.3.21
21
+ Requires-Dist: rapidfuzz>=3.0
22
+ Requires-Dist: scipy>=1.14
23
+ Requires-Dist: langgraph>=1.2 ; extra == 'agents'
24
+ Requires-Dist: deepagents>=0.7.15 ; extra == 'agents'
25
+ Requires-Dist: langchain-openai>=1.0 ; extra == 'agents'
26
+ Requires-Dist: chonkie[code]>=1.7 ; extra == 'chunk-code'
27
+ Requires-Dist: chonkie[neural]>=1.7 ; extra == 'chunk-neural'
28
+ Requires-Dist: chonkie[semantic]>=1.7 ; extra == 'chunk-semantic'
29
+ Requires-Dist: graspologic-native>=1.2.5 ; extra == 'community'
30
+ Requires-Dist: docling>=2.0 ; extra == 'docling'
31
+ Requires-Dist: sentence-transformers>=5 ; extra == 'embed-local'
32
+ Requires-Dist: deepeval>=4.2.6 ; extra == 'eval'
33
+ Requires-Dist: agentevals>=0.0.9 ; extra == 'eval'
34
+ Requires-Dist: er-evaluation>=2.3.0 ; extra == 'eval'
35
+ Requires-Dist: scikit-learn>=1.5 ; extra == 'eval'
36
+ Requires-Dist: langchain-openai>=1.0 ; extra == 'eval'
37
+ Requires-Dist: opentelemetry-sdk>=1.20 ; extra == 'eval'
38
+ Requires-Dist: openinference-instrumentation-langchain>=0.1.76,<0.2 ; extra == 'eval'
39
+ Requires-Dist: gliner2[local] ; extra == 'extract'
40
+ Requires-Dist: transformers<4.56 ; extra == 'extract'
41
+ Requires-Dist: protobuf ; extra == 'extract'
42
+ Requires-Dist: baml-py>=0.226.1,<0.227 ; extra == 'llm'
43
+ Requires-Dist: pymilvus>=3.0.0,<4 ; extra == 'milvus'
44
+ Requires-Dist: neo4j>=5.0 ; extra == 'neo4j'
45
+ Requires-Dist: opentelemetry-sdk>=1.20 ; extra == 'observability'
46
+ Requires-Dist: opentelemetry-exporter-otlp>=1.20 ; extra == 'observability'
47
+ Requires-Dist: opentelemetry-instrumentation-asyncio ; extra == 'observability'
48
+ Requires-Dist: openinference-instrumentation-langchain>=0.1.76,<0.2 ; extra == 'observability'
49
+ Requires-Dist: qdrant-client>=1.12 ; extra == 'qdrant'
50
+ Requires-Dist: fastembed>=0.4 ; extra == 'qdrant'
51
+ Requires-Dist: weaviate-client>=4.9 ; extra == 'weaviate'
52
+ Maintainer: Ashwin Mathur, Varun Mathur
53
+ Maintainer-email: Ashwin Mathur <ashwinm400@gmail.com>, Varun Mathur <varunm500@gmail.com>
54
+ Requires-Python: >=3.11
55
+ Project-URL: Documentation, https://ontogr.github.io/agentic-graphrag/
56
+ Project-URL: Issues, https://github.com/ontogr/agentic-graphrag/issues
57
+ Project-URL: Source, https://github.com/ontogr/agentic-graphrag
58
+ Provides-Extra: agents
59
+ Provides-Extra: chunk-code
60
+ Provides-Extra: chunk-neural
61
+ Provides-Extra: chunk-semantic
62
+ Provides-Extra: community
63
+ Provides-Extra: docling
64
+ Provides-Extra: embed-local
65
+ Provides-Extra: eval
66
+ Provides-Extra: extract
67
+ Provides-Extra: llm
68
+ Provides-Extra: milvus
69
+ Provides-Extra: neo4j
70
+ Provides-Extra: observability
71
+ Provides-Extra: qdrant
72
+ Provides-Extra: weaviate
73
+ Description-Content-Type: text/markdown
74
+
75
+ <h1 align="center"><a href="https://github.com/ontogr/agentic-graphrag">Agentic GraphRAG</a></h1>
76
+
77
+ <div align="center">
78
+
79
+ [![DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/ontogr/agentic-graphrag)
80
+ [![CI](https://img.shields.io/github/actions/workflow/status/ontogr/agentic-graphrag/ci.yml?branch=main&label=CI&logo=githubactions)](https://github.com/ontogr/agentic-graphrag/actions/workflows/ci.yml)
81
+ [![Ruff](https://img.shields.io/github/actions/workflow/status/ontogr/agentic-graphrag/ci.yml?branch=main&label=Ruff&logo=ruff)](https://github.com/ontogr/agentic-graphrag/actions/workflows/ci.yml)
82
+ [![ty](https://img.shields.io/github/actions/workflow/status/ontogr/agentic-graphrag/ci.yml?branch=main&label=ty&logo=python)](https://github.com/ontogr/agentic-graphrag/actions/workflows/ci.yml)
83
+ [![Unit tests](https://img.shields.io/github/actions/workflow/status/ontogr/agentic-graphrag/ci.yml?branch=main&label=unit%20tests&logo=pytest)](https://github.com/ontogr/agentic-graphrag/actions/workflows/ci.yml)
84
+ [![Integration tests](https://img.shields.io/github/actions/workflow/status/ontogr/agentic-graphrag/integration.yml?branch=main&label=integration%20tests&logo=pytest)](https://github.com/ontogr/agentic-graphrag/actions/workflows/integration.yml)
85
+ [![Codecov](https://codecov.io/gh/ontogr/agentic-graphrag/branch/main/graph/badge.svg)](https://codecov.io/gh/ontogr/agentic-graphrag)
86
+ [![PyPI](https://img.shields.io/pypi/v/agentic-graphrag.svg)](https://pypi.org/project/agentic-graphrag/)
87
+ [![Docs](https://img.shields.io/badge/docs-GitHub%20Pages-blue?logo=readthedocs)](https://ontogr.github.io/agentic-graphrag/)
88
+ [![License](https://img.shields.io/github/license/ontogr/agentic-graphrag?color=green)](LICENSE)
89
+
90
+ </div>
91
+
92
+ Agentic GraphRAG is a modular, schema-driven system. It builds knowledge graphs from unstructured and structured data. It retrieves evidence across graph and vector indexes. It answers questions with agentic reasoning.
93
+
94
+ <p align="center">
95
+ <img src="img/agentic_graphrag_pipeline.png" alt="Agentic GraphRAG pipeline from data loading through graph construction, storage, retrieval, and agentic reasoning" width="1200">
96
+ </p>
97
+
98
+ - **One ingestion API** for raw text, files, directories, globs, and prebuilt documents.
99
+ - **Structure-aware loading and chunking** with core text readers, Docling for rich documents, and Chonkie for text chunking.
100
+ - **Schema-driven extraction** with runtime-defined entity types, relation types, and valid graph patterns.
101
+ - **Local-first extraction cascade** using GLiNER 2.5 with type-safe BAML/LLM fallback for weak or ambiguous chunks.
102
+ - **Tiered entity resolution** combining exact, fuzzy, embedding, and LLM-verified matching with fail-safe merge rules.
103
+ - **Auditable graph merges** with field-level conflict handling, relation repointing, provenance union, and soft tombstones.
104
+ - **Pluggable storage** with Neo4j for graph data and native vectors, plus Qdrant, Weaviate, and Milvus/Zilliz for dedicated vector search.
105
+ - **Layered retrieval** across entities, relations, chunks, graph neighborhoods, and community reports, with hybrid fusion and reranking.
106
+ - **Agentic plan–research–verify loop** that decomposes questions, gathers evidence in parallel, checks coverage, and produces cited answers.
107
+ - **OpenTelemetry-native observability** across loading, chunking, extraction, resolution, and storage.
108
+
109
+ The system is built using:
110
+
111
+ - [**Docling**](https://github.com/docling-project/docling) and [**Chonkie**](https://github.com/chonkie-inc/chonkie) for document parsing and chunking.
112
+ - [**GLiNER 2.5**](https://github.com/urchade/GLiNER) for local schema-guided entity and relation extraction.
113
+ - [**BAML**](https://boundaryml.com/) for typed LLM functions and provider-independent client routing.
114
+ - [**Neo4j**](https://neo4j.com/) for the property graph and optional native vector search.
115
+ - [**Qdrant**](https://qdrant.tech/), [**Weaviate**](https://weaviate.io/), and [**Milvus**](https://milvus.io/) for dense and hybrid retrieval.
116
+ - [**Sentence Transformers**](https://www.sbert.net/) and [**FastEmbed**](https://github.com/qdrant/fastembed) for dense and sparse embeddings.
117
+ - [**OpenTelemetry**](https://opentelemetry.io/) for vendor-neutral traces and metrics.
118
+
119
+ ## Knowledge Graph
120
+
121
+ Agentic GraphRAG stores source material, extracted knowledge, and graph summaries in one typed property graph:
122
+
123
+ ```text
124
+ (:Document)<-[:PART_OF]-(:Chunk)-[:MENTIONS]->(:Entity:<Type>)
125
+ (:Chunk)-[:NEXT_CHUNK]->(:Chunk)
126
+ (:Entity)-[:<RELATION_TYPE>]->(:Entity)
127
+ (:Entity)-[:IN_COMMUNITY]->(:Community)
128
+ (:Community)-[:PARENT_COMMUNITY]->(:Community)
129
+ (:Community)-[:HAS_REPORT]->(:CommunityReport)
130
+ ```
131
+
132
+ ### Documents and chunks
133
+
134
+ Documents keep their source URI, format, loader, content hash, and record identity. Text formats use content-based identities; binary Docling formats use raw-byte hashes. Chunks keep stable document links and source provenance:
135
+
136
+ - Text chunks record character and line spans plus their heading path.
137
+ - Layout-aware chunks record page numbers and bounding boxes.
138
+ - Record formats such as CSV, TSV, JSON, and JSON Lines preserve row identity.
139
+
140
+ ### Entities and relations
141
+
142
+ Extraction produces mentions first, not graph nodes. Each mention keeps its source chunk, label, text span, confidence, and extractor provenance. Resolution then assigns canonical identities and merges aliases before storage.
143
+
144
+ Relations are directed subject–predicate–object triples. The active schema constrains valid source type, relation type, and target type combinations. The validation stage removes invalid triples before they reach the graph.
145
+
146
+ ### Communities
147
+
148
+ Hierarchical community detection groups related entities and relations into nested topics. Each community can receive an LLM-generated report with a title, summary, findings, and importance score. Community reports provide broad context without forcing retrieval to return every low-level edge.
149
+
150
+ ### Runtime schemas
151
+
152
+ `GraphSchema` is a first-class runtime value. It defines:
153
+
154
+ - entity types and their descriptions;
155
+ - relation types and their descriptions;
156
+ - valid `(source, relation, target)` patterns;
157
+ - the vocabulary injected into local and LLM extractors.
158
+
159
+ Use the generic preset for open-domain data or provide a schema for a specific domain. The same schema guides extraction, validation, resolution, storage, and query generation.
160
+
161
+ ## Architecture
162
+
163
+ Agentic GraphRAG has two main data flows:
164
+
165
+ ```text
166
+ Ingestion: source -> document -> chunk -> mentions -> resolved graph -> indexes
167
+ Query: question -> plan -> parallel retrieval -> verify -> cited answer
168
+ ```
169
+
170
+ ## Ingestion Pipeline
171
+
172
+ `Graph.add()` is the single entry point for adding content. The complete pipeline is organized into these stages:
173
+
174
+ 1. **Load:** Select a loader by format. Decode or parse the source. Preserve source metadata. Apply `RAISE`, `SKIP`, or `QUARANTINE` as the error policy for each source.
175
+ 2. **Chunk:** Use Docling's layout-aware chunking before flattening rich documents; use Chonkie for text and record documents.
176
+ 3. **Extract:** Run GLiNER locally against the active schema. Escalate weak results to a typed BAML extraction function when configured.
177
+ 4. **Validate:** Drop entities and triples that do not conform to the schema.
178
+ 5. **Resolve:** Apply exact, fuzzy, embedding, and LLM-verified comparison tiers. Ambiguous or failed comparisons do not merge.
179
+ 6. **Merge:** Resolve properties field by field. Combine provenance. Deduplicate repointed relations. Retain an audit trail.
180
+ 7. **Store:** Upsert canonical nodes and relations, then populate graph-native or dedicated vector indexes.
181
+
182
+ The extraction cascade replaces a weak local result with the LLM result instead of combining two conflicting outputs. Exact matches use global store-backed lookup; more expensive fuzzy and LLM comparisons are blocked to a smaller candidate set.
183
+
184
+ `Graph.consolidate()` provides a separate whole-graph reconciliation pass for duplicates found across ingestion runs. It is dry-run by default so applications can inspect proposed merges before applying them.
185
+
186
+ ## Embeddings and Storage
187
+
188
+ The async `Embedder`, `GraphStore`, and `VectorStore` interfaces keep model and database choices outside graph-construction logic.
189
+
190
+ ### Embeddings
191
+
192
+ - Dense embeddings through Sentence Transformers.
193
+ - Sparse BM25 embeddings through FastEmbed.
194
+ - Batch-first async APIs with optional content-addressed caching by text and model.
195
+ - Dimension checks before collections or indexes accept vectors.
196
+
197
+ ### Graph storage
198
+
199
+ The Neo4j backend supports local Neo4j and Aura over Bolt, managed read/write transactions, node and relation upserts, constraints, indexes, and native dense vector search. The query builders validate dynamic labels and relation types before they interpolate them into Cypher.
200
+
201
+ ### Vector storage
202
+
203
+ | Backend | Dense search | Hybrid search | Deployment |
204
+ | --- | --- | --- | --- |
205
+ | Neo4j | Yes | No | Local or Aura |
206
+ | Qdrant | Yes | Dense + sparse fusion | Local or Cloud |
207
+ | Weaviate | Yes | Native BM25/vector weighting | Custom or Cloud |
208
+ | Milvus / Zilliz | Yes | Dense + BM25 fusion | Local or Cloud |
209
+
210
+ All dedicated vector stores share collection lifecycle, batch upsert, retrieval, scrolling, counting, deletion, filtering, dense search, and hybrid search. Filters use exact scalar matches, OR within a list value, and AND across keys.
211
+
212
+ ## Retrieval Pipeline
213
+
214
+ Retrieval composes small search methods into retrievers, runs them concurrently, and fuses their results through data-only recipes.
215
+
216
+ - **Entity retrieval** finds canonical entities by dense or hybrid search and can expand matched seeds with bounded graph traversal.
217
+ - **Relation retrieval** searches relation representations and hydrates full subject–predicate–object edges from the graph.
218
+ - **Chunk retrieval** returns source passages with document and span provenance.
219
+ - **Community retrieval** searches community reports for thematic and corpus-wide questions.
220
+ - **Text-to-Cypher retrieval** generates a schema-aware, read-only query with bounded retries.
221
+ - **Graph traversal** uses bounded, degree-aware breadth-first search to collect connected evidence.
222
+
223
+ | Recipe | Search methods | Fusion |
224
+ | --- | --- | --- |
225
+ | `entity`, `relation`, `chunk`, `community` | One focused retriever | Reciprocal Rank Fusion |
226
+ | `hybrid_rrf` | Entity + relation + chunk + community | Reciprocal Rank Fusion |
227
+ | `hybrid_cross_encoder` | All semantic retrievers + graph expansion | Cross-encoder |
228
+ | `bfs_expand` | Entity seeds + bounded graph traversal | Reciprocal Rank Fusion |
229
+ | `text2cypher` | Schema-aware Cypher | Reciprocal Rank Fusion |
230
+
231
+ Reciprocal Rank Fusion, cross-encoder, maximal marginal relevance, and graph-distance rerankers cover different query needs. A recipe can ignore an empty search branch and still return evidence from the remaining methods.
232
+
233
+ ## Agentic RAG Loop
234
+
235
+ The agent coordinates three roles around the retrieval layer:
236
+
237
+ - **Planner:** decomposes a question into focused sub-questions and selects a retrieval recipe for each.
238
+ - **Researcher:** runs sub-questions in parallel across entity, relation, chunk, community, graph, and Cypher tools; every evidence item keeps its citation.
239
+ - **Verifier:** scores coverage and evidence depth, lists unsupported claims, and proposes targeted follow-up searches.
240
+
241
+ If the evidence gate fails, the missing items seed another research round. When the gate passes, or the iteration limit is reached, the orchestrator produces a structured answer with citations, confidence, caveats, and an answerability flag.
242
+
243
+ ## Structured LLM Output
244
+
245
+ BAML defines typed extraction, entity-comparison, community-summary, planning, verification, and answer contracts. Runtime client registries support a single provider, fallback chains, or round-robin routing across OpenAI, Anthropic, AWS Bedrock, Google AI, Vertex AI, Azure OpenAI, and OpenAI-compatible endpoints.
246
+
247
+ ## Observability and Failure Handling
248
+
249
+ OpenTelemetry API support is part of the core package; exporters and the SDK are optional. Applications can send traces to any OTLP-compatible backend.
250
+
251
+ Long-running graph builds report bounded, structured stage statistics for ingestion, extraction, resolution, merging, and storage. Failures include the affected item, error type, message, and trace/span IDs. Full detail remains in the trace backend so result objects stay bounded on large corpora.
252
+
253
+ ## Installation
254
+
255
+ Agentic GraphRAG requires Python 3.11 or newer.
256
+
257
+ ```bash
258
+ uv pip install agentic-graphrag
259
+ ```
260
+
261
+ Install only the integrations you use:
262
+
263
+ ```bash
264
+ # Rich documents and local extraction
265
+ uv pip install "agentic-graphrag[docling,extract]"
266
+
267
+ # LLM extraction and local dense embeddings
268
+ uv pip install "agentic-graphrag[llm,embed-local]"
269
+
270
+ # Neo4j with a dedicated Qdrant vector store and OTLP tracing
271
+ uv pip install "agentic-graphrag[neo4j,qdrant,observability]"
272
+
273
+ # Hierarchical community detection
274
+ uv pip install "agentic-graphrag[community]"
275
+ ```
276
+
277
+ | Extra | Adds |
278
+ | --- | --- |
279
+ | `docling` | PDF, DOCX, PPTX, image, XML, and layout-aware parsing |
280
+ | `extract` | Local GLiNER 2.5 extraction |
281
+ | `llm` | BAML-powered extraction and verification |
282
+ | `embed-local` | Sentence Transformers dense embeddings |
283
+ | `neo4j` | Neo4j graph storage and native vector search |
284
+ | `qdrant` | Qdrant dense and hybrid search |
285
+ | `weaviate` | Weaviate dense and hybrid search |
286
+ | `milvus` | Milvus/Zilliz dense and hybrid search |
287
+ | `observability` | OpenTelemetry SDK and OTLP export |
288
+ | `community` | Hierarchical Leiden community detection |
289
+
290
+ ## Usage
291
+
292
+ ### Ingest files and text
293
+
294
+ ```python
295
+ import asyncio
296
+
297
+ from agrag.ingestion import Graph
298
+
299
+
300
+ async def main() -> None:
301
+ graph = await Graph.open()
302
+
303
+ files = await graph.add(source="./corpus/**/*.md", return_chunks=True)
304
+ text = await graph.add(
305
+ text="Agentic GraphRAG turns evidence into a graph.",
306
+ return_chunks=True,
307
+ )
308
+
309
+ print(files.ingestion.documents, len(files.chunks))
310
+ print(text.ingestion.documents, len(text.chunks))
311
+
312
+
313
+ asyncio.run(main())
314
+ ```
315
+
316
+ `Graph.add()` accepts exactly one of:
317
+
318
+ - `source=` — a file, directory, glob, or list of paths;
319
+ - `text=` — raw text as one document;
320
+ - `documents=` — prebuilt `Document` objects.
321
+
322
+ ### Handle source failures
323
+
324
+ ```python
325
+ from agrag.loaders.corpus.types import ErrorPolicy
326
+
327
+ result = await graph.add(
328
+ source="./corpus",
329
+ error_policy=ErrorPolicy.QUARANTINE,
330
+ )
331
+
332
+ for item in result.ingestion.quarantined_items:
333
+ print(item.item_id, item.error_message)
334
+ ```
335
+
336
+ See the [documentation](https://ontogr.github.io/agentic-graphrag/) for guides and the generated API reference.
337
+
338
+ ## Supported Formats
339
+
340
+ | Format | Extension(s) | Loader |
341
+ | --- | --- | --- |
342
+ | Plain text and logs | `.txt`, `.log` | Core |
343
+ | Markdown | `.md`, `.markdown` | Core |
344
+ | AsciiDoc | `.adoc`, `.asciidoc` | Docling, with core fallback |
345
+ | HTML | `.html`, `.htm` | Core |
346
+ | CSV / TSV | `.csv`, `.tsv` | Core, one document per row |
347
+ | JSON | `.json` | Core, record-aware |
348
+ | JSON Lines | `.jsonl`, `.ndjson` | Core, one document per row |
349
+ | PDF | `.pdf` | Docling |
350
+ | Word | `.docx` | Docling |
351
+ | PowerPoint | `.pptx` | Docling |
352
+ | Images | `.png`, `.jpg`, `.jpeg`, `.tif`, `.tiff`, `.bmp` | Docling |
353
+ | XML | `.xml` | Docling or the core XML reader |
354
+
355
+ Core loaders remain the default for Markdown, HTML, CSV, TSV, and JSON records. Docling takes precedence for layout-rich documents and AsciiDoc when installed.
356
+
357
+ ## Project Structure
358
+
359
+ ```text
360
+ agrag/
361
+ ├── common/data_models/ # documents, chunks, schemas, extraction and storage records
362
+ ├── chunking/ # Chonkie and Docling chunk adapters
363
+ ├── loaders/ # core corpus readers and optional Docling loader
364
+ ├── ingestion/ # Graph API, extraction, resolution, merge and pipeline stages
365
+ ├── embedding/ # dense and sparse embedding interfaces
366
+ ├── graphdb/ # graph-store interface and Neo4j backend
367
+ ├── vectordb/ # vector-store interface and Qdrant/Weaviate/Milvus backends
368
+ ├── cypher/ # validated Cypher builders
369
+ ├── retrieval/ # search methods, retrievers, recipes and rerankers
370
+ ├── agents/ # planner, researcher, verifier and answer synthesis
371
+ ├── communities/ # hierarchical detection and report generation
372
+ ├── llm/ # BAML sources, generated client and provider routing
373
+ └── observability.py # OpenTelemetry helpers
374
+
375
+ tests/
376
+ ├── unit/ # isolated tests with external services mocked
377
+ └── integration/ # live backend tests against Docker services
378
+ ```
379
+
380
+ ## Development
381
+
382
+ ```bash
383
+ git clone https://github.com/ontogr/agentic-graphrag.git
384
+ cd agentic-graphrag
385
+ make sync
386
+ make lint-check
387
+ make lint-typing
388
+ make test
389
+ ```
390
+
391
+ Integration tests run against local Neo4j, Qdrant, Weaviate, and Milvus services:
392
+
393
+ ```bash
394
+ make dev-services-up
395
+ make test-integration
396
+ make dev-services-down
397
+ ```
398
+
399
+ ## Contributing
400
+
401
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for the development workflow, test conventions, and pull request guidelines.
402
+
403
+ ## References
404
+
405
+ - [Microsoft GraphRAG](https://arxiv.org/abs/2404.16130) — hierarchical communities and community reports
406
+ - [Graphiti](https://github.com/getzep/graphiti) — layered graph search and entity-aware retrieval
407
+ - [Cognee](https://github.com/topoteretes/cognee) — data pipelines, graph memory, and consolidation
408
+ - [KG-Gen](https://github.com/stair-lab/kg-gen) — knowledge-graph extraction and alias deduplication
409
+ - [FalkorDB GraphRAG SDK](https://github.com/FalkorDB/GraphRAG-SDK) — graph-native retrieval and entity resolution
410
+ - [Neo4j GraphRAG](https://github.com/neo4j/neo4j-graphrag-python) — Neo4j retrieval and vector integration
411
+ - [LightRAG](https://github.com/HKUDS/LightRAG) — graph and vector retrieval
412
+ - [PathRAG](https://github.com/BUPT-GAMMA/PathRAG) — relational-path retrieval
413
+ - [GLiNER](https://arxiv.org/abs/2311.08526) — generalist zero-shot information extraction
414
+ - [BAML](https://boundaryml.com/), [Docling](https://github.com/docling-project/docling), and [Chonkie](https://github.com/chonkie-inc/chonkie)
415
+
416
+ ## License
417
+
418
+ This project is licensed under the [Apache License 2.0](LICENSE).