haive-agents 1.0.0__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 (481) hide show
  1. haive_agents-1.0.0/PKG-INFO +1011 -0
  2. haive_agents-1.0.0/README.md +987 -0
  3. haive_agents-1.0.0/pyproject.toml +75 -0
  4. haive_agents-1.0.0/src/haive/agents/README.md +525 -0
  5. haive_agents-1.0.0/src/haive/agents/__init__.py +103 -0
  6. haive_agents-1.0.0/src/haive/agents/base/__init__.py +364 -0
  7. haive_agents-1.0.0/src/haive/agents/base/agent.py +808 -0
  8. haive_agents-1.0.0/src/haive/agents/base/agent_structured_output_mixin.py +273 -0
  9. haive_agents-1.0.0/src/haive/agents/base/debug_utils.py +263 -0
  10. haive_agents-1.0.0/src/haive/agents/base/hooks.py +652 -0
  11. haive_agents-1.0.0/src/haive/agents/base/mixins/__init__.py +15 -0
  12. haive_agents-1.0.0/src/haive/agents/base/mixins/agent_protocol.py +91 -0
  13. haive_agents-1.0.0/src/haive/agents/base/mixins/execution_mixin.py +972 -0
  14. haive_agents-1.0.0/src/haive/agents/base/mixins/persistence_mixin.py +475 -0
  15. haive_agents-1.0.0/src/haive/agents/base/mixins/state_mixin.py +363 -0
  16. haive_agents-1.0.0/src/haive/agents/base/pre_post_agent_mixin.py +561 -0
  17. haive_agents-1.0.0/src/haive/agents/base/serialization_mixin.py +153 -0
  18. haive_agents-1.0.0/src/haive/agents/base/structured_output_handler.py +245 -0
  19. haive_agents-1.0.0/src/haive/agents/base/types.py +205 -0
  20. haive_agents-1.0.0/src/haive/agents/base/workflow.py +116 -0
  21. haive_agents-1.0.0/src/haive/agents/base.py +38 -0
  22. haive_agents-1.0.0/src/haive/agents/chain/__init__.py +213 -0
  23. haive_agents-1.0.0/src/haive/agents/chain/chain_examples.py +232 -0
  24. haive_agents-1.0.0/src/haive/agents/chain/declarative_chain.py +175 -0
  25. haive_agents-1.0.0/src/haive/agents/common/models/__init__.py +5 -0
  26. haive_agents-1.0.0/src/haive/agents/common/models/grade/__init__.py +50 -0
  27. haive_agents-1.0.0/src/haive/agents/common/models/grade/base.py +277 -0
  28. haive_agents-1.0.0/src/haive/agents/common/models/grade/binary.py +237 -0
  29. haive_agents-1.0.0/src/haive/agents/common/models/grade/composite.py +446 -0
  30. haive_agents-1.0.0/src/haive/agents/common/models/grade/letter_grade.py +402 -0
  31. haive_agents-1.0.0/src/haive/agents/common/models/grade/numeric.py +315 -0
  32. haive_agents-1.0.0/src/haive/agents/common/models/grade/qualitative.py +421 -0
  33. haive_agents-1.0.0/src/haive/agents/common/models/grade/rubric.py +439 -0
  34. haive_agents-1.0.0/src/haive/agents/common/models/grade/scale.py +422 -0
  35. haive_agents-1.0.0/src/haive/agents/common/models/mixins.py +14 -0
  36. haive_agents-1.0.0/src/haive/agents/common/models/task_analysis/__init__.py +120 -0
  37. haive_agents-1.0.0/src/haive/agents/common/models/task_analysis/analysis.py +835 -0
  38. haive_agents-1.0.0/src/haive/agents/common/models/task_analysis/base.py +700 -0
  39. haive_agents-1.0.0/src/haive/agents/common/models/task_analysis/branching.py +603 -0
  40. haive_agents-1.0.0/src/haive/agents/common/models/task_analysis/parallelization.py +946 -0
  41. haive_agents-1.0.0/src/haive/agents/common/models/task_analysis/solvability.py +444 -0
  42. haive_agents-1.0.0/src/haive/agents/config.py +0 -0
  43. haive_agents-1.0.0/src/haive/agents/conversation/__init__.py +861 -0
  44. haive_agents-1.0.0/src/haive/agents/conversation/base/__init__.py +9 -0
  45. haive_agents-1.0.0/src/haive/agents/conversation/base/agent.py +611 -0
  46. haive_agents-1.0.0/src/haive/agents/conversation/base/state.py +318 -0
  47. haive_agents-1.0.0/src/haive/agents/conversation/collaberative/__init__.py +20 -0
  48. haive_agents-1.0.0/src/haive/agents/conversation/collaberative/agent.py +468 -0
  49. haive_agents-1.0.0/src/haive/agents/conversation/collaberative/state.py +78 -0
  50. haive_agents-1.0.0/src/haive/agents/conversation/debate/__init__.py +13 -0
  51. haive_agents-1.0.0/src/haive/agents/conversation/debate/agent.py +574 -0
  52. haive_agents-1.0.0/src/haive/agents/conversation/debate/state.py +189 -0
  53. haive_agents-1.0.0/src/haive/agents/conversation/directed/__init__.py +25 -0
  54. haive_agents-1.0.0/src/haive/agents/conversation/directed/agent.py +527 -0
  55. haive_agents-1.0.0/src/haive/agents/conversation/directed/state.py +23 -0
  56. haive_agents-1.0.0/src/haive/agents/conversation/round_robin/__init__.py +10 -0
  57. haive_agents-1.0.0/src/haive/agents/conversation/round_robin/agent.py +150 -0
  58. haive_agents-1.0.0/src/haive/agents/conversation/social_media/__init__.py +23 -0
  59. haive_agents-1.0.0/src/haive/agents/conversation/social_media/agent.py +400 -0
  60. haive_agents-1.0.0/src/haive/agents/conversation/social_media/models.py +60 -0
  61. haive_agents-1.0.0/src/haive/agents/conversation/social_media/state.py +36 -0
  62. haive_agents-1.0.0/src/haive/agents/discovery/__init__.py +73 -0
  63. haive_agents-1.0.0/src/haive/agents/discovery/component_discovery_agent.py +485 -0
  64. haive_agents-1.0.0/src/haive/agents/discovery/dynamic_tool_selector.py +674 -0
  65. haive_agents-1.0.0/src/haive/agents/discovery/selection_strategies.py +591 -0
  66. haive_agents-1.0.0/src/haive/agents/discovery/semantic_discovery.py +567 -0
  67. haive_agents-1.0.0/src/haive/agents/document_loader/__init__.py +18 -0
  68. haive_agents-1.0.0/src/haive/agents/document_loader/base/__init__.py +5 -0
  69. haive_agents-1.0.0/src/haive/agents/document_loader/base/agent.py +164 -0
  70. haive_agents-1.0.0/src/haive/agents/document_loader/directory/__init__.py +5 -0
  71. haive_agents-1.0.0/src/haive/agents/document_loader/directory/agent.py +73 -0
  72. haive_agents-1.0.0/src/haive/agents/document_loader/examples/__init__.py +17 -0
  73. haive_agents-1.0.0/src/haive/agents/document_loader/examples/usage_examples.py +182 -0
  74. haive_agents-1.0.0/src/haive/agents/document_loader/file/__init__.py +5 -0
  75. haive_agents-1.0.0/src/haive/agents/document_loader/file/agent.py +61 -0
  76. haive_agents-1.0.0/src/haive/agents/document_loader/tests/__init__.py +1 -0
  77. haive_agents-1.0.0/src/haive/agents/document_loader/web/__init__.py +5 -0
  78. haive_agents-1.0.0/src/haive/agents/document_loader/web/agent.py +70 -0
  79. haive_agents-1.0.0/src/haive/agents/document_modifiers/__init__.py +76 -0
  80. haive_agents-1.0.0/src/haive/agents/document_modifiers/base/__init__.py +15 -0
  81. haive_agents-1.0.0/src/haive/agents/document_modifiers/base/models/__init__.py +17 -0
  82. haive_agents-1.0.0/src/haive/agents/document_modifiers/base/state.py +223 -0
  83. haive_agents-1.0.0/src/haive/agents/document_modifiers/base/utils.py +58 -0
  84. haive_agents-1.0.0/src/haive/agents/document_modifiers/complex_extraction/__init__.py +64 -0
  85. haive_agents-1.0.0/src/haive/agents/document_modifiers/complex_extraction/agent.py +991 -0
  86. haive_agents-1.0.0/src/haive/agents/document_modifiers/complex_extraction/config.py +62 -0
  87. haive_agents-1.0.0/src/haive/agents/document_modifiers/complex_extraction/factory.py +79 -0
  88. haive_agents-1.0.0/src/haive/agents/document_modifiers/complex_extraction/models.py +67 -0
  89. haive_agents-1.0.0/src/haive/agents/document_modifiers/complex_extraction/state.py +43 -0
  90. haive_agents-1.0.0/src/haive/agents/document_modifiers/complex_extraction/utils.py +159 -0
  91. haive_agents-1.0.0/src/haive/agents/document_modifiers/kg/__init__.py +38 -0
  92. haive_agents-1.0.0/src/haive/agents/document_modifiers/kg/kg_base/__init__.py +13 -0
  93. haive_agents-1.0.0/src/haive/agents/document_modifiers/kg/kg_base/models.py +201 -0
  94. haive_agents-1.0.0/src/haive/agents/document_modifiers/kg/kg_iterative_refinement/__init__.py +32 -0
  95. haive_agents-1.0.0/src/haive/agents/document_modifiers/kg/kg_iterative_refinement/agent.py +368 -0
  96. haive_agents-1.0.0/src/haive/agents/document_modifiers/kg/kg_iterative_refinement/config.py +21 -0
  97. haive_agents-1.0.0/src/haive/agents/document_modifiers/kg/kg_iterative_refinement/state.py +55 -0
  98. haive_agents-1.0.0/src/haive/agents/document_modifiers/kg/kg_iterative_refinement/utils.py +6 -0
  99. haive_agents-1.0.0/src/haive/agents/document_modifiers/kg/kg_map_merge/__init__.py +35 -0
  100. haive_agents-1.0.0/src/haive/agents/document_modifiers/kg/kg_map_merge/agent.py +431 -0
  101. haive_agents-1.0.0/src/haive/agents/document_modifiers/kg/kg_map_merge/config.py +114 -0
  102. haive_agents-1.0.0/src/haive/agents/document_modifiers/kg/kg_map_merge/engines.py +299 -0
  103. haive_agents-1.0.0/src/haive/agents/document_modifiers/kg/kg_map_merge/models.py +179 -0
  104. haive_agents-1.0.0/src/haive/agents/document_modifiers/kg/kg_map_merge/state.py +52 -0
  105. haive_agents-1.0.0/src/haive/agents/document_modifiers/kg/kg_map_merge/utils.py +159 -0
  106. haive_agents-1.0.0/src/haive/agents/document_modifiers/summarizer/__init__.py +17 -0
  107. haive_agents-1.0.0/src/haive/agents/document_modifiers/summarizer/iterative_refinement/__init__.py +28 -0
  108. haive_agents-1.0.0/src/haive/agents/document_modifiers/summarizer/iterative_refinement/agent.py +78 -0
  109. haive_agents-1.0.0/src/haive/agents/document_modifiers/summarizer/iterative_refinement/config.py +40 -0
  110. haive_agents-1.0.0/src/haive/agents/document_modifiers/summarizer/iterative_refinement/engines.py +33 -0
  111. haive_agents-1.0.0/src/haive/agents/document_modifiers/summarizer/iterative_refinement/state.py +55 -0
  112. haive_agents-1.0.0/src/haive/agents/document_modifiers/summarizer/map_branch/__init__.py +15 -0
  113. haive_agents-1.0.0/src/haive/agents/document_modifiers/summarizer/map_branch/agent.py +517 -0
  114. haive_agents-1.0.0/src/haive/agents/document_modifiers/summarizer/map_branch/config.py +51 -0
  115. haive_agents-1.0.0/src/haive/agents/document_modifiers/summarizer/map_branch/engines.py +17 -0
  116. haive_agents-1.0.0/src/haive/agents/document_modifiers/summarizer/map_branch/prompts.py +14 -0
  117. haive_agents-1.0.0/src/haive/agents/document_modifiers/summarizer/map_branch/state.py +56 -0
  118. haive_agents-1.0.0/src/haive/agents/document_modifiers/tnt/__init__.py +47 -0
  119. haive_agents-1.0.0/src/haive/agents/document_modifiers/tnt/agent.py +298 -0
  120. haive_agents-1.0.0/src/haive/agents/document_modifiers/tnt/branches.py +44 -0
  121. haive_agents-1.0.0/src/haive/agents/document_modifiers/tnt/engines.py +520 -0
  122. haive_agents-1.0.0/src/haive/agents/document_modifiers/tnt/models.py +76 -0
  123. haive_agents-1.0.0/src/haive/agents/document_modifiers/tnt/state.py +72 -0
  124. haive_agents-1.0.0/src/haive/agents/document_modifiers/tnt/utils.py +290 -0
  125. haive_agents-1.0.0/src/haive/agents/document_processing/__init__.py +15 -0
  126. haive_agents-1.0.0/src/haive/agents/document_processing/agent.py +923 -0
  127. haive_agents-1.0.0/src/haive/agents/document_processing/examples/__init__.py +1 -0
  128. haive_agents-1.0.0/src/haive/agents/document_processing/examples/comprehensive_query_example.py +393 -0
  129. haive_agents-1.0.0/src/haive/agents/dynamic_supervisor/__init__.py +8 -0
  130. haive_agents-1.0.0/src/haive/agents/dynamic_supervisor/agent.py +219 -0
  131. haive_agents-1.0.0/src/haive/agents/dynamic_supervisor/models.py +245 -0
  132. haive_agents-1.0.0/src/haive/agents/dynamic_supervisor/prompts.py +197 -0
  133. haive_agents-1.0.0/src/haive/agents/dynamic_supervisor/state.py +318 -0
  134. haive_agents-1.0.0/src/haive/agents/dynamic_supervisor/tools.py +341 -0
  135. haive_agents-1.0.0/src/haive/agents/graphs.py +294 -0
  136. haive_agents-1.0.0/src/haive/agents/long_term_memory/__init__.py +25 -0
  137. haive_agents-1.0.0/src/haive/agents/long_term_memory/agent.py +77 -0
  138. haive_agents-1.0.0/src/haive/agents/long_term_memory/aug_llm.py +68 -0
  139. haive_agents-1.0.0/src/haive/agents/long_term_memory/models.py +9 -0
  140. haive_agents-1.0.0/src/haive/agents/long_term_memory/nodes.py +28 -0
  141. haive_agents-1.0.0/src/haive/agents/long_term_memory/state.py +12 -0
  142. haive_agents-1.0.0/src/haive/agents/long_term_memory/tools.py +71 -0
  143. haive_agents-1.0.0/src/haive/agents/memory/DESIGN.md +111 -0
  144. haive_agents-1.0.0/src/haive/agents/memory/__init__.py +15 -0
  145. haive_agents-1.0.0/src/haive/agents/memory/agent.py +625 -0
  146. haive_agents-1.0.0/src/haive/agents/memory/core/__init__.py +25 -0
  147. haive_agents-1.0.0/src/haive/agents/memory/core/classifier.py +518 -0
  148. haive_agents-1.0.0/src/haive/agents/memory/core/stores.py +679 -0
  149. haive_agents-1.0.0/src/haive/agents/memory/core/types.py +260 -0
  150. haive_agents-1.0.0/src/haive/agents/memory/kg_store.py +340 -0
  151. haive_agents-1.0.0/src/haive/agents/memory/models.py +82 -0
  152. haive_agents-1.0.0/src/haive/agents/memory/neo4j_schema.py +166 -0
  153. haive_agents-1.0.0/src/haive/agents/memory/state.py +36 -0
  154. haive_agents-1.0.0/src/haive/agents/memory/tools.py +133 -0
  155. haive_agents-1.0.0/src/haive/agents/multi/__init__.py +510 -0
  156. haive_agents-1.0.0/src/haive/agents/multi/agent.py +919 -0
  157. haive_agents-1.0.0/src/haive/agents/multi/base/__init__.py +17 -0
  158. haive_agents-1.0.0/src/haive/agents/multi/base/agent.py +98 -0
  159. haive_agents-1.0.0/src/haive/agents/multi/base.py +46 -0
  160. haive_agents-1.0.0/src/haive/agents/multi/core/__init__.py +5 -0
  161. haive_agents-1.0.0/src/haive/agents/multi/core/clean_multi_agent.py +651 -0
  162. haive_agents-1.0.0/src/haive/agents/multi/simple/__init__.py +5 -0
  163. haive_agents-1.0.0/src/haive/agents/multi/simple/agent.py +114 -0
  164. haive_agents-1.0.0/src/haive/agents/multi/utils/__init__.py +21 -0
  165. haive_agents-1.0.0/src/haive/agents/multi/utils/compatibility.py +55 -0
  166. haive_agents-1.0.0/src/haive/agents/planning/__init__.py +17 -0
  167. haive_agents-1.0.0/src/haive/agents/planning/base/__init__.py +34 -0
  168. haive_agents-1.0.0/src/haive/agents/planning/base/agents/__init__.py +17 -0
  169. haive_agents-1.0.0/src/haive/agents/planning/base/agents/planner.py +403 -0
  170. haive_agents-1.0.0/src/haive/agents/planning/base/models.py +1264 -0
  171. haive_agents-1.0.0/src/haive/agents/planning/base/prompts.py +375 -0
  172. haive_agents-1.0.0/src/haive/agents/planning/llm_compiler/__init__.py +13 -0
  173. haive_agents-1.0.0/src/haive/agents/planning/llm_compiler/agent.py +299 -0
  174. haive_agents-1.0.0/src/haive/agents/planning/llm_compiler/dag_models.py +64 -0
  175. haive_agents-1.0.0/src/haive/agents/planning/llm_compiler/state.py +28 -0
  176. haive_agents-1.0.0/src/haive/agents/planning/models/__init__.py +39 -0
  177. haive_agents-1.0.0/src/haive/agents/planning/models/base.py +711 -0
  178. haive_agents-1.0.0/src/haive/agents/planning/plan_and_execute/__init__.py +16 -0
  179. haive_agents-1.0.0/src/haive/agents/planning/plan_and_execute/models.py +101 -0
  180. haive_agents-1.0.0/src/haive/agents/planning/plan_and_execute/v2/__init__.py +21 -0
  181. haive_agents-1.0.0/src/haive/agents/planning/plan_and_execute/v2/agent.py +66 -0
  182. haive_agents-1.0.0/src/haive/agents/planning/plan_and_execute/v2/models.py +88 -0
  183. haive_agents-1.0.0/src/haive/agents/planning/plan_and_execute/v2/prompts.py +45 -0
  184. haive_agents-1.0.0/src/haive/agents/planning/plan_and_execute/v2/state.py +37 -0
  185. haive_agents-1.0.0/src/haive/agents/planning/rewoo/__init__.py +9 -0
  186. haive_agents-1.0.0/src/haive/agents/planning/rewoo/agent.py +253 -0
  187. haive_agents-1.0.0/src/haive/agents/planning/rewoo/agents/__init__.py +8 -0
  188. haive_agents-1.0.0/src/haive/agents/planning/rewoo/models/__init__.py +25 -0
  189. haive_agents-1.0.0/src/haive/agents/planning/rewoo/models/join_step.py +539 -0
  190. haive_agents-1.0.0/src/haive/agents/planning/rewoo/models/plans.py +162 -0
  191. haive_agents-1.0.0/src/haive/agents/planning/rewoo/models/steps.py +85 -0
  192. haive_agents-1.0.0/src/haive/agents/planning/rewoo/models/tool_step.py +241 -0
  193. haive_agents-1.0.0/src/haive/agents/rag/__init__.py +23 -0
  194. haive_agents-1.0.0/src/haive/agents/rag/adaptive/__init__.py +1 -0
  195. haive_agents-1.0.0/src/haive/agents/rag/adaptive/agent.py +184 -0
  196. haive_agents-1.0.0/src/haive/agents/rag/adaptive_tools/__init__.py +5 -0
  197. haive_agents-1.0.0/src/haive/agents/rag/adaptive_tools/agent.py +619 -0
  198. haive_agents-1.0.0/src/haive/agents/rag/agentic/__init__.py +5 -0
  199. haive_agents-1.0.0/src/haive/agents/rag/agentic/agent.py +367 -0
  200. haive_agents-1.0.0/src/haive/agents/rag/agentic_router/__init__.py +5 -0
  201. haive_agents-1.0.0/src/haive/agents/rag/agentic_router/agent.py +669 -0
  202. haive_agents-1.0.0/src/haive/agents/rag/base/__init__.py +23 -0
  203. haive_agents-1.0.0/src/haive/agents/rag/base/agent.py +100 -0
  204. haive_agents-1.0.0/src/haive/agents/rag/base/config.py +65 -0
  205. haive_agents-1.0.0/src/haive/agents/rag/base/models.py +25 -0
  206. haive_agents-1.0.0/src/haive/agents/rag/base/prompts.py +34 -0
  207. haive_agents-1.0.0/src/haive/agents/rag/base/state.py +20 -0
  208. haive_agents-1.0.0/src/haive/agents/rag/common/answer_generators/__init__.py +17 -0
  209. haive_agents-1.0.0/src/haive/agents/rag/common/answer_generators/prompts.py +81 -0
  210. haive_agents-1.0.0/src/haive/agents/rag/common/document_graders/__init__.py +26 -0
  211. haive_agents-1.0.0/src/haive/agents/rag/common/document_graders/binary_grader/__init__.py +17 -0
  212. haive_agents-1.0.0/src/haive/agents/rag/common/document_graders/binary_grader/prompt.py +33 -0
  213. haive_agents-1.0.0/src/haive/agents/rag/common/document_graders/comprehensive_grader/__init__.py +1 -0
  214. haive_agents-1.0.0/src/haive/agents/rag/common/document_graders/comprehensive_grader/models.py +0 -0
  215. haive_agents-1.0.0/src/haive/agents/rag/common/document_graders/comprehensive_grader/prompt.py +53 -0
  216. haive_agents-1.0.0/src/haive/agents/rag/common/document_graders/comprehensive_grader.py +289 -0
  217. haive_agents-1.0.0/src/haive/agents/rag/common/document_graders/models.py +87 -0
  218. haive_agents-1.0.0/src/haive/agents/rag/common/hallucination_graders/__init__.py +15 -0
  219. haive_agents-1.0.0/src/haive/agents/rag/common/hallucination_graders/models.py +81 -0
  220. haive_agents-1.0.0/src/haive/agents/rag/common/hallucination_graders/prompts.py +97 -0
  221. haive_agents-1.0.0/src/haive/agents/rag/common/query_constructors/flare/__init__.py +5 -0
  222. haive_agents-1.0.0/src/haive/agents/rag/common/query_constructors/flare/models.py +42 -0
  223. haive_agents-1.0.0/src/haive/agents/rag/common/query_constructors/flare/prompt.py +0 -0
  224. haive_agents-1.0.0/src/haive/agents/rag/common/query_constructors/hyde/__init__.py +29 -0
  225. haive_agents-1.0.0/src/haive/agents/rag/common/query_constructors/hyde/enhanced_prompts.py +511 -0
  226. haive_agents-1.0.0/src/haive/agents/rag/common/query_constructors/hyde/models.py +38 -0
  227. haive_agents-1.0.0/src/haive/agents/rag/common/query_constructors/hyde/prompt.py +53 -0
  228. haive_agents-1.0.0/src/haive/agents/rag/common/query_refinement/__init__.py +5 -0
  229. haive_agents-1.0.0/src/haive/agents/rag/common/query_refinement/models.py +36 -0
  230. haive_agents-1.0.0/src/haive/agents/rag/common/query_refinement/prompt.py +55 -0
  231. haive_agents-1.0.0/src/haive/agents/rag/corrective/__init__.py +5 -0
  232. haive_agents-1.0.0/src/haive/agents/rag/corrective/agent.py +125 -0
  233. haive_agents-1.0.0/src/haive/agents/rag/db_rag/__init__.py +10 -0
  234. haive_agents-1.0.0/src/haive/agents/rag/db_rag/graph_db/__init__.py +86 -0
  235. haive_agents-1.0.0/src/haive/agents/rag/db_rag/graph_db/agent.py +915 -0
  236. haive_agents-1.0.0/src/haive/agents/rag/db_rag/graph_db/config.py +411 -0
  237. haive_agents-1.0.0/src/haive/agents/rag/db_rag/graph_db/engines.py +251 -0
  238. haive_agents-1.0.0/src/haive/agents/rag/db_rag/graph_db/models.py +349 -0
  239. haive_agents-1.0.0/src/haive/agents/rag/db_rag/graph_db/state.py +128 -0
  240. haive_agents-1.0.0/src/haive/agents/rag/db_rag/sql_rag/__init__.py +5 -0
  241. haive_agents-1.0.0/src/haive/agents/rag/db_rag/sql_rag/agent.py +1010 -0
  242. haive_agents-1.0.0/src/haive/agents/rag/db_rag/sql_rag/config.py +402 -0
  243. haive_agents-1.0.0/src/haive/agents/rag/db_rag/sql_rag/engines.py +272 -0
  244. haive_agents-1.0.0/src/haive/agents/rag/db_rag/sql_rag/models.py +95 -0
  245. haive_agents-1.0.0/src/haive/agents/rag/db_rag/sql_rag/prompts.py +348 -0
  246. haive_agents-1.0.0/src/haive/agents/rag/db_rag/sql_rag/state.py +166 -0
  247. haive_agents-1.0.0/src/haive/agents/rag/db_rag/sql_rag/utils.py +281 -0
  248. haive_agents-1.0.0/src/haive/agents/rag/document_grading/__init__.py +5 -0
  249. haive_agents-1.0.0/src/haive/agents/rag/document_grading/agent.py +149 -0
  250. haive_agents-1.0.0/src/haive/agents/rag/dynamic/__init__.py +1 -0
  251. haive_agents-1.0.0/src/haive/agents/rag/dynamic/agent.py +308 -0
  252. haive_agents-1.0.0/src/haive/agents/rag/dynamic/config.py +29 -0
  253. haive_agents-1.0.0/src/haive/agents/rag/dynamic/data_source_types.py +12 -0
  254. haive_agents-1.0.0/src/haive/agents/rag/dynamic/models.py +16 -0
  255. haive_agents-1.0.0/src/haive/agents/rag/dynamic/state.py +23 -0
  256. haive_agents-1.0.0/src/haive/agents/rag/filtered/__init__.py +11 -0
  257. haive_agents-1.0.0/src/haive/agents/rag/filtered/agent.py +235 -0
  258. haive_agents-1.0.0/src/haive/agents/rag/filtered/config.py +33 -0
  259. haive_agents-1.0.0/src/haive/agents/rag/filtered/state.py +37 -0
  260. haive_agents-1.0.0/src/haive/agents/rag/flare/__init__.py +11 -0
  261. haive_agents-1.0.0/src/haive/agents/rag/flare/agent.py +521 -0
  262. haive_agents-1.0.0/src/haive/agents/rag/fusion/__init__.py +5 -0
  263. haive_agents-1.0.0/src/haive/agents/rag/fusion/agent.py +498 -0
  264. haive_agents-1.0.0/src/haive/agents/rag/hallucination_grading/__init__.py +5 -0
  265. haive_agents-1.0.0/src/haive/agents/rag/hallucination_grading/agent.py +515 -0
  266. haive_agents-1.0.0/src/haive/agents/rag/hyde/__init__.py +15 -0
  267. haive_agents-1.0.0/src/haive/agents/rag/hyde/agent.py +103 -0
  268. haive_agents-1.0.0/src/haive/agents/rag/hyde/agent_v2.py +206 -0
  269. haive_agents-1.0.0/src/haive/agents/rag/llm_rag/__init__.py +5 -0
  270. haive_agents-1.0.0/src/haive/agents/rag/llm_rag/agent.py +291 -0
  271. haive_agents-1.0.0/src/haive/agents/rag/llm_rag/config.py +59 -0
  272. haive_agents-1.0.0/src/haive/agents/rag/llm_rag/state.py +27 -0
  273. haive_agents-1.0.0/src/haive/agents/rag/memory_aware/__init__.py +5 -0
  274. haive_agents-1.0.0/src/haive/agents/rag/memory_aware/agent.py +204 -0
  275. haive_agents-1.0.0/src/haive/agents/rag/models.py +360 -0
  276. haive_agents-1.0.0/src/haive/agents/rag/multi_query/__init__.py +1 -0
  277. haive_agents-1.0.0/src/haive/agents/rag/multi_query/agent.py +191 -0
  278. haive_agents-1.0.0/src/haive/agents/rag/multi_strategy/__init__.py +5 -0
  279. haive_agents-1.0.0/src/haive/agents/rag/multi_strategy/agent.py +159 -0
  280. haive_agents-1.0.0/src/haive/agents/rag/multi_strategy/config.py +24 -0
  281. haive_agents-1.0.0/src/haive/agents/rag/multi_strategy/query_types.py +10 -0
  282. haive_agents-1.0.0/src/haive/agents/rag/multi_strategy/state.py +21 -0
  283. haive_agents-1.0.0/src/haive/agents/rag/query_decomposition/__init__.py +5 -0
  284. haive_agents-1.0.0/src/haive/agents/rag/query_decomposition/agent.py +630 -0
  285. haive_agents-1.0.0/src/haive/agents/rag/query_planning/__init__.py +5 -0
  286. haive_agents-1.0.0/src/haive/agents/rag/query_planning/agent.py +646 -0
  287. haive_agents-1.0.0/src/haive/agents/rag/self_corr/__init__.py +5 -0
  288. haive_agents-1.0.0/src/haive/agents/rag/self_corr/agent.py +454 -0
  289. haive_agents-1.0.0/src/haive/agents/rag/self_corr/config.py +49 -0
  290. haive_agents-1.0.0/src/haive/agents/rag/self_corr/state.py +45 -0
  291. haive_agents-1.0.0/src/haive/agents/rag/self_reflective/__init__.py +5 -0
  292. haive_agents-1.0.0/src/haive/agents/rag/self_reflective/agent.py +655 -0
  293. haive_agents-1.0.0/src/haive/agents/rag/self_route/__init__.py +5 -0
  294. haive_agents-1.0.0/src/haive/agents/rag/self_route/agent.py +725 -0
  295. haive_agents-1.0.0/src/haive/agents/rag/simple/__init__.py +6 -0
  296. haive_agents-1.0.0/src/haive/agents/rag/simple/agent.py +20 -0
  297. haive_agents-1.0.0/src/haive/agents/rag/simple/answer_agent.py +44 -0
  298. haive_agents-1.0.0/src/haive/agents/rag/simple/answer_generator/__init__.py +7 -0
  299. haive_agents-1.0.0/src/haive/agents/rag/simple/answer_generator/models.py +31 -0
  300. haive_agents-1.0.0/src/haive/agents/rag/simple/answer_generator/prompts.py +39 -0
  301. haive_agents-1.0.0/src/haive/agents/rag/speculative/__init__.py +5 -0
  302. haive_agents-1.0.0/src/haive/agents/rag/speculative/agent.py +750 -0
  303. haive_agents-1.0.0/src/haive/agents/rag/step_back/__init__.py +5 -0
  304. haive_agents-1.0.0/src/haive/agents/rag/step_back/agent.py +440 -0
  305. haive_agents-1.0.0/src/haive/agents/rag/typed/__init__.py +5 -0
  306. haive_agents-1.0.0/src/haive/agents/rag/typed/agent.py +285 -0
  307. haive_agents-1.0.0/src/haive/agents/rag/typed/config.py +23 -0
  308. haive_agents-1.0.0/src/haive/agents/rag/typed/query_types.py +14 -0
  309. haive_agents-1.0.0/src/haive/agents/rag/typed/state.py +24 -0
  310. haive_agents-1.0.0/src/haive/agents/rag/utils/__init__.py +1 -0
  311. haive_agents-1.0.0/src/haive/agents/react/__init__.py +422 -0
  312. haive_agents-1.0.0/src/haive/agents/react/agent.py +983 -0
  313. haive_agents-1.0.0/src/haive/agents/react/config.py +19 -0
  314. haive_agents-1.0.0/src/haive/agents/react/state.py +51 -0
  315. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/__init__.py +45 -0
  316. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/lats/__init__.py +18 -0
  317. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/lats/agent.py +264 -0
  318. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/lats/config.py +46 -0
  319. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/lats/models.py +171 -0
  320. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/lats/state.py +15 -0
  321. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/logic/__init__.py +45 -0
  322. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/logic/agent.py +139 -0
  323. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/logic/engines/__init__.py +17 -0
  324. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/logic/models.py +463 -0
  325. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/reflection/__init__.py +23 -0
  326. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/reflection/agent.py +472 -0
  327. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/reflection/config.py +164 -0
  328. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/reflection/models.py +47 -0
  329. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/reflection/state.py +56 -0
  330. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/reflexion/__init__.py +23 -0
  331. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/reflexion/agent.py +270 -0
  332. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/reflexion/config.py +18 -0
  333. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/reflexion/models.py +38 -0
  334. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/reflexion/state.py +21 -0
  335. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/self_discover/__init__.py +64 -0
  336. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/self_discover/adapter/__init__.py +19 -0
  337. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/self_discover/adapter/agent.py +51 -0
  338. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/self_discover/adapter/models.py +36 -0
  339. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/self_discover/adapter/prompts.py +35 -0
  340. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/self_discover/agent.py +78 -0
  341. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/self_discover/agent2.py +317 -0
  342. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/self_discover/config.py +148 -0
  343. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/self_discover/engines.py +318 -0
  344. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/self_discover/executor/__init__.py +21 -0
  345. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/self_discover/executor/agent.py +51 -0
  346. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/self_discover/executor/models.py +60 -0
  347. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/self_discover/executor/prompts.py +43 -0
  348. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/self_discover/models.py +145 -0
  349. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/self_discover/selector/__init__.py +21 -0
  350. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/self_discover/selector/agent.py +51 -0
  351. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/self_discover/selector/models.py +35 -0
  352. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/self_discover/selector/prompts.py +35 -0
  353. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/self_discover/selector.py +44 -0
  354. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/self_discover/state.py +64 -0
  355. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/self_discover/structurer/__init__.py +21 -0
  356. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/self_discover/structurer/agent.py +51 -0
  357. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/self_discover/structurer/models.py +43 -0
  358. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/self_discover/structurer/prompts.py +37 -0
  359. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/tot/__init__.py +118 -0
  360. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/tot/agent.py +617 -0
  361. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/tot/agents/__init__.py +12 -0
  362. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/tot/agents/candidate_generator.py +158 -0
  363. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/tot/agents/solution_scorer.py +167 -0
  364. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/tot/config.py +166 -0
  365. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/tot/models.py +302 -0
  366. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/tot/orchestrator.py +280 -0
  367. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/tot/state.py +96 -0
  368. haive_agents-1.0.0/src/haive/agents/reasoning_and_critique/tot/tree_of_thoughts_agent.py +422 -0
  369. haive_agents-1.0.0/src/haive/agents/research/__init__.py +45 -0
  370. haive_agents-1.0.0/src/haive/agents/research/deep_research_agent.py +281 -0
  371. haive_agents-1.0.0/src/haive/agents/research/open_perplexity/__init__.py +131 -0
  372. haive_agents-1.0.0/src/haive/agents/research/open_perplexity/agent.py +783 -0
  373. haive_agents-1.0.0/src/haive/agents/research/open_perplexity/cli.py +236 -0
  374. haive_agents-1.0.0/src/haive/agents/research/open_perplexity/config.py +238 -0
  375. haive_agents-1.0.0/src/haive/agents/research/open_perplexity/engines.py +178 -0
  376. haive_agents-1.0.0/src/haive/agents/research/open_perplexity/examples/__init__.py +21 -0
  377. haive_agents-1.0.0/src/haive/agents/research/open_perplexity/examples/batch_research.py +150 -0
  378. haive_agents-1.0.0/src/haive/agents/research/open_perplexity/examples/run_from_file.py +187 -0
  379. haive_agents-1.0.0/src/haive/agents/research/open_perplexity/examples/run_with_visualization.py +172 -0
  380. haive_agents-1.0.0/src/haive/agents/research/open_perplexity/examples/simple_research.py +69 -0
  381. haive_agents-1.0.0/src/haive/agents/research/open_perplexity/models.py +316 -0
  382. haive_agents-1.0.0/src/haive/agents/research/open_perplexity/prompts.py +239 -0
  383. haive_agents-1.0.0/src/haive/agents/research/open_perplexity/react_agent_config.py +149 -0
  384. haive_agents-1.0.0/src/haive/agents/research/open_perplexity/state.py +257 -0
  385. haive_agents-1.0.0/src/haive/agents/research/open_perplexity/structured_tools.py +742 -0
  386. haive_agents-1.0.0/src/haive/agents/research/perplexity/pro_search/__init__.py +27 -0
  387. haive_agents-1.0.0/src/haive/agents/research/perplexity/pro_search/models.py +376 -0
  388. haive_agents-1.0.0/src/haive/agents/research/perplexity/pro_search/search/__init__.py +18 -0
  389. haive_agents-1.0.0/src/haive/agents/research/perplexity/pro_search/search/models.py +304 -0
  390. haive_agents-1.0.0/src/haive/agents/research/perplexity/pro_search/search/prompts.py +304 -0
  391. haive_agents-1.0.0/src/haive/agents/research/perplexity/pro_search/tasks/__init__.py +37 -0
  392. haive_agents-1.0.0/src/haive/agents/research/perplexity/pro_search/tasks/models.py +460 -0
  393. haive_agents-1.0.0/src/haive/agents/research/perplexity/pro_search/tasks/prompts.py +419 -0
  394. haive_agents-1.0.0/src/haive/agents/research/perplexity_agent.py +233 -0
  395. haive_agents-1.0.0/src/haive/agents/research/person/__init__.py +31 -0
  396. haive_agents-1.0.0/src/haive/agents/research/person/agent.py +581 -0
  397. haive_agents-1.0.0/src/haive/agents/research/person/config.py +65 -0
  398. haive_agents-1.0.0/src/haive/agents/research/person/models.py +22 -0
  399. haive_agents-1.0.0/src/haive/agents/research/person/prompts.py +78 -0
  400. haive_agents-1.0.0/src/haive/agents/research/person/state.py +124 -0
  401. haive_agents-1.0.0/src/haive/agents/research/person/utils.py +104 -0
  402. haive_agents-1.0.0/src/haive/agents/research/storm/__init__.py +38 -0
  403. haive_agents-1.0.0/src/haive/agents/research/storm/config.py +233 -0
  404. haive_agents-1.0.0/src/haive/agents/research/storm/generate_perspectives/__init__.py +8 -0
  405. haive_agents-1.0.0/src/haive/agents/research/storm/generate_perspectives/agent.py +19 -0
  406. haive_agents-1.0.0/src/haive/agents/research/storm/generate_perspectives/models.py +28 -0
  407. haive_agents-1.0.0/src/haive/agents/research/storm/generate_perspectives/prompt.py +15 -0
  408. haive_agents-1.0.0/src/haive/agents/research/storm/interview/__init__.py +1 -0
  409. haive_agents-1.0.0/src/haive/agents/research/storm/interview/models.py +22 -0
  410. haive_agents-1.0.0/src/haive/agents/research/storm/outline_generator/__init__.py +9 -0
  411. haive_agents-1.0.0/src/haive/agents/research/storm/outline_generator/agent.py +19 -0
  412. haive_agents-1.0.0/src/haive/agents/research/storm/outline_generator/models.py +55 -0
  413. haive_agents-1.0.0/src/haive/agents/research/storm/outline_generator/prompt.py +11 -0
  414. haive_agents-1.0.0/src/haive/agents/research/storm/outline_refiner/__init__.py +1 -0
  415. haive_agents-1.0.0/src/haive/agents/research/storm/outline_refiner/agent.py +19 -0
  416. haive_agents-1.0.0/src/haive/agents/research/storm/outline_refiner/prompt.py +20 -0
  417. haive_agents-1.0.0/src/haive/agents/research/storm/related_topics_generator/__init__.py +5 -0
  418. haive_agents-1.0.0/src/haive/agents/research/storm/related_topics_generator/agent.py +0 -0
  419. haive_agents-1.0.0/src/haive/agents/research/storm/related_topics_generator/models.py +7 -0
  420. haive_agents-1.0.0/src/haive/agents/research/storm/related_topics_generator/prompt.py +3 -0
  421. haive_agents-1.0.0/src/haive/agents/research/storm/section_writer/__init__.py +5 -0
  422. haive_agents-1.0.0/src/haive/agents/research/storm/section_writer/agent.py +19 -0
  423. haive_agents-1.0.0/src/haive/agents/research/storm/section_writer/models.py +46 -0
  424. haive_agents-1.0.0/src/haive/agents/research/storm/section_writer/prompt.py +12 -0
  425. haive_agents-1.0.0/src/haive/agents/research/storm/state.py +127 -0
  426. haive_agents-1.0.0/src/haive/agents/research/storm/wiki_writer/__init__.py +1 -0
  427. haive_agents-1.0.0/src/haive/agents/research/storm/wiki_writer/agent.py +20 -0
  428. haive_agents-1.0.0/src/haive/agents/research/storm/wiki_writer/prompt.py +16 -0
  429. haive_agents-1.0.0/src/haive/agents/simple/__init__.py +334 -0
  430. haive_agents-1.0.0/src/haive/agents/simple/agent.py +1659 -0
  431. haive_agents-1.0.0/src/haive/agents/simple/config.py +245 -0
  432. haive_agents-1.0.0/src/haive/agents/simple/state.py +75 -0
  433. haive_agents-1.0.0/src/haive/agents/structured_output/__init__.py +37 -0
  434. haive_agents-1.0.0/src/haive/agents/structured_output/agent.py +299 -0
  435. haive_agents-1.0.0/src/haive/agents/structured_output/models.py +227 -0
  436. haive_agents-1.0.0/src/haive/agents/supervisor/__init__.py +378 -0
  437. haive_agents-1.0.0/src/haive/agents/supervisor/agent.py +576 -0
  438. haive_agents-1.0.0/src/haive/agents/supervisor/core/__init__.py +9 -0
  439. haive_agents-1.0.0/src/haive/agents/supervisor/core/simple_supervisor.py +292 -0
  440. haive_agents-1.0.0/src/haive/agents/supervisor/core/supervisor_agent.py +339 -0
  441. haive_agents-1.0.0/src/haive/agents/supervisor/dynamic/__init__.py +19 -0
  442. haive_agents-1.0.0/src/haive/agents/supervisor/dynamic/dynamic_agent_tools.py +365 -0
  443. haive_agents-1.0.0/src/haive/agents/supervisor/dynamic/dynamic_multi_agent.py +544 -0
  444. haive_agents-1.0.0/src/haive/agents/supervisor/dynamic/dynamic_supervisor.py +402 -0
  445. haive_agents-1.0.0/src/haive/agents/supervisor/models.py +222 -0
  446. haive_agents-1.0.0/src/haive/agents/supervisor/state.py +200 -0
  447. haive_agents-1.0.0/src/haive/agents/supervisor/tools.py +329 -0
  448. haive_agents-1.0.0/src/haive/agents/supervisor/utils/__init__.py +25 -0
  449. haive_agents-1.0.0/src/haive/agents/supervisor/utils/compatibility_bridge.py +327 -0
  450. haive_agents-1.0.0/src/haive/agents/supervisor/utils/registry.py +319 -0
  451. haive_agents-1.0.0/src/haive/agents/supervisor/utils/routing.py +474 -0
  452. haive_agents-1.0.0/src/haive/agents/task_analysis/__init__.py +5 -0
  453. haive_agents-1.0.0/src/haive/agents/task_analysis/agent.py +550 -0
  454. haive_agents-1.0.0/src/haive/agents/task_analysis/analysis/__init__.py +17 -0
  455. haive_agents-1.0.0/src/haive/agents/task_analysis/analysis/engines.py +37 -0
  456. haive_agents-1.0.0/src/haive/agents/task_analysis/analysis/models.py +53 -0
  457. haive_agents-1.0.0/src/haive/agents/task_analysis/analysis/prompts.py +123 -0
  458. haive_agents-1.0.0/src/haive/agents/task_analysis/base/__init__.py +21 -0
  459. haive_agents-1.0.0/src/haive/agents/task_analysis/base/models.py +235 -0
  460. haive_agents-1.0.0/src/haive/agents/task_analysis/complexity/__init__.py +1 -0
  461. haive_agents-1.0.0/src/haive/agents/task_analysis/complexity/engines.py +41 -0
  462. haive_agents-1.0.0/src/haive/agents/task_analysis/complexity/models.py +144 -0
  463. haive_agents-1.0.0/src/haive/agents/task_analysis/complexity/prompts.py +175 -0
  464. haive_agents-1.0.0/src/haive/agents/task_analysis/context/__init__.py +19 -0
  465. haive_agents-1.0.0/src/haive/agents/task_analysis/context/engines.py +52 -0
  466. haive_agents-1.0.0/src/haive/agents/task_analysis/context/models.py +166 -0
  467. haive_agents-1.0.0/src/haive/agents/task_analysis/context/prompts.py +169 -0
  468. haive_agents-1.0.0/src/haive/agents/task_analysis/decomposer/__init__.py +17 -0
  469. haive_agents-1.0.0/src/haive/agents/task_analysis/decomposer/engines.py +38 -0
  470. haive_agents-1.0.0/src/haive/agents/task_analysis/decomposer/models.py +0 -0
  471. haive_agents-1.0.0/src/haive/agents/task_analysis/decomposer/prompts.py +166 -0
  472. haive_agents-1.0.0/src/haive/agents/task_analysis/execution/__init__.py +17 -0
  473. haive_agents-1.0.0/src/haive/agents/task_analysis/execution/engines.py +52 -0
  474. haive_agents-1.0.0/src/haive/agents/task_analysis/execution/models.py +161 -0
  475. haive_agents-1.0.0/src/haive/agents/task_analysis/execution/prompts.py +209 -0
  476. haive_agents-1.0.0/src/haive/agents/task_analysis/tree/__init__.py +5 -0
  477. haive_agents-1.0.0/src/haive/agents/task_analysis/tree/engines.py +37 -0
  478. haive_agents-1.0.0/src/haive/agents/task_analysis/tree/models.py +286 -0
  479. haive_agents-1.0.0/src/haive/agents/task_analysis/tree/prompts.py +93 -0
  480. haive_agents-1.0.0/src/haive/agents/utils/__init__.py +5 -0
  481. haive_agents-1.0.0/src/haive/agents/utils/trace.py +281 -0
@@ -0,0 +1,1011 @@
1
+ Metadata-Version: 2.3
2
+ Name: haive-agents
3
+ Version: 1.0.0
4
+ Summary: haive-agents for Haive framework
5
+ License: MIT
6
+ Author: pr1m8
7
+ Author-email: william.astley@algebraicwealth.com
8
+ Requires-Python: >=3.12,<3.13
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.12
12
+ Requires-Dist: haive-core (>=1.0.0,<2.0.0)
13
+ Requires-Dist: langchain (>=0.3.20,<0.4.0)
14
+ Requires-Dist: langchain-community (>=0.3.26,<0.4.0)
15
+ Requires-Dist: langchain-core (>=0.3.44,<0.4.0)
16
+ Requires-Dist: langchain-google-vertexai (>=2.0.27,<3.0.0)
17
+ Requires-Dist: langchain-huggingface (>=0.3.0,<0.4.0)
18
+ Requires-Dist: langgraph (>=0.3.5,<0.4.0)
19
+ Requires-Dist: langgraph-checkpoint-postgres (>=2.0.23,<3.0.0)
20
+ Requires-Dist: langgraph-sdk (>=0.1.51,<0.2.0)
21
+ Requires-Dist: langsmith (>=0.3,<0.4)
22
+ Requires-Dist: pydantic (>=2.10.6,<3.0.0)
23
+ Description-Content-Type: text/markdown
24
+
25
+ # haive-agents
26
+
27
+ [![Python 3.12+](https://img.shields.io/badge/python-3.12+-blue.svg)](https://www.python.org/downloads/)
28
+ [![Poetry](https://img.shields.io/badge/dependency-poetry-blue.svg)](https://python-poetry.org/)
29
+ [![Haive Framework](https://img.shields.io/badge/haive-framework-green.svg)](https://github.com/haive-agents/haive-agents)
30
+
31
+ Dynamic AI agent framework with self-replication, self-modification, dynamic supervision, and real-time schema composition. Build agents that adapt, evolve, and coordinate automatically.
32
+
33
+ ## What is haive-agents?
34
+
35
+ haive-agents is a sophisticated multi-agent framework that enables the creation of **truly dynamic agents** capable of self-modification, self-replication, runtime adaptation, and autonomous coordination. Unlike static agent frameworks, haive-agents provides agents that can **modify their own behavior**, **spawn new agents**, and **coordinate complex workflows** in real-time.
36
+
37
+ ### Revolutionary Capabilities
38
+
39
+ - 🧬 **Self-Replication** - Agents can spawn copies of themselves with modified capabilities
40
+ - 🔄 **Self-Modification** - Runtime behavior modification and capability enhancement
41
+ - 🎯 **Dynamic Supervision** - Adaptive coordination with agent creation/management
42
+ - ⚙️ **Provider Switching** - Hot-swap between different LLM providers and models
43
+ - 📐 **Schema Composition** - Dynamic state and I/O schema generation
44
+ - 🔗 **Multi-Agent Coordination** - Advanced orchestration patterns (sequential, parallel, conditional)
45
+ - 🧠 **Advanced Reasoning** - Tree search, reflection, self-discovery, and logical reasoning
46
+ - 🗄️ **Graph-Based Memory** - Neo4j knowledge graphs with entity relationships and semantic traversal
47
+ - 🧩 **Memory Reorganization** - Intelligent memory consolidation, importance scoring, and lifecycle management
48
+ - 🔍 **Multi-Modal Retrieval** - Graph + vector + temporal + importance-based memory retrieval
49
+ - 🏗️ **Clean Architecture** - 4 core packages: simple, react, multi, agent + comprehensive memory system
50
+
51
+ ## Quick Start
52
+
53
+ ### Installation
54
+
55
+ ```bash
56
+ # Install with poetry (recommended)
57
+ poetry add haive-agents
58
+
59
+ # Or install from source
60
+ cd packages/haive-agents
61
+ poetry install
62
+ ```
63
+
64
+ ### Basic Agent Usage
65
+
66
+ ```python
67
+ from haive.agents.simple import SimpleAgent
68
+ from haive.agents.react import ReactAgent
69
+ from haive.core.engine.aug_llm import AugLLMConfig
70
+
71
+ # Simple conversational agent
72
+ simple_agent = SimpleAgent(
73
+ name="assistant",
74
+ engine=AugLLMConfig(temperature=0.7)
75
+ )
76
+
77
+ result = await simple_agent.arun("Hello, how can you help me?")
78
+
79
+ # ReAct agent with tools
80
+ from langchain_core.tools import tool
81
+
82
+ @tool
83
+ def calculator(expression: str) -> str:
84
+ """Calculate mathematical expressions."""
85
+ return str(eval(expression))
86
+
87
+ react_agent = ReactAgent(
88
+ name="math_assistant",
89
+ engine=AugLLMConfig(tools=[calculator])
90
+ )
91
+
92
+ result = await react_agent.arun("What is 15 * 23?")
93
+ ```
94
+
95
+ ### Multi-Agent Coordination
96
+
97
+ ```python
98
+ from haive.agents.multi import MultiAgent
99
+
100
+ # Create specialized agents
101
+ researcher = ReactAgent(name="researcher", tools=[web_search])
102
+ writer = SimpleAgent(name="writer", engine=AugLLMConfig(temperature=0.8))
103
+ reviewer = SimpleAgent(name="reviewer", engine=AugLLMConfig(temperature=0.3))
104
+
105
+ # Coordinate them in a workflow
106
+ workflow = MultiAgent(
107
+ name="content_pipeline",
108
+ agents=[researcher, writer, reviewer],
109
+ execution_mode="sequential"
110
+ )
111
+
112
+ result = await workflow.arun("Create a blog post about AI trends")
113
+ ```
114
+
115
+ ### Dynamic Supervision
116
+
117
+ ```python
118
+ from haive.agents.agent import DynamicSupervisorAgent
119
+
120
+ # Create a supervisor that can spawn and manage agents
121
+ supervisor = DynamicSupervisorAgent(
122
+ name="adaptive_coordinator",
123
+ engine=AugLLMConfig(),
124
+ enable_agent_builder=True
125
+ )
126
+
127
+ # Supervisor automatically creates specialized agents based on tasks
128
+ result = await supervisor.arun(
129
+ "Analyze this dataset, create visualizations, and write a report"
130
+ )
131
+ # Supervisor creates: DataAnalyst → Visualizer → ReportWriter agents automatically
132
+ ```
133
+
134
+ ## Core Architecture
135
+
136
+ ### 1. Package Structure
137
+
138
+ The framework is organized into 4 clean, focused packages:
139
+
140
+ ```
141
+ haive-agents/
142
+ ├── 🎯 simple/ # Foundation agents - conversation, structured output
143
+ ├── ⚡ react/ # ReAct pattern - tools, reasoning, planning
144
+ ├── 🔀 multi/ # Multi-agent coordination - orchestration patterns
145
+ └── 🤖 agent/ # Advanced agents - supervision, self-modification
146
+ ```
147
+
148
+ ### 2. Agent Hierarchy
149
+
150
+ ```
151
+ Agent (base class)
152
+ ├── SimpleAgent (conversation, structured output)
153
+ ├── ReactAgent (tools + reasoning)
154
+ ├── MultiAgent (agent coordination)
155
+ ├── DynamicSupervisorAgent (dynamic agent management)
156
+ └── Memory System
157
+ ├── SimpleMemoryAgent (basic memory with classification)
158
+ ├── ReactMemoryAgent (reasoning with memory context)
159
+ ├── MultiMemoryAgent (coordinated memory management)
160
+ ├── LongTermMemoryAgent (persistent memory with consolidation)
161
+ └── IntegratedMemorySystem (unified memory coordination)
162
+ ```
163
+
164
+ ### 3. Self-Modification System
165
+
166
+ ```python
167
+ from haive.agents.agent import SelfModifyingAgent
168
+
169
+ class AdaptiveAgent(SelfModifyingAgent):
170
+ """Agent that can modify its own behavior based on performance."""
171
+
172
+ async def arun(self, input_data):
173
+ # Execute task
174
+ result = await super().arun(input_data)
175
+
176
+ # Analyze performance and self-modify if needed
177
+ if self.performance_below_threshold():
178
+ await self.modify_behavior({
179
+ "temperature": 0.1, # Become more deterministic
180
+ "system_message": "You are an expert analyst. Be precise.",
181
+ "tools": self.tools + [additional_tool]
182
+ })
183
+
184
+ return result
185
+ ```
186
+
187
+ ### 4. Provider Switching
188
+
189
+ ```python
190
+ from haive.agents.agent import ProviderSwitchingAgent
191
+
192
+ class AdaptiveAgent(ProviderSwitchingAgent):
193
+ async def optimize_for_task(self, task_complexity: float):
194
+ if task_complexity > 0.8:
195
+ # Switch to powerful model for complex tasks
196
+ await self.switch_provider({
197
+ "provider": "azure",
198
+ "model": "gpt-4",
199
+ "temperature": 0.1
200
+ })
201
+ else:
202
+ # Use efficient model for simple tasks
203
+ await self.switch_provider({
204
+ "provider": "openai",
205
+ "model": "gpt-3.5-turbo",
206
+ "temperature": 0.7
207
+ })
208
+ ```
209
+
210
+ ## Available Agent Types
211
+
212
+ ### Simple Agents
213
+
214
+ #### SimpleAgent
215
+ Foundation agent for conversation and structured output:
216
+
217
+ ```python
218
+ from haive.agents.simple import SimpleAgent
219
+ from pydantic import BaseModel, Field
220
+
221
+ class AnalysisResult(BaseModel):
222
+ sentiment: str = Field(description="positive/negative/neutral")
223
+ confidence: float = Field(ge=0.0, le=1.0)
224
+
225
+ # Basic conversation
226
+ agent = SimpleAgent(name="chatbot", engine=AugLLMConfig())
227
+
228
+ # With structured output
229
+ structured_agent = SimpleAgent(
230
+ name="analyzer",
231
+ engine=AugLLMConfig(structured_output_model=AnalysisResult)
232
+ )
233
+ ```
234
+
235
+ ### React Agents
236
+
237
+ #### ReactAgent
238
+ Advanced reasoning with tools and planning:
239
+
240
+ ```python
241
+ from haive.agents.react import ReactAgent
242
+ from langchain_core.tools import tool
243
+
244
+ @tool
245
+ def web_search(query: str) -> str:
246
+ """Search the web for information."""
247
+ return f"Search results for: {query}"
248
+
249
+ @tool
250
+ def calculator(expression: str) -> str:
251
+ """Calculate mathematical expressions."""
252
+ return str(eval(expression))
253
+
254
+ agent = ReactAgent(
255
+ name="research_assistant",
256
+ engine=AugLLMConfig(tools=[web_search, calculator]),
257
+ max_iterations=5
258
+ )
259
+ ```
260
+
261
+ ### Multi Agents
262
+
263
+ #### MultiAgent
264
+ Coordinate multiple agents in sophisticated workflows:
265
+
266
+ ```python
267
+ from haive.agents.multi import MultiAgent
268
+
269
+ # Sequential workflow
270
+ workflow = MultiAgent(
271
+ name="pipeline",
272
+ agents=[planner, executor, reviewer],
273
+ execution_mode="sequential"
274
+ )
275
+
276
+ # Parallel execution
277
+ parallel_workflow = MultiAgent(
278
+ name="parallel_analysis",
279
+ agents=[analyzer1, analyzer2, analyzer3],
280
+ execution_mode="parallel"
281
+ )
282
+
283
+ # Conditional routing
284
+ conditional_workflow = MultiAgent(
285
+ name="smart_router",
286
+ agents=[classifier, simple_processor, complex_processor],
287
+ execution_mode="conditional"
288
+ )
289
+
290
+ # Add routing logic
291
+ conditional_workflow.add_conditional_edge(
292
+ from_agent="classifier",
293
+ condition=lambda state: state.get("complexity") > 0.7,
294
+ true_agent="complex_processor",
295
+ false_agent="simple_processor"
296
+ )
297
+ ```
298
+
299
+ ### Advanced Agents
300
+
301
+ #### DynamicSupervisorAgent
302
+ Intelligent supervisor that can create agents on-demand:
303
+
304
+ ```python
305
+ from haive.agents.agent import DynamicSupervisorAgent
306
+
307
+ supervisor = DynamicSupervisorAgent(
308
+ name="meta_coordinator",
309
+ engine=AugLLMConfig(),
310
+ enable_agent_builder=True
311
+ )
312
+
313
+ # Supervisor analyzes task and creates appropriate agents
314
+ await supervisor.arun(
315
+ "I need to: research quantum computing, analyze market data, "
316
+ "create visualizations, and write a technical report"
317
+ )
318
+
319
+ # Supervisor automatically creates and coordinates:
320
+ # 1. ResearchAgent(tools=[web_search, paper_search])
321
+ # 2. DataAnalyst(tools=[pandas, statistical_analysis])
322
+ # 3. VisualizationAgent(tools=[matplotlib, plotly])
323
+ # 4. TechnicalWriter(structured_output=ReportModel)
324
+ ```
325
+
326
+ #### SelfReplicatingAgent
327
+ Agent that can spawn copies of itself with modifications:
328
+
329
+ ```python
330
+ from haive.agents.agent import SelfReplicatingAgent
331
+
332
+ class ReplicatingAgent(SelfReplicatingAgent):
333
+ async def replicate_for_task(self, task_type: str):
334
+ """Create a specialized copy for specific tasks."""
335
+
336
+ if task_type == "analysis":
337
+ return await self.replicate({
338
+ "name": f"{self.name}_analyst",
339
+ "temperature": 0.1,
340
+ "system_message": "You are a data analysis expert.",
341
+ "tools": self.tools + [analysis_tool]
342
+ })
343
+ elif task_type == "creative":
344
+ return await self.replicate({
345
+ "name": f"{self.name}_creative",
346
+ "temperature": 0.9,
347
+ "system_message": "You are a creative writing expert.",
348
+ "tools": [writing_tool, inspiration_tool]
349
+ })
350
+
351
+ # Original agent creates specialized versions
352
+ agent = ReplicatingAgent(name="base", engine=config)
353
+ analyst = await agent.replicate_for_task("analysis")
354
+ writer = await agent.replicate_for_task("creative")
355
+ ```
356
+
357
+ ### Memory System
358
+
359
+ #### Graph-Based Memory with Knowledge Graphs
360
+ Sophisticated memory system combining Neo4j graphs, vector search, and intelligent reorganization:
361
+
362
+ ```python
363
+ from haive.agents.memory_reorganized import SimpleMemoryAgent
364
+ from haive.agents.memory_reorganized.coordination import IntegratedMemorySystem
365
+
366
+ # Basic memory agent with automatic classification
367
+ memory_agent = SimpleMemoryAgent(
368
+ name="assistant",
369
+ memory_config={
370
+ "enable_classification": True,
371
+ "store_type": "integrated" # Graph + Vector + Time
372
+ }
373
+ )
374
+
375
+ # Store memory with automatic type detection and entity extraction
376
+ await memory_agent.store_memory("I learned Python at university in 2020")
377
+ # -> Automatically classified as EPISODIC + EDUCATION
378
+ # -> Entities extracted: ["Python", "university", "2020"]
379
+ # -> Knowledge graph relationships created
380
+
381
+ # Retrieve with memory-aware context
382
+ results = await memory_agent.retrieve_memories("programming experience")
383
+ # -> Returns memories with relevance, importance, and recency scores
384
+ ```
385
+
386
+ #### Advanced Graph RAG Retrieval
387
+ Combine knowledge graph traversal with vector similarity for comprehensive memory retrieval:
388
+
389
+ ```python
390
+ from haive.agents.memory_reorganized.retrieval import GraphRAGRetriever
391
+ from haive.agents.memory_reorganized.knowledge import KGGeneratorAgent
392
+
393
+ # Setup Graph RAG with knowledge graph
394
+ kg_agent = KGGeneratorAgent(neo4j_config=neo4j_config)
395
+ retriever = GraphRAGRetriever(
396
+ kg_agent=kg_agent,
397
+ vector_store=chroma_store,
398
+ enable_graph_traversal=True
399
+ )
400
+
401
+ # Retrieve with graph context and relationship awareness
402
+ result = await retriever.retrieve_memories(
403
+ "What's the relationship between Python and machine learning?"
404
+ )
405
+
406
+ print(f"Found {len(result.memories)} memories")
407
+ print(f"Explored {result.graph_nodes_explored} entities")
408
+ print(f"Relationship paths: {len(result.relationship_paths)}")
409
+ print(f"Graph traversal time: {result.graph_traversal_time_ms:.1f}ms")
410
+ ```
411
+
412
+ #### Integrated Memory System with Multi-Modal Retrieval
413
+ Unified memory system combining graph, vector, and temporal-based retrieval:
414
+
415
+ ```python
416
+ from haive.agents.memory_reorganized.coordination import IntegratedMemorySystem
417
+
418
+ # Configure multi-modal memory system
419
+ memory_system = IntegratedMemorySystem(
420
+ mode="INTEGRATED", # Graph + Vector + Time-based
421
+ graph_config=graph_config,
422
+ vector_config=vector_config,
423
+ enable_consolidation=True,
424
+ enable_importance_scoring=True
425
+ )
426
+
427
+ # Store with automatic processing
428
+ await memory_system.store_memory(
429
+ "I prefer morning meetings because I'm most productive then",
430
+ user_context={"user_id": "alice", "timezone": "EST"}
431
+ )
432
+ # -> Classified as PREFERENCE + TEMPORAL
433
+ # -> Entities extracted: ["meetings", "morning", "productivity"]
434
+ # -> Graph relationships: alice -> prefers -> morning_meetings
435
+ # -> Importance scoring based on personal preference patterns
436
+
437
+ # Query with intelligent routing
438
+ results = await memory_system.query_memory(
439
+ "scheduling preferences",
440
+ max_results=10,
441
+ include_graph_context=True
442
+ )
443
+ # -> Routes to optimal retrieval strategy (graph + vector + temporal)
444
+ # -> Returns results with multi-factor scoring
445
+ ```
446
+
447
+ #### Memory Types Supported
448
+ 11 cognitive memory types with automatic classification:
449
+
450
+ - **SEMANTIC**: Facts, concepts, definitions ("Python is a programming language")
451
+ - **EPISODIC**: Personal experiences, events ("Yesterday I met John at the coffee shop")
452
+ - **PROCEDURAL**: How-to knowledge, processes ("To make coffee, first heat water")
453
+ - **CONTEXTUAL**: Entity relationships ("John works at Microsoft and knows Sarah")
454
+ - **PREFERENCE**: Likes, dislikes, patterns ("I prefer tea over coffee in the morning")
455
+ - **META**: Self-awareness, learning patterns ("I learn better with examples")
456
+ - **EMOTIONAL**: Feelings, sentiments ("I felt frustrated when the meeting was cancelled")
457
+ - **TEMPORAL**: Time-based patterns ("I usually exercise at 6 AM")
458
+ - **ERROR**: Mistakes, corrections ("I was wrong about the meeting time")
459
+ - **FEEDBACK**: User corrections, evaluations ("That summary was too long")
460
+ - **SYSTEM**: Configuration, settings ("Set notification frequency to daily")
461
+
462
+ ## Advanced Features
463
+
464
+ ### 1. Real-Time Recompilation
465
+
466
+ Agents automatically recompile when their configuration changes:
467
+
468
+ ```python
469
+ agent = SimpleAgent(name="adaptive", engine=config)
470
+
471
+ # Add tool dynamically - triggers recompilation
472
+ agent.add_tool(new_calculator_tool)
473
+ # Agent's graph is automatically rebuilt
474
+
475
+ # Change system message - triggers recompilation
476
+ agent.engine.system_message = "You are now a math expert."
477
+ # Agent adapts immediately
478
+ ```
479
+
480
+ ### 2. Hierarchical State Management
481
+
482
+ Multi-agent workflows maintain isolated yet connected state:
483
+
484
+ ```python
485
+ from haive.core.schema.prebuilt.multi_agent_state import MultiAgentState
486
+
487
+ # Each agent gets its own state view
488
+ class WorkflowState(MultiAgentState):
489
+ # Shared across all agents
490
+ task_description: str
491
+ shared_context: Dict[str, Any]
492
+
493
+ # Agent-specific private state
494
+ planner_state: PlannerState # Only planner sees this
495
+ executor_state: ExecutorState # Only executor sees this
496
+ ```
497
+
498
+ ### 3. Dynamic Schema Composition
499
+
500
+ ```python
501
+ from haive.core.schema.composer import DynamicSchemaComposer
502
+
503
+ # Compose schemas based on agent requirements
504
+ composer = DynamicSchemaComposer()
505
+
506
+ # Automatically generate state schema for workflow
507
+ workflow_schema = composer.compose_for_agents([
508
+ ReactAgent(name="analyzer"),
509
+ SimpleAgent(name="formatter", structured_output=ReportModel),
510
+ ReactAgent(name="reviewer")
511
+ ])
512
+ ```
513
+
514
+ ### 4. Tool Transfer and Sharing
515
+
516
+ ```python
517
+ from haive.agents.agent import ToolTransferMixin
518
+
519
+ class CollaborativeAgent(SimpleAgent, ToolTransferMixin):
520
+ async def share_tools_with(self, other_agent, tool_names: List[str]):
521
+ """Transfer specific tools to another agent."""
522
+ await self.transfer_tools(other_agent, tool_names)
523
+
524
+ agent1 = CollaborativeAgent(name="specialist", tools=[expert_tool])
525
+ agent2 = CollaborativeAgent(name="generalist", tools=[basic_tools])
526
+
527
+ # Share expertise
528
+ await agent1.share_tools_with(agent2, ["expert_tool"])
529
+ ```
530
+
531
+ ## Common Workflows
532
+
533
+ ### 1. Self-Organizing Agent Team
534
+
535
+ ```python
536
+ # Create a supervisor that builds its own team
537
+ supervisor = DynamicSupervisorAgent(
538
+ name="team_builder",
539
+ enable_agent_builder=True,
540
+ auto_team_optimization=True
541
+ )
542
+
543
+ # Supervisor analyzes task and builds optimal team
544
+ result = await supervisor.arun({
545
+ "task": "Build a web application with user authentication",
546
+ "requirements": ["security", "scalability", "user experience"]
547
+ })
548
+
549
+ # Supervisor creates:
550
+ # - BackendAgent(tools=[python, fastapi, database])
551
+ # - SecurityAgent(tools=[auth, encryption, validation])
552
+ # - FrontendAgent(tools=[react, css, testing])
553
+ # - DevOpsAgent(tools=[docker, kubernetes, monitoring])
554
+ ```
555
+
556
+ ### 2. Adaptive Multi-Agent Pipeline
557
+
558
+ ```python
559
+ # Multi-stage processing that adapts based on complexity
560
+ planner = ReactAgent(name="planner", tools=[analysis_tools])
561
+ simple_executor = SimpleAgent(name="simple_executor")
562
+ complex_executor = ReactAgent(name="complex_executor", tools=[advanced_tools])
563
+ reviewer = SimpleAgent(name="reviewer")
564
+
565
+ # Adaptive pipeline
566
+ adaptive_pipeline = MultiAgent(
567
+ name="adaptive_workflow",
568
+ agents=[planner, simple_executor, complex_executor, reviewer],
569
+ execution_mode="conditional"
570
+ )
571
+
572
+ # Route based on task complexity
573
+ adaptive_pipeline.add_conditional_edge(
574
+ from_agent="planner",
575
+ condition=lambda state: state.get("complexity") > 0.7,
576
+ true_agent="complex_executor", # Complex tasks
577
+ false_agent="simple_executor" # Simple tasks
578
+ )
579
+
580
+ adaptive_pipeline.add_edge("simple_executor", "reviewer")
581
+ adaptive_pipeline.add_edge("complex_executor", "reviewer")
582
+ ```
583
+
584
+ ### 3. Self-Improving Agent Colony
585
+
586
+ ```python
587
+ # Agents that improve through interaction and feedback
588
+ class EvolvingAgent(SimpleAgent, SelfModifyingAgent, SelfReplicatingAgent):
589
+ async def evolve_from_feedback(self, feedback: Dict[str, Any]):
590
+ """Evolve based on performance feedback."""
591
+ if feedback["accuracy"] < 0.7:
592
+ # Create improved version
593
+ improved = await self.replicate({
594
+ "temperature": self.engine.temperature * 0.8,
595
+ "system_message": f"{self.engine.system_message}\nFocus on accuracy.",
596
+ })
597
+ return improved
598
+ return self
599
+
600
+ # Create evolving colony
601
+ colony = [
602
+ EvolvingAgent(name=f"agent_{i}", engine=base_config)
603
+ for i in range(5)
604
+ ]
605
+
606
+ # Agents evolve based on performance
607
+ for agent in colony:
608
+ feedback = await evaluate_agent_performance(agent)
609
+ improved_agent = await agent.evolve_from_feedback(feedback)
610
+ if improved_agent != agent:
611
+ colony[colony.index(agent)] = improved_agent
612
+ ```
613
+
614
+ ### 4. Hierarchical Supervision
615
+
616
+ ```python
617
+ class HierarchicalSupervisor(DynamicSupervisorAgent):
618
+ """Multi-level supervision with sub-supervisors."""
619
+
620
+ def __init__(self, **kwargs):
621
+ super().__init__(**kwargs)
622
+ self.sub_supervisors: Dict[str, DynamicSupervisorAgent] = {}
623
+
624
+ async def create_sub_supervisor(self, domain: str, agents: List[Agent]):
625
+ """Create domain-specific sub-supervisor."""
626
+ sub_supervisor = DynamicSupervisorAgent(
627
+ name=f"{domain}_supervisor",
628
+ engine=self.engine,
629
+ enable_agent_builder=False # Managed by parent
630
+ )
631
+
632
+ # Initialize with domain agents
633
+ for agent in agents:
634
+ sub_supervisor.add_agent(agent)
635
+
636
+ self.sub_supervisors[domain] = sub_supervisor
637
+ return sub_supervisor
638
+
639
+ # Create hierarchical system
640
+ main_supervisor = HierarchicalSupervisor(name="main")
641
+
642
+ # Create domain supervisors
643
+ research_supervisor = await main_supervisor.create_sub_supervisor(
644
+ "research", [web_search_agent, paper_analysis_agent]
645
+ )
646
+
647
+ development_supervisor = await main_supervisor.create_sub_supervisor(
648
+ "development", [code_agent, test_agent, deploy_agent]
649
+ )
650
+ ```
651
+
652
+ ## Agent Architecture Patterns
653
+
654
+ ### Pattern 1: Self-Modifying Specialist
655
+
656
+ ```python
657
+ from haive.agents.agent import SelfModifyingAgent
658
+
659
+ class ExpertAgent(SimpleAgent, SelfModifyingAgent):
660
+ """Agent that becomes more specialized over time."""
661
+
662
+ def __init__(self, domain: str, **kwargs):
663
+ super().__init__(**kwargs)
664
+ self.domain = domain
665
+ self.expertise_level = 1.0
666
+
667
+ async def enhance_expertise(self, new_knowledge: Dict[str, Any]):
668
+ """Enhance domain expertise based on new knowledge."""
669
+ self.expertise_level += 0.1
670
+
671
+ # Modify system message to be more specialized
672
+ enhanced_message = f"""You are a level {self.expertise_level:.1f} expert in {self.domain}.
673
+ New knowledge: {new_knowledge}
674
+ Apply this expertise to all responses."""
675
+
676
+ await self.modify_behavior({
677
+ "system_message": enhanced_message,
678
+ "temperature": max(0.1, self.engine.temperature - 0.05)
679
+ })
680
+ ```
681
+
682
+ ### Pattern 2: Adaptive Multi-Agent System
683
+
684
+ ```python
685
+ from haive.agents.multi import MultiAgent
686
+
687
+ class AdaptiveWorkflow(MultiAgent):
688
+ """Workflow that adapts its structure based on task requirements."""
689
+
690
+ async def adapt_to_task(self, task_description: str):
691
+ """Restructure workflow based on task complexity."""
692
+ complexity = await self.analyze_task_complexity(task_description)
693
+
694
+ if complexity > 0.8:
695
+ # Complex task: add more specialized agents
696
+ self.add_agent(DeepAnalysisAgent(name="deep_analyzer"))
697
+ self.add_agent(QualityAssuranceAgent(name="qa_specialist"))
698
+
699
+ # Change to sequential for thorough processing
700
+ self.execution_mode = "sequential"
701
+ else:
702
+ # Simple task: streamline workflow
703
+ self.execution_mode = "parallel"
704
+
705
+ # Rebuild graph with new structure
706
+ await self.rebuild_graph()
707
+ ```
708
+
709
+ ### Pattern 3: Multi-Model Orchestration
710
+
711
+ ```python
712
+ from haive.agents.multi import MultiAgent
713
+
714
+ class MultiModelWorkflow(MultiAgent):
715
+ """Use different models for different tasks."""
716
+
717
+ def __init__(self, **kwargs):
718
+ # Creative agent with high-temperature model
719
+ creative = SimpleAgent(
720
+ name="creative",
721
+ engine=AugLLMConfig(model="gpt-4", temperature=0.9)
722
+ )
723
+
724
+ # Analytical agent with low-temperature model
725
+ analytical = SimpleAgent(
726
+ name="analytical",
727
+ engine=AugLLMConfig(model="gpt-4", temperature=0.1)
728
+ )
729
+
730
+ # Efficient agent with smaller model
731
+ efficient = SimpleAgent(
732
+ name="efficient",
733
+ engine=AugLLMConfig(model="gpt-3.5-turbo", temperature=0.5)
734
+ )
735
+
736
+ super().__init__(
737
+ agents=[creative, analytical, efficient],
738
+ **kwargs
739
+ )
740
+ ```
741
+
742
+ ## Performance and Optimization
743
+
744
+ ### Real-Time Compilation
745
+
746
+ All agents support hot-recompilation when their configuration changes:
747
+
748
+ - **Tool Changes**: Adding/removing tools triggers graph rebuild
749
+ - **Schema Updates**: State schema modifications trigger recompilation
750
+ - **Config Changes**: Engine configuration changes trigger rebuild
751
+ - **Agent Addition**: Multi-agent workflows recompile when agents added
752
+
753
+ ### Memory Management
754
+
755
+ Agents include sophisticated memory patterns:
756
+
757
+ - **Conversation Memory**: Persistent conversation history
758
+ - **Vector Memory**: Semantic memory for relevant context
759
+ - **Hierarchical Memory**: Multi-level memory systems
760
+ - **Shared Memory**: Memory sharing between agents
761
+
762
+ ### Concurrent Execution
763
+
764
+ Multi-agent workflows support true concurrency:
765
+
766
+ - **Parallel Execution**: Multiple agents run simultaneously
767
+ - **Async Coordination**: Full async/await support
768
+ - **State Synchronization**: Thread-safe state management
769
+ - **Resource Pooling**: Efficient resource sharing
770
+
771
+ ## Testing Philosophy
772
+
773
+ haive-agents follows a **NO MOCKS** testing philosophy:
774
+
775
+ ```bash
776
+ # All tests use real LLMs and components
777
+ poetry run pytest packages/haive-agents/tests/ -v
778
+
779
+ # Integration tests with real providers
780
+ poetry run pytest packages/haive-agents/tests/integration/ -v
781
+
782
+ # Performance benchmarks
783
+ poetry run pytest packages/haive-agents/tests/benchmarks/ -v
784
+ ```
785
+
786
+ **Why No Mocks?**
787
+ - Tests validate real LLM behavior
788
+ - Ensures production readiness
789
+ - Catches integration issues early
790
+ - Validates complex multi-agent interactions
791
+
792
+ ## Package Structure
793
+
794
+ ```
795
+ haive-agents/
796
+ ├── 📚 project_docs/ # Comprehensive documentation
797
+ │ ├── guides/ # Usage guides and patterns
798
+ │ ├── architecture/ # System design documents
799
+ │ ├── patterns/ # Common implementation patterns
800
+ │ └── examples/ # Working code examples
801
+ ├── 🧹 src/haive/agents/ # Clean source code
802
+ │ ├── simple/ # Foundation agents
803
+ │ ├── react/ # ReAct pattern agents
804
+ │ ├── multi/ # Multi-agent coordination
805
+ │ ├── agent/ # Advanced agent capabilities
806
+ │ └── base/ # Base classes and mixins
807
+ ├── 🎯 examples/ # Organized examples
808
+ │ ├── basic/ # Getting started examples
809
+ │ ├── advanced/ # Complex multi-agent scenarios
810
+ │ ├── self_modification/ # Self-modifying agent examples
811
+ │ └── dynamic_supervision/ # Supervisor pattern examples
812
+ ├── ✅ tests/ # Comprehensive tests (NO MOCKS)
813
+ │ ├── simple/ # SimpleAgent tests
814
+ │ ├── react/ # ReactAgent tests
815
+ │ ├── multi/ # Multi-agent tests
816
+ │ ├── agent/ # Advanced agent tests
817
+ │ └── integration/ # End-to-end integration tests
818
+ └── 🔧 scripts/ # Development utilities
819
+ ```
820
+
821
+ ## Advanced Usage
822
+
823
+ ### Custom Agent Development
824
+
825
+ ```python
826
+ from haive.agents.base.agent import Agent
827
+
828
+ class MyAdvancedAgent(Agent):
829
+ """Custom agent with specialized behavior."""
830
+
831
+ def build_graph(self) -> BaseGraph:
832
+ """Implement required abstract method."""
833
+ graph = BaseGraph(name=f"{self.name}_graph")
834
+ # Custom graph building logic
835
+ return graph
836
+
837
+ async def adaptive_execution(self, input_data):
838
+ """Custom execution with adaptation."""
839
+ # Analyze input and adapt if needed
840
+ complexity = self.analyze_complexity(input_data)
841
+
842
+ if complexity > self.capability_threshold:
843
+ # Enhance capabilities for complex tasks
844
+ await self.enhance_capabilities(complexity)
845
+
846
+ return await self.arun(input_data)
847
+ ```
848
+
849
+ ### Real-Time Agent Evolution
850
+
851
+ ```python
852
+ from haive.agents.agent import EvolutionarySystem
853
+
854
+ class EvolutionarySystem:
855
+ """System that evolves agents based on performance."""
856
+
857
+ def __init__(self):
858
+ self.agents: List[Agent] = []
859
+ self.performance_history: Dict[str, List[float]] = {}
860
+
861
+ async def evolve_population(self):
862
+ """Evolve agent population based on performance."""
863
+ # Evaluate all agents
864
+ performances = await self.evaluate_all_agents()
865
+
866
+ # Select top performers
867
+ top_agents = self.select_top_performers(performances, top_k=3)
868
+
869
+ # Create variations of top performers
870
+ new_agents = []
871
+ for agent in top_agents:
872
+ if hasattr(agent, 'replicate'):
873
+ # Create mutations
874
+ variation1 = await agent.replicate({
875
+ "temperature": agent.engine.temperature * 0.9,
876
+ "system_message": f"Enhanced: {agent.engine.system_message}"
877
+ })
878
+ variation2 = await agent.replicate({
879
+ "temperature": agent.engine.temperature * 1.1,
880
+ "tools": agent.tools + [self.get_random_tool()]
881
+ })
882
+ new_agents.extend([variation1, variation2])
883
+
884
+ # Replace bottom performers with new variants
885
+ self.agents = top_agents + new_agents
886
+ ```
887
+
888
+ ## Troubleshooting
889
+
890
+ ### Common Issues
891
+
892
+ 1. **Graph Compilation Errors**
893
+ ```python
894
+ # Check agent configuration
895
+ agent.validate_configuration()
896
+
897
+ # Manually trigger recompilation
898
+ await agent.rebuild_graph()
899
+ ```
900
+
901
+ 2. **State Schema Conflicts**
902
+ ```python
903
+ # Use schema composition for complex workflows
904
+ from haive.core.schema.composer import DynamicSchemaComposer
905
+ composer = DynamicSchemaComposer()
906
+ resolved_schema = composer.resolve_conflicts(agent_schemas)
907
+ ```
908
+
909
+ 3. **Provider Connection Issues**
910
+ ```python
911
+ # Test provider connectivity
912
+ await agent.test_provider_connection()
913
+
914
+ # Switch to backup provider
915
+ await agent.switch_provider(backup_config)
916
+ ```
917
+
918
+ ### Debug Mode
919
+
920
+ ```python
921
+ # Enable comprehensive debugging
922
+ import logging
923
+ logging.getLogger("haive.agents").setLevel(logging.DEBUG)
924
+
925
+ # Check agent internal state
926
+ agent.display_debug_info()
927
+
928
+ # Monitor multi-agent coordination
929
+ workflow.enable_execution_monitoring()
930
+ ```
931
+
932
+ ## Examples & Documentation
933
+
934
+ ### 🚀 Quick Start
935
+
936
+ ```bash
937
+ # 5-minute setup guide
938
+ see project_docs/guides/quick-start.md
939
+
940
+ # Run basic example
941
+ poetry run python examples/basic_agent.py
942
+ ```
943
+
944
+ ### 📚 Comprehensive Documentation
945
+
946
+ - **[Project Documentation](project_docs/README.md)** - Complete documentation hub
947
+ - **[Architecture Guide](project_docs/architecture/README.md)** - System design
948
+ - **[Usage Patterns](project_docs/guides/usage-patterns.md)** - Common scenarios
949
+ - **[Examples](project_docs/examples/README.md)** - Working code examples
950
+
951
+ ### 🎯 Key Examples
952
+
953
+ ```bash
954
+ # Basic agent usage
955
+ poetry run python examples/simple_agent_example.py
956
+
957
+ # ReAct agents with tools
958
+ poetry run python examples/react_agent_example.py
959
+
960
+ # Multi-agent coordination
961
+ poetry run python examples/multi_agent_workflow.py
962
+
963
+ # Dynamic supervision
964
+ poetry run python examples/dynamic_supervisor.py
965
+
966
+ # Self-modifying agents
967
+ poetry run python examples/self_modification.py
968
+ ```
969
+
970
+ ## Testing
971
+
972
+ ```bash
973
+ # Run all tests
974
+ poetry run pytest
975
+
976
+ # Run specific package tests
977
+ poetry run pytest tests/simple/ -v
978
+ poetry run pytest tests/react/ -v
979
+ poetry run pytest tests/multi/ -v
980
+ poetry run pytest tests/agent/ -v
981
+
982
+ # Run with coverage
983
+ poetry run pytest --cov=haive.agents
984
+ ```
985
+
986
+ ## Contributing
987
+
988
+ 1. Fork the repository
989
+ 2. Create your feature branch
990
+ 3. Follow the NO MOCKS testing philosophy
991
+ 4. Add comprehensive tests with real LLMs
992
+ 5. Ensure all agents support dynamic patterns
993
+ 6. Submit a pull request
994
+
995
+ ## License
996
+
997
+ MIT License - see LICENSE file for details.
998
+
999
+ ## References
1000
+
1001
+ - [Haive Agents Repository](https://github.com/haive-agents/haive-agents)
1002
+ - [ReAct Paper](https://arxiv.org/abs/2210.03629)
1003
+ - [Self-Discover Paper](https://arxiv.org/abs/2402.03620)
1004
+ - [Tree of Thoughts Paper](https://arxiv.org/abs/2305.10601)
1005
+
1006
+ ## Support
1007
+
1008
+ For issues and questions:
1009
+
1010
+ - GitHub Issues: [haive-agents/issues](https://github.com/haive-agents/haive-agents/issues)
1011
+ - Documentation: [haive-agents.readthedocs.io](https://haive-agents.readthedocs.io)