lionagi 0.14.7__tar.gz → 0.14.9__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 (311) hide show
  1. {lionagi-0.14.7 → lionagi-0.14.9}/PKG-INFO +66 -25
  2. {lionagi-0.14.7 → lionagi-0.14.9}/README.md +65 -24
  3. {lionagi-0.14.7 → lionagi-0.14.9}/cookbooks/007_fan_out_in.py +35 -7
  4. {lionagi-0.14.7 → lionagi-0.14.9}/cookbooks/claude_proxy/claude_code_proxy.py +2 -5
  5. lionagi-0.14.9/cookbooks/claude_proxy/run_w_claude_code_proxy.ipynb +100 -0
  6. lionagi-0.14.9/lionagi/_errors.py +148 -0
  7. lionagi-0.14.9/lionagi/_types.py +3 -0
  8. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/config.py +3 -1
  9. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/fields/instruct.py +0 -1
  10. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/models/operable_model.py +8 -3
  11. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/operations/flow.py +0 -1
  12. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/protocols/generic/event.py +2 -0
  13. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/protocols/generic/log.py +26 -10
  14. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/protocols/operatives/step.py +1 -1
  15. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/protocols/types.py +9 -1
  16. lionagi-0.14.7/lionagi/service/types.py → lionagi-0.14.9/lionagi/service/__init__.py +6 -4
  17. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/service/connections/api_calling.py +57 -2
  18. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/service/connections/endpoint_config.py +1 -1
  19. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/service/connections/header_factory.py +4 -2
  20. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/service/connections/match_endpoint.py +10 -10
  21. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/service/connections/providers/anthropic_.py +5 -2
  22. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/service/connections/providers/claude_code_.py +13 -17
  23. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/service/connections/providers/claude_code_cli.py +51 -16
  24. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/service/connections/providers/exa_.py +5 -3
  25. lionagi-0.14.9/lionagi/service/connections/providers/oai_.py +200 -0
  26. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/service/connections/providers/ollama_.py +38 -18
  27. lionagi-0.14.9/lionagi/service/connections/providers/perplexity_.py +51 -0
  28. lionagi-0.14.9/lionagi/service/connections/providers/types.py +30 -0
  29. lionagi-0.14.9/lionagi/service/hooks/__init__.py +25 -0
  30. lionagi-0.14.9/lionagi/service/hooks/_types.py +52 -0
  31. lionagi-0.14.9/lionagi/service/hooks/_utils.py +85 -0
  32. lionagi-0.14.9/lionagi/service/hooks/hook_event.py +67 -0
  33. lionagi-0.14.9/lionagi/service/hooks/hook_registry.py +221 -0
  34. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/service/imodel.py +120 -34
  35. lionagi-0.14.9/lionagi/service/third_party/claude_code.py +715 -0
  36. lionagi-0.14.9/lionagi/service/third_party/openai_model_names.py +198 -0
  37. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/service/third_party/pplx_models.py +16 -8
  38. lionagi-0.14.9/lionagi/service/types.py +41 -0
  39. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/session/branch.py +1 -4
  40. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/tools/base.py +1 -3
  41. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/utils.py +8 -2
  42. lionagi-0.14.9/lionagi/version.py +1 -0
  43. {lionagi-0.14.7 → lionagi-0.14.9}/pyproject.toml +1 -1
  44. lionagi-0.14.9/scripts/README.md +41 -0
  45. lionagi-0.14.9/scripts/update_openai_models.py +281 -0
  46. {lionagi-0.14.7 → lionagi-0.14.9}/uv.lock +8 -8
  47. lionagi-0.14.7/cookbooks/claude_proxy/run_w_claude_code_proxy.ipynb +0 -217
  48. lionagi-0.14.7/lionagi/_errors.py +0 -39
  49. lionagi-0.14.7/lionagi/_types.py +0 -9
  50. lionagi-0.14.7/lionagi/service/__init__.py +0 -1
  51. lionagi-0.14.7/lionagi/service/connections/providers/_claude_code/__init__.py +0 -3
  52. lionagi-0.14.7/lionagi/service/connections/providers/_claude_code/models.py +0 -234
  53. lionagi-0.14.7/lionagi/service/connections/providers/_claude_code/stream_cli.py +0 -359
  54. lionagi-0.14.7/lionagi/service/connections/providers/oai_.py +0 -165
  55. lionagi-0.14.7/lionagi/service/connections/providers/perplexity_.py +0 -29
  56. lionagi-0.14.7/lionagi/service/third_party/openai_models.py +0 -18241
  57. lionagi-0.14.7/lionagi/version.py +0 -1
  58. lionagi-0.14.7/scripts/README.md +0 -15
  59. {lionagi-0.14.7 → lionagi-0.14.9}/.coveragerc +0 -0
  60. {lionagi-0.14.7 → lionagi-0.14.9}/.env.example +0 -0
  61. {lionagi-0.14.7 → lionagi-0.14.9}/.github/FUNDING.yml +0 -0
  62. {lionagi-0.14.7 → lionagi-0.14.9}/.github/dependabot.yml +0 -0
  63. {lionagi-0.14.7 → lionagi-0.14.9}/.github/workflows/ci.yml +0 -0
  64. {lionagi-0.14.7 → lionagi-0.14.9}/.github/workflows/codeql.yml +0 -0
  65. {lionagi-0.14.7 → lionagi-0.14.9}/.github/workflows/docs.yml +0 -0
  66. {lionagi-0.14.7 → lionagi-0.14.9}/.github/workflows/release.yml +0 -0
  67. {lionagi-0.14.7 → lionagi-0.14.9}/.gitignore +0 -0
  68. {lionagi-0.14.7 → lionagi-0.14.9}/.pre-commit-config.yaml +0 -0
  69. {lionagi-0.14.7 → lionagi-0.14.9}/.python-version +0 -0
  70. {lionagi-0.14.7 → lionagi-0.14.9}/CODE_OF_CONDUCT.md +0 -0
  71. {lionagi-0.14.7 → lionagi-0.14.9}/CONTRIBUTING.md +0 -0
  72. {lionagi-0.14.7 → lionagi-0.14.9}/LICENSE +0 -0
  73. {lionagi-0.14.7 → lionagi-0.14.9}/assets/operation_builder.gif +0 -0
  74. {lionagi-0.14.7 → lionagi-0.14.9}/cookbooks/001_branch_converse.ipynb +0 -0
  75. {lionagi-0.14.7 → lionagi-0.14.9}/cookbooks/002_branch_interact.ipynb +0 -0
  76. {lionagi-0.14.7 → lionagi-0.14.9}/cookbooks/003_branch_info.ipynb +0 -0
  77. {lionagi-0.14.7 → lionagi-0.14.9}/cookbooks/004_conversation_patterns.ipynb +0 -0
  78. {lionagi-0.14.7 → lionagi-0.14.9}/cookbooks/005_react_basics.ipynb +0 -0
  79. {lionagi-0.14.7 → lionagi-0.14.9}/cookbooks/006_operation_graphs_claim_extraction.ipynb +0 -0
  80. {lionagi-0.14.7 → lionagi-0.14.9}/cookbooks/claude_proxy/README.md +0 -0
  81. {lionagi-0.14.7 → lionagi-0.14.9}/cookbooks/data/002_comedian.json +0 -0
  82. {lionagi-0.14.7 → lionagi-0.14.9}/cookbooks/data/002_critic.json +0 -0
  83. {lionagi-0.14.7 → lionagi-0.14.9}/cookbooks/data/006_lion_proof_ch2.md +0 -0
  84. {lionagi-0.14.7 → lionagi-0.14.9}/cookbooks/using_claude_code.py +0 -0
  85. {lionagi-0.14.7 → lionagi-0.14.9}/docs/Makefile +0 -0
  86. {lionagi-0.14.7 → lionagi-0.14.9}/docs/_static/custom.css +0 -0
  87. {lionagi-0.14.7 → lionagi-0.14.9}/docs/_templates/layout.html +0 -0
  88. {lionagi-0.14.7 → lionagi-0.14.9}/docs/conf.py +0 -0
  89. {lionagi-0.14.7 → lionagi-0.14.9}/docs/discussions/anyio-migration.md +0 -0
  90. {lionagi-0.14.7 → lionagi-0.14.9}/docs/index.rst +0 -0
  91. {lionagi-0.14.7 → lionagi-0.14.9}/docs/modules/action.rst +0 -0
  92. {lionagi-0.14.7 → lionagi-0.14.9}/docs/modules/adapter.rst +0 -0
  93. {lionagi-0.14.7 → lionagi-0.14.9}/docs/modules/branch.rst +0 -0
  94. {lionagi-0.14.7 → lionagi-0.14.9}/docs/modules/branch_operations.rst +0 -0
  95. {lionagi-0.14.7 → lionagi-0.14.9}/docs/modules/concepts.rst +0 -0
  96. {lionagi-0.14.7 → lionagi-0.14.9}/docs/modules/element_id.rst +0 -0
  97. {lionagi-0.14.7 → lionagi-0.14.9}/docs/modules/event.rst +0 -0
  98. {lionagi-0.14.7 → lionagi-0.14.9}/docs/modules/form.rst +0 -0
  99. {lionagi-0.14.7 → lionagi-0.14.9}/docs/modules/graph.rst +0 -0
  100. {lionagi-0.14.7 → lionagi-0.14.9}/docs/modules/index.rst +0 -0
  101. {lionagi-0.14.7 → lionagi-0.14.9}/docs/modules/instruct.rst +0 -0
  102. {lionagi-0.14.7 → lionagi-0.14.9}/docs/modules/lib_file.rst +0 -0
  103. {lionagi-0.14.7 → lionagi-0.14.9}/docs/modules/lib_nested.rst +0 -0
  104. {lionagi-0.14.7 → lionagi-0.14.9}/docs/modules/lib_package.rst +0 -0
  105. {lionagi-0.14.7 → lionagi-0.14.9}/docs/modules/lib_schema.rst +0 -0
  106. {lionagi-0.14.7 → lionagi-0.14.9}/docs/modules/lib_validate.rst +0 -0
  107. {lionagi-0.14.7 → lionagi-0.14.9}/docs/modules/log.rst +0 -0
  108. {lionagi-0.14.7 → lionagi-0.14.9}/docs/modules/mail.rst +0 -0
  109. {lionagi-0.14.7 → lionagi-0.14.9}/docs/modules/message.rst +0 -0
  110. {lionagi-0.14.7 → lionagi-0.14.9}/docs/modules/models.rst +0 -0
  111. {lionagi-0.14.7 → lionagi-0.14.9}/docs/modules/operative_step.rst +0 -0
  112. {lionagi-0.14.7 → lionagi-0.14.9}/docs/modules/pile.rst +0 -0
  113. {lionagi-0.14.7 → lionagi-0.14.9}/docs/modules/processor.rst +0 -0
  114. {lionagi-0.14.7 → lionagi-0.14.9}/docs/modules/progression.rst +0 -0
  115. {lionagi-0.14.7 → lionagi-0.14.9}/docs/modules/service.rst +0 -0
  116. {lionagi-0.14.7 → lionagi-0.14.9}/docs/modules/session.rst +0 -0
  117. {lionagi-0.14.7 → lionagi-0.14.9}/docs/modules/utils.rst +0 -0
  118. {lionagi-0.14.7 → lionagi-0.14.9}/docs/tutorials/get_started.rst +0 -0
  119. {lionagi-0.14.7 → lionagi-0.14.9}/docs/tutorials/get_started_pt2.rst +0 -0
  120. {lionagi-0.14.7 → lionagi-0.14.9}/docs/tutorials/get_started_pt3.rst +0 -0
  121. {lionagi-0.14.7 → lionagi-0.14.9}/docs/tutorials/index.rst +0 -0
  122. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/__init__.py +0 -0
  123. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/_class_registry.py +0 -0
  124. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/adapters/__init__.py +0 -0
  125. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/adapters/async_postgres_adapter.py +0 -0
  126. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/adapters/postgres_model_adapter.py +0 -0
  127. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/fields/__init__.py +0 -0
  128. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/fields/action.py +0 -0
  129. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/fields/base.py +0 -0
  130. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/fields/code.py +0 -0
  131. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/fields/file.py +0 -0
  132. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/fields/reason.py +0 -0
  133. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/fields/research.py +0 -0
  134. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/__init__.py +0 -0
  135. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/concurrency/__init__.py +0 -0
  136. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/concurrency/cancel.py +0 -0
  137. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/concurrency/errors.py +0 -0
  138. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/concurrency/patterns.py +0 -0
  139. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/concurrency/primitives.py +0 -0
  140. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/concurrency/resource_tracker.py +0 -0
  141. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/concurrency/task.py +0 -0
  142. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/file/__init__.py +0 -0
  143. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/file/chunk.py +0 -0
  144. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/file/concat.py +0 -0
  145. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/file/concat_files.py +0 -0
  146. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/file/file_ops.py +0 -0
  147. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/file/params.py +0 -0
  148. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/file/process.py +0 -0
  149. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/file/save.py +0 -0
  150. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/hash/__init__.py +0 -0
  151. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/hash/hash_dict.py +0 -0
  152. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/hash/manager.py +0 -0
  153. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/nested/__init__.py +0 -0
  154. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/nested/flatten.py +0 -0
  155. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/nested/nfilter.py +0 -0
  156. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/nested/nget.py +0 -0
  157. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/nested/ninsert.py +0 -0
  158. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/nested/nmerge.py +0 -0
  159. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/nested/npop.py +0 -0
  160. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/nested/nset.py +0 -0
  161. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/nested/unflatten.py +0 -0
  162. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/nested/utils.py +0 -0
  163. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/package/__init__.py +0 -0
  164. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/package/imports.py +0 -0
  165. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/package/management.py +0 -0
  166. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/package/params.py +0 -0
  167. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/package/system.py +0 -0
  168. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/parse.py +0 -0
  169. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/schema/__init__.py +0 -0
  170. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/schema/as_readable.py +0 -0
  171. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/schema/extract_code_block.py +0 -0
  172. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/schema/extract_docstring.py +0 -0
  173. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/schema/function_to_schema.py +0 -0
  174. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/schema/json_schema.py +0 -0
  175. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/schema/load_pydantic_model_from_schema.py +0 -0
  176. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/token_transform/__init__.py +0 -0
  177. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/token_transform/base.py +0 -0
  178. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/token_transform/llmlingua.py +0 -0
  179. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/token_transform/perplexity.py +0 -0
  180. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/token_transform/symbolic_compress_context.py +0 -0
  181. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/token_transform/synthlang.py +0 -0
  182. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/token_transform/synthlang_/base.py +0 -0
  183. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/token_transform/synthlang_/resources/frameworks/abstract_algebra.toml +0 -0
  184. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/token_transform/synthlang_/resources/frameworks/category_theory.toml +0 -0
  185. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/token_transform/synthlang_/resources/frameworks/complex_analysis.toml +0 -0
  186. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/token_transform/synthlang_/resources/frameworks/framework_options.json +0 -0
  187. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/token_transform/synthlang_/resources/frameworks/group_theory.toml +0 -0
  188. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/token_transform/synthlang_/resources/frameworks/math_logic.toml +0 -0
  189. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/token_transform/synthlang_/resources/frameworks/reflective_patterns.toml +0 -0
  190. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/token_transform/synthlang_/resources/frameworks/set_theory.toml +0 -0
  191. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/token_transform/synthlang_/resources/frameworks/topology_fundamentals.toml +0 -0
  192. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/token_transform/synthlang_/resources/mapping/lion_emoji_mapping.toml +0 -0
  193. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/token_transform/synthlang_/resources/mapping/python_math_mapping.toml +0 -0
  194. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/token_transform/synthlang_/resources/mapping/rust_chinese_mapping.toml +0 -0
  195. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/token_transform/synthlang_/resources/utility/base_synthlang_system_prompt.toml +0 -0
  196. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/token_transform/synthlang_/translate_to_synthlang.py +0 -0
  197. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/token_transform/types.py +0 -0
  198. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/validate/__init__.py +0 -0
  199. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/validate/common_field_validators.py +0 -0
  200. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/validate/fuzzy_match_keys.py +0 -0
  201. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/validate/fuzzy_validate_mapping.py +0 -0
  202. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/validate/string_similarity.py +0 -0
  203. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/libs/validate/validate_boolean.py +0 -0
  204. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/models/__init__.py +0 -0
  205. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/models/field_model.py +0 -0
  206. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/models/hashable_model.py +0 -0
  207. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/models/model_params.py +0 -0
  208. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/models/note.py +0 -0
  209. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/models/schema_model.py +0 -0
  210. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/operations/ReAct/ReAct.py +0 -0
  211. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/operations/ReAct/__init__.py +0 -0
  212. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/operations/ReAct/utils.py +0 -0
  213. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/operations/__init__.py +0 -0
  214. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/operations/_act/__init__.py +0 -0
  215. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/operations/_act/act.py +0 -0
  216. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/operations/brainstorm/__init__.py +0 -0
  217. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/operations/brainstorm/brainstorm.py +0 -0
  218. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/operations/brainstorm/prompt.py +0 -0
  219. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/operations/builder.py +0 -0
  220. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/operations/chat/__init__.py +0 -0
  221. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/operations/chat/chat.py +0 -0
  222. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/operations/communicate/__init__.py +0 -0
  223. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/operations/communicate/communicate.py +0 -0
  224. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/operations/instruct/__init__.py +0 -0
  225. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/operations/instruct/instruct.py +0 -0
  226. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/operations/interpret/__init__.py +0 -0
  227. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/operations/interpret/interpret.py +0 -0
  228. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/operations/manager.py +0 -0
  229. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/operations/node.py +0 -0
  230. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/operations/operate/__init__.py +0 -0
  231. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/operations/operate/operate.py +0 -0
  232. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/operations/parse/__init__.py +0 -0
  233. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/operations/parse/parse.py +0 -0
  234. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/operations/plan/__init__.py +0 -0
  235. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/operations/plan/plan.py +0 -0
  236. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/operations/plan/prompt.py +0 -0
  237. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/operations/select/__init__.py +0 -0
  238. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/operations/select/select.py +0 -0
  239. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/operations/select/utils.py +0 -0
  240. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/operations/translate/__init__.py +0 -0
  241. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/operations/translate/translate.py +0 -0
  242. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/operations/types.py +0 -0
  243. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/operations/utils.py +0 -0
  244. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/protocols/__init__.py +0 -0
  245. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/protocols/_concepts.py +0 -0
  246. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/protocols/action/__init__.py +0 -0
  247. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/protocols/action/function_calling.py +0 -0
  248. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/protocols/action/manager.py +0 -0
  249. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/protocols/action/tool.py +0 -0
  250. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/protocols/forms/__init__.py +0 -0
  251. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/protocols/forms/base.py +0 -0
  252. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/protocols/forms/flow.py +0 -0
  253. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/protocols/forms/form.py +0 -0
  254. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/protocols/forms/report.py +0 -0
  255. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/protocols/generic/__init__.py +0 -0
  256. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/protocols/generic/element.py +0 -0
  257. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/protocols/generic/pile.py +0 -0
  258. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/protocols/generic/processor.py +0 -0
  259. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/protocols/generic/progression.py +0 -0
  260. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/protocols/graph/__init__.py +0 -0
  261. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/protocols/graph/edge.py +0 -0
  262. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/protocols/graph/graph.py +0 -0
  263. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/protocols/graph/node.py +0 -0
  264. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/protocols/mail/__init__.py +0 -0
  265. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/protocols/mail/exchange.py +0 -0
  266. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/protocols/mail/mail.py +0 -0
  267. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/protocols/mail/mailbox.py +0 -0
  268. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/protocols/mail/manager.py +0 -0
  269. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/protocols/mail/package.py +0 -0
  270. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/protocols/messages/__init__.py +0 -0
  271. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/protocols/messages/action_request.py +0 -0
  272. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/protocols/messages/action_response.py +0 -0
  273. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/protocols/messages/assistant_response.py +0 -0
  274. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/protocols/messages/base.py +0 -0
  275. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/protocols/messages/instruction.py +0 -0
  276. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/protocols/messages/manager.py +0 -0
  277. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/protocols/messages/message.py +0 -0
  278. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/protocols/messages/system.py +0 -0
  279. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/protocols/messages/templates/README.md +0 -0
  280. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/protocols/messages/templates/action_request.jinja2 +0 -0
  281. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/protocols/messages/templates/action_response.jinja2 +0 -0
  282. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/protocols/messages/templates/assistant_response.jinja2 +0 -0
  283. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/protocols/messages/templates/instruction_message.jinja2 +0 -0
  284. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/protocols/messages/templates/system_message.jinja2 +0 -0
  285. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/protocols/messages/templates/tool_schemas.jinja2 +0 -0
  286. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/protocols/operatives/__init__.py +0 -0
  287. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/protocols/operatives/operative.py +0 -0
  288. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/py.typed +0 -0
  289. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/service/connections/__init__.py +0 -0
  290. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/service/connections/endpoint.py +0 -0
  291. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/service/connections/providers/__init__.py +0 -0
  292. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/service/manager.py +0 -0
  293. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/service/rate_limited_processor.py +0 -0
  294. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/service/resilience.py +0 -0
  295. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/service/third_party/README.md +0 -0
  296. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/service/third_party/__init__.py +0 -0
  297. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/service/third_party/anthropic_models.py +0 -0
  298. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/service/third_party/exa_models.py +0 -0
  299. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/service/token_calculator.py +0 -0
  300. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/session/__init__.py +0 -0
  301. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/session/prompts.py +0 -0
  302. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/session/session.py +0 -0
  303. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/settings.py +0 -0
  304. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/tools/__init__.py +0 -0
  305. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/tools/file/__init__.py +0 -0
  306. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/tools/file/reader.py +0 -0
  307. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/tools/memory/tools.py +0 -0
  308. {lionagi-0.14.7 → lionagi-0.14.9}/lionagi/tools/types.py +0 -0
  309. {lionagi-0.14.7 → lionagi-0.14.9}/main.py +0 -0
  310. {lionagi-0.14.7 → lionagi-0.14.9}/scripts/concat.py +0 -0
  311. {lionagi-0.14.7 → lionagi-0.14.9}/scripts/config.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lionagi
3
- Version: 0.14.7
3
+ Version: 0.14.9
4
4
  Summary: An Intelligence Operating System.
5
5
  Author-email: HaiyangLi <quantocean.li@gmail.com>, Liangbingyan Luo <llby_luo@outlook.com>
6
6
  License: Apache License
@@ -272,7 +272,7 @@ Description-Content-Type: text/markdown
272
272
 
273
273
  [Documentation](https://lion-agi.github.io/lionagi/) |
274
274
  [Discord](https://discord.gg/JDj9ENhUE8) |
275
- [PyPI](https://pypi.org/project/lionagi/) |
275
+ [PyPI](https://pypi.org/project/lionagi/)
276
276
 
277
277
  # LION - Language InterOperable Network
278
278
 
@@ -295,7 +295,9 @@ integrations, and custom validations in a single coherent pipeline.
295
295
  ## Installation
296
296
 
297
297
  ```
298
- pip install lionagi
298
+ uv add lionagi # recommended to use pyproject and uv for dependency management
299
+
300
+ pip install lionagi # or install directly
299
301
  ```
300
302
 
301
303
  ## Quick Start
@@ -304,12 +306,12 @@ pip install lionagi
304
306
  from lionagi import Branch, iModel
305
307
 
306
308
  # Pick a model
307
- gpt4o = iModel(provider="openai", model="gpt-4o")
309
+ gpt41 = iModel(provider="openai", model="gpt-4.1-mini")
308
310
 
309
311
  # Create a Branch (conversation context)
310
312
  hunter = Branch(
311
313
  system="you are a hilarious dragon hunter who responds in 10 words rhymes.",
312
- chat_model=gpt4o,
314
+ chat_model=gpt41,
313
315
  )
314
316
 
315
317
  # Communicate asynchronously
@@ -390,41 +392,75 @@ print(df.tail())
390
392
  ```python
391
393
  from lionagi import Branch, iModel
392
394
 
393
- gpt4o = iModel(provider="openai", model="gpt-4o")
394
395
  sonnet = iModel(
395
396
  provider="anthropic",
396
397
  model="claude-3-5-sonnet-20241022",
397
398
  max_tokens=1000, # max_tokens is required for anthropic models
398
399
  )
399
400
 
400
- branch = Branch(chat_model=gpt4o)
401
- # Switch mid-flow
402
- analysis = await branch.communicate("Analyze these stats", imodel=sonnet)
401
+ branch = Branch(chat_model=gpt41)
402
+ analysis = await branch.communicate("Analyze these stats", chat_model=sonnet) # Switch mid-flow
403
403
  ```
404
404
 
405
405
  Seamlessly route to different models in the same workflow.
406
406
 
407
407
  ### Claude Code Integration
408
408
 
409
- LionAGI now supports Anthropic's [Claude Code Python SDK](https://github.com/anthropics/claude-code-sdk-python), enabling autonomous coding capabilities with persistent session management:
409
+ LionAGI now supports Anthropic's Claude Code [Python SDK](https://github.com/anthropics/claude-code-sdk-python), and [CLI SDK](https://docs.anthropic.com/en/docs/claude-code/sdk) enabling autonomous coding capabilities with persistent session management. The CLI endpoint
410
+ directly connects to claude code, and is recommended, you can either use it via a [proxy server](https://github.com/khive-ai/lionagi/tree/main/cookbooks/claude_proxy) or directly with `query_cli` endpoint, provided you have already logged onto claude code cli in your terminal.
410
411
 
411
412
  ```python
412
413
  from lionagi import iModel, Branch
413
414
 
414
- # Create a Claude Code model
415
- model = iModel(
416
- provider="claude_code",
417
- endpoint="query_cli",
418
- model="sonnet",
419
- allowed_tools=["Write", "Read", "Edit"], # Control which tools Claude can use
420
- permission_mode = "bypassPermissions", # Bypass tool permission checks (use with caution!),
421
- verbose_output=True, # Enable detailed output for debugging
422
- )
415
+ def create_cc_model():
416
+ return iModel(
417
+ provider="claude_code",
418
+ endpoint="query_cli",
419
+ model="sonnet",
420
+ verbose_output=True, # Enable detailed output for debugging
421
+ )
423
422
 
424
423
  # Start a coding session
425
- branch = Branch(chat_model=model)
426
- response = await branch.communicate("Explain the architecture of protocols, operations, and branch")
427
- response2 = await branch.communicate("how do these parts form lionagi system")
424
+ orchestrator = Branch(chat_model=create_cc_model())
425
+ response = await orchestrator.communicate("Explain the architecture of protocols, operations, and branch")
426
+
427
+ # continue the session with more queries
428
+ response2 = await orchestrator.communicate("how do these parts form lionagi system")
429
+ ```
430
+
431
+ ### Fan out fan in pattern orchestration with claude code
432
+
433
+ ```python
434
+ # use structured outputs with claude code
435
+ from lionagi.fields import LIST_INSTRUCT_FIELD_MODEL, Instruct
436
+
437
+ response3 = await orchestrator.operate(
438
+ instruct=Instruct(
439
+ instruction="create 4 research questions for parallel discovery",
440
+ guidance="put into `instruct_models` field as part of your structured result message",
441
+ context="I'd like to create an orchestration system for AI agents using lionagi"
442
+ ),
443
+ field_models=[LIST_INSTRUCT_FIELD_MODEL],
444
+ )
445
+
446
+ len(response3.instruct_models) # should be 4
447
+
448
+ async def handle_instruct(instruct):
449
+ sub_branch = Branch(
450
+ system="You are an diligent research expert.",
451
+ chat_model=create_cc_model(),
452
+ )
453
+ return await sub_branch.operate(instruct=instruct)
454
+
455
+ # run in parallel across all instruct models
456
+ from lionagi.utils import alcall
457
+ responses = await alcall(response3.instruct_models, handle_instruct)
458
+
459
+ # now hand these reports back to the orchestrator
460
+ final_response = await orchestrator.communicate(
461
+ "please synthesize these research findings into a final report",
462
+ context=responses,
463
+ )
428
464
  ```
429
465
 
430
466
  Key features:
@@ -436,9 +472,14 @@ Key features:
436
472
  ### optional dependencies
437
473
 
438
474
  ```
439
- pip install "lionagi[reader]"
440
- pip install "lionagi[ollama]"
441
- pip install "lionagi[claude-code]"
475
+ "lionagi[reader]" - Reader tool for any unstructured data and web pages
476
+ "lionagi[ollama]" - Ollama model support for local inference
477
+ "lionagi[claude-code]" - Claude code python SDK integration (cli endpoint does not require this)
478
+ "lionagi[rich]" - Rich output formatting for better console display
479
+ "lionagi[schema]" - Convert pydantic schema to make the Model class persistent
480
+ "lionagi[postgres]" - Postgres database support for storing and retrieving structured data
481
+ "lionagi[graph]" - Graph display for visualizing complex workflows
482
+ "lionagi[sqlite]" - SQLite database support for lightweight data storage (also need `postgres` option)
442
483
  ```
443
484
 
444
485
  ## Community & Contributing
@@ -4,7 +4,7 @@
4
4
 
5
5
  [Documentation](https://lion-agi.github.io/lionagi/) |
6
6
  [Discord](https://discord.gg/JDj9ENhUE8) |
7
- [PyPI](https://pypi.org/project/lionagi/) |
7
+ [PyPI](https://pypi.org/project/lionagi/)
8
8
 
9
9
  # LION - Language InterOperable Network
10
10
 
@@ -27,7 +27,9 @@ integrations, and custom validations in a single coherent pipeline.
27
27
  ## Installation
28
28
 
29
29
  ```
30
- pip install lionagi
30
+ uv add lionagi # recommended to use pyproject and uv for dependency management
31
+
32
+ pip install lionagi # or install directly
31
33
  ```
32
34
 
33
35
  ## Quick Start
@@ -36,12 +38,12 @@ pip install lionagi
36
38
  from lionagi import Branch, iModel
37
39
 
38
40
  # Pick a model
39
- gpt4o = iModel(provider="openai", model="gpt-4o")
41
+ gpt41 = iModel(provider="openai", model="gpt-4.1-mini")
40
42
 
41
43
  # Create a Branch (conversation context)
42
44
  hunter = Branch(
43
45
  system="you are a hilarious dragon hunter who responds in 10 words rhymes.",
44
- chat_model=gpt4o,
46
+ chat_model=gpt41,
45
47
  )
46
48
 
47
49
  # Communicate asynchronously
@@ -122,41 +124,75 @@ print(df.tail())
122
124
  ```python
123
125
  from lionagi import Branch, iModel
124
126
 
125
- gpt4o = iModel(provider="openai", model="gpt-4o")
126
127
  sonnet = iModel(
127
128
  provider="anthropic",
128
129
  model="claude-3-5-sonnet-20241022",
129
130
  max_tokens=1000, # max_tokens is required for anthropic models
130
131
  )
131
132
 
132
- branch = Branch(chat_model=gpt4o)
133
- # Switch mid-flow
134
- analysis = await branch.communicate("Analyze these stats", imodel=sonnet)
133
+ branch = Branch(chat_model=gpt41)
134
+ analysis = await branch.communicate("Analyze these stats", chat_model=sonnet) # Switch mid-flow
135
135
  ```
136
136
 
137
137
  Seamlessly route to different models in the same workflow.
138
138
 
139
139
  ### Claude Code Integration
140
140
 
141
- LionAGI now supports Anthropic's [Claude Code Python SDK](https://github.com/anthropics/claude-code-sdk-python), enabling autonomous coding capabilities with persistent session management:
141
+ LionAGI now supports Anthropic's Claude Code [Python SDK](https://github.com/anthropics/claude-code-sdk-python), and [CLI SDK](https://docs.anthropic.com/en/docs/claude-code/sdk) enabling autonomous coding capabilities with persistent session management. The CLI endpoint
142
+ directly connects to claude code, and is recommended, you can either use it via a [proxy server](https://github.com/khive-ai/lionagi/tree/main/cookbooks/claude_proxy) or directly with `query_cli` endpoint, provided you have already logged onto claude code cli in your terminal.
142
143
 
143
144
  ```python
144
145
  from lionagi import iModel, Branch
145
146
 
146
- # Create a Claude Code model
147
- model = iModel(
148
- provider="claude_code",
149
- endpoint="query_cli",
150
- model="sonnet",
151
- allowed_tools=["Write", "Read", "Edit"], # Control which tools Claude can use
152
- permission_mode = "bypassPermissions", # Bypass tool permission checks (use with caution!),
153
- verbose_output=True, # Enable detailed output for debugging
154
- )
147
+ def create_cc_model():
148
+ return iModel(
149
+ provider="claude_code",
150
+ endpoint="query_cli",
151
+ model="sonnet",
152
+ verbose_output=True, # Enable detailed output for debugging
153
+ )
155
154
 
156
155
  # Start a coding session
157
- branch = Branch(chat_model=model)
158
- response = await branch.communicate("Explain the architecture of protocols, operations, and branch")
159
- response2 = await branch.communicate("how do these parts form lionagi system")
156
+ orchestrator = Branch(chat_model=create_cc_model())
157
+ response = await orchestrator.communicate("Explain the architecture of protocols, operations, and branch")
158
+
159
+ # continue the session with more queries
160
+ response2 = await orchestrator.communicate("how do these parts form lionagi system")
161
+ ```
162
+
163
+ ### Fan out fan in pattern orchestration with claude code
164
+
165
+ ```python
166
+ # use structured outputs with claude code
167
+ from lionagi.fields import LIST_INSTRUCT_FIELD_MODEL, Instruct
168
+
169
+ response3 = await orchestrator.operate(
170
+ instruct=Instruct(
171
+ instruction="create 4 research questions for parallel discovery",
172
+ guidance="put into `instruct_models` field as part of your structured result message",
173
+ context="I'd like to create an orchestration system for AI agents using lionagi"
174
+ ),
175
+ field_models=[LIST_INSTRUCT_FIELD_MODEL],
176
+ )
177
+
178
+ len(response3.instruct_models) # should be 4
179
+
180
+ async def handle_instruct(instruct):
181
+ sub_branch = Branch(
182
+ system="You are an diligent research expert.",
183
+ chat_model=create_cc_model(),
184
+ )
185
+ return await sub_branch.operate(instruct=instruct)
186
+
187
+ # run in parallel across all instruct models
188
+ from lionagi.utils import alcall
189
+ responses = await alcall(response3.instruct_models, handle_instruct)
190
+
191
+ # now hand these reports back to the orchestrator
192
+ final_response = await orchestrator.communicate(
193
+ "please synthesize these research findings into a final report",
194
+ context=responses,
195
+ )
160
196
  ```
161
197
 
162
198
  Key features:
@@ -168,9 +204,14 @@ Key features:
168
204
  ### optional dependencies
169
205
 
170
206
  ```
171
- pip install "lionagi[reader]"
172
- pip install "lionagi[ollama]"
173
- pip install "lionagi[claude-code]"
207
+ "lionagi[reader]" - Reader tool for any unstructured data and web pages
208
+ "lionagi[ollama]" - Ollama model support for local inference
209
+ "lionagi[claude-code]" - Claude code python SDK integration (cli endpoint does not require this)
210
+ "lionagi[rich]" - Rich output formatting for better console display
211
+ "lionagi[schema]" - Convert pydantic schema to make the Model class persistent
212
+ "lionagi[postgres]" - Postgres database support for storing and retrieving structured data
213
+ "lionagi[graph]" - Graph display for visualizing complex workflows
214
+ "lionagi[sqlite]" - SQLite database support for lightweight data storage (also need `postgres` option)
174
215
  ```
175
216
 
176
217
  ## Community & Contributing
@@ -1,5 +1,6 @@
1
- from lionagi import Branch, Builder, Session, iModel
1
+ from lionagi import Branch, Builder, Operation, Session, iModel
2
2
  from lionagi.fields import LIST_INSTRUCT_FIELD_MODEL, Instruct
3
+ from lionagi.protocols.types import AssistantResponse
3
4
 
4
5
  CC_WORKSPACE = ".khive/workspace"
5
6
 
@@ -15,7 +16,6 @@ def create_cc(
15
16
  provider="claude_code",
16
17
  endpoint="query_cli",
17
18
  model=model,
18
- api_key="dummy_api_key",
19
19
  ws=f"{CC_WORKSPACE}/{subdir}",
20
20
  verbose_output=verbose_output,
21
21
  add_dir="../../../",
@@ -26,7 +26,7 @@ def create_cc(
26
26
 
27
27
 
28
28
  prompt = """
29
- Task: Investigate the codebase in the specified directory and provide a comprehensive overview.
29
+ Task: Quickly Investigate the codebase in the specified directory and provide a comprehensive overview.
30
30
 
31
31
  ---START
32
32
  read into the specified dir, glance over the key components and pay attention to architecture,
@@ -86,16 +86,44 @@ async def main():
86
86
  )
87
87
  research_nodes.append(node)
88
88
 
89
- synthesis = builder.add_aggregation(
89
+ costs = 0
90
+
91
+ def get_context(node_id):
92
+ nonlocal costs
93
+ g = builder.get_graph()
94
+ node: Operation = g.internal_nodes[node_id]
95
+ branch = session.get_branch(node.branch_id, None)
96
+ if (
97
+ branch
98
+ and len(branch.messages) > 0
99
+ and isinstance(msg := branch.messages[-1], AssistantResponse)
100
+ ):
101
+ costs += msg.model_response.get("total_cost_usd") or 0
102
+ return f"""
103
+ Response: {msg.model_response.get("result") or "Not available"}
104
+ Summary: {msg.model_response.get("summary") or "Not available"}
105
+ """.strip()
106
+
107
+ await session.flow(builder.get_graph())
108
+ ctx = [get_context(i) for i in research_nodes]
109
+
110
+ synthesis = builder.add_operation(
90
111
  "communicate",
91
- source_node_ids=research_nodes,
112
+ depends_on=research_nodes,
92
113
  branch=orc_branch,
93
114
  instruction="Synthesize the information from the researcher branches.",
115
+ context=[i for i in ctx if i is not None],
116
+ )
117
+
118
+ result3 = await session.flow(builder.get_graph())
119
+ result_synthesis = result3["operation_results"][synthesis]
120
+
121
+ builder.visualize(
122
+ "LionAGI codebase investigation: fan-out fan-in pattern with Claude Code"
94
123
  )
95
124
 
96
- result2 = await session.flow(builder.get_graph())
97
- result_synthesis = result2["operation_results"][synthesis]
98
125
  print(result_synthesis)
126
+ print(f"Flow total cost: ${costs:.4f}")
99
127
 
100
128
  except Exception as e:
101
129
  print(f"Error: {e}")
@@ -47,12 +47,10 @@ app = FastAPI(
47
47
  def check_claude_code():
48
48
  """Verify Claude Code CLI is installed and accessible"""
49
49
  try:
50
- from lionagi.service.connections.providers._claude_code.stream_cli import (
51
- CLAUDE,
52
- )
50
+ from lionagi.service.third_party.claude_code import CLAUDE_CLI
53
51
 
54
52
  result = subprocess.run(
55
- [CLAUDE, "--version"], capture_output=True, text=True
53
+ [CLAUDE_CLI, "--version"], capture_output=True, text=True
56
54
  )
57
55
  if result.returncode != 0:
58
56
  raise RuntimeError(
@@ -75,7 +73,6 @@ async def health_check():
75
73
 
76
74
  @app.post("/v1/query")
77
75
  async def query(request: ClaudeCodeRequest):
78
-
79
76
  endpoint = ClaudeCodeCLIEndpoint()
80
77
  try:
81
78
  return await endpoint._call(payload={"request": request}, headers={})
@@ -0,0 +1,100 @@
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": null,
6
+ "id": "d2ceb407",
7
+ "metadata": {},
8
+ "outputs": [],
9
+ "source": [
10
+ "from lionagi.service.connections.endpoint_config import EndpointConfig\n",
11
+ "from lionagi.service.imodel import Endpoint\n",
12
+ "from lionagi.service.connections.providers.claude_code_cli import (\n",
13
+ " ClaudeCodeRequest,\n",
14
+ ")\n",
15
+ "\n",
16
+ "claude_code_config = EndpointConfig(\n",
17
+ " name=\"claude_code_cli_proxy\",\n",
18
+ " provider=\"claude_code\",\n",
19
+ " base_url=\"http://localhost:8000/v1\",\n",
20
+ " endpoint=\"query\",\n",
21
+ " api_key=\"dummy_api_key\",\n",
22
+ " kwargs={\"model\": \"sonnet\"},\n",
23
+ ")\n",
24
+ "claude_code = Endpoint(claude_code_config)"
25
+ ]
26
+ },
27
+ {
28
+ "cell_type": "code",
29
+ "execution_count": null,
30
+ "id": "5fc216f4",
31
+ "metadata": {},
32
+ "outputs": [],
33
+ "source": [
34
+ "# prompt = \"reply in text only, Write a Python function to calculate the factorial of a number.\"\n",
35
+ "\n",
36
+ "# await claude_code.call(request=ClaudeCodeRequest(prompt=prompt))"
37
+ ]
38
+ },
39
+ {
40
+ "cell_type": "code",
41
+ "execution_count": null,
42
+ "id": "4c173814",
43
+ "metadata": {},
44
+ "outputs": [],
45
+ "source": [
46
+ "from lionagi import iModel\n",
47
+ "\n",
48
+ "claude_code = iModel(endpoint=claude_code)"
49
+ ]
50
+ },
51
+ {
52
+ "cell_type": "code",
53
+ "execution_count": null,
54
+ "id": "fe6dcca4",
55
+ "metadata": {},
56
+ "outputs": [],
57
+ "source": [
58
+ "result = await claude_code.invoke(\n",
59
+ " messages=[\n",
60
+ " {\n",
61
+ " \"role\": \"user\",\n",
62
+ " \"content\": \"reply in text only, Write a Python function to calculate the factorial of a number.\",\n",
63
+ " }\n",
64
+ " ]\n",
65
+ ")"
66
+ ]
67
+ },
68
+ {
69
+ "cell_type": "code",
70
+ "execution_count": null,
71
+ "id": "88db9e9a",
72
+ "metadata": {},
73
+ "outputs": [],
74
+ "source": [
75
+ "result.response"
76
+ ]
77
+ }
78
+ ],
79
+ "metadata": {
80
+ "kernelspec": {
81
+ "display_name": "lionagi",
82
+ "language": "python",
83
+ "name": "python3"
84
+ },
85
+ "language_info": {
86
+ "codemirror_mode": {
87
+ "name": "ipython",
88
+ "version": 3
89
+ },
90
+ "file_extension": ".py",
91
+ "mimetype": "text/x-python",
92
+ "name": "python",
93
+ "nbconvert_exporter": "python",
94
+ "pygments_lexer": "ipython3",
95
+ "version": "3.10.15"
96
+ }
97
+ },
98
+ "nbformat": 4,
99
+ "nbformat_minor": 5
100
+ }
@@ -0,0 +1,148 @@
1
+ # Copyright (c) 2023 - 2025, HaiyangLi <quantocean.li at gmail dot com>
2
+ #
3
+ # SPDX-License-Identifier: Apache-2.0
4
+
5
+ from __future__ import annotations
6
+
7
+ from typing import Any, ClassVar
8
+
9
+ __all__ = (
10
+ "LionError",
11
+ "ValidationError",
12
+ "NotFoundError",
13
+ "ExistsError",
14
+ "ObservationError",
15
+ "ResourceError",
16
+ "RateLimitError",
17
+ "IDError",
18
+ "RelationError",
19
+ "OperationError",
20
+ "ExecutionError",
21
+ "ItemNotFoundError",
22
+ "ItemExistsError",
23
+ )
24
+
25
+
26
+ class LionError(Exception):
27
+ default_message: ClassVar[str] = "LionAGI error"
28
+ default_status_code: ClassVar[int] = 500
29
+ __slots__ = ("message", "details", "status_code")
30
+
31
+ def __init__(
32
+ self,
33
+ message: str | None = None,
34
+ *,
35
+ details: dict[str, Any] | None = None,
36
+ status_code: int | None = None,
37
+ cause: Exception | None = None,
38
+ ):
39
+ super().__init__(message or self.default_message)
40
+ if cause:
41
+ self.__cause__ = cause # preserves traceback
42
+ self.message = message or self.default_message
43
+ self.details = details or {}
44
+ self.status_code = status_code or type(self).default_status_code
45
+
46
+ def to_dict(self, *, include_cause: bool = False) -> dict[str, Any]:
47
+ data = {
48
+ "error": self.__class__.__name__,
49
+ "message": self.message,
50
+ "status_code": self.status_code,
51
+ **({"details": self.details} if self.details else {}),
52
+ }
53
+ if include_cause and (cause := self.get_cause()):
54
+ data["cause"] = repr(cause)
55
+ return data
56
+
57
+ def get_cause(self) -> Exception | None:
58
+ """Get the cause of this error, if any."""
59
+ return self.__cause__ if hasattr(self, "__cause__") else None
60
+
61
+ @classmethod
62
+ def from_value(
63
+ cls,
64
+ value: Any,
65
+ *,
66
+ expected: str | None = None,
67
+ message: str | None = None,
68
+ cause: Exception | None = None,
69
+ **extra: Any,
70
+ ):
71
+ """Create a ValidationError from a value with optional expected type and message."""
72
+ details = {
73
+ "value": value,
74
+ "type": type(value).__name__,
75
+ **({"expected": expected} if expected else {}),
76
+ **extra,
77
+ }
78
+ return cls(message=message, details=details, cause=cause)
79
+
80
+
81
+ class ValidationError(LionError):
82
+ """Exception raised when validation fails."""
83
+
84
+ default_message = "Validation failed"
85
+ default_status_code = 422
86
+ __slots__ = ()
87
+
88
+
89
+ class NotFoundError(LionError):
90
+ """Exception raised when an item is not found."""
91
+
92
+ default_message = "Item not found"
93
+ default_status_code = 404
94
+ __slots__ = ()
95
+
96
+
97
+ class ExistsError(LionError):
98
+ """Exception raised when an item already exists."""
99
+
100
+ default_message = "Item already exists"
101
+ default_status_code = 409
102
+ __slots__ = ()
103
+
104
+
105
+ class ObservationError(LionError):
106
+ """Exception raised when an observation fails."""
107
+
108
+ default_message = "Observation failed"
109
+ default_status_code = 500
110
+ __slots__ = ()
111
+
112
+
113
+ class ResourceError(LionError):
114
+ """Exception raised when resource access fails."""
115
+
116
+ default_message = "Resource error"
117
+ default_status_code = 429
118
+ __slots__ = ()
119
+
120
+
121
+ class RateLimitError(LionError):
122
+ __slots__ = ("retry_after",) # one extra attr
123
+ default_message = "Rate limit exceeded"
124
+ default_status_code = 429
125
+
126
+ def __init__(self, retry_after: float, **kw):
127
+ super().__init__(**kw)
128
+ object.__setattr__(self, "retry_after", retry_after)
129
+
130
+
131
+ class IDError(LionError):
132
+ pass
133
+
134
+
135
+ class RelationError(LionError):
136
+ pass
137
+
138
+
139
+ class OperationError(LionError):
140
+ pass
141
+
142
+
143
+ class ExecutionError(LionError):
144
+ pass
145
+
146
+
147
+ ItemNotFoundError = NotFoundError
148
+ ItemExistsError = ExistsError
@@ -0,0 +1,3 @@
1
+ from .fields import *
2
+ from .models import *
3
+ from .protocols.types import *
@@ -63,12 +63,14 @@ class AppSettings(BaseSettings, frozen=True):
63
63
  GROQ_API_KEY: SecretStr | None = None
64
64
  ANTHROPIC_API_KEY: SecretStr | None = None
65
65
 
66
+ OPENAI_DEFAULT_MODEL: str = "gpt-4.1-mini"
67
+
66
68
  # defaults models
67
69
  LIONAGI_EMBEDDING_PROVIDER: str = "openai"
68
70
  LIONAGI_EMBEDDING_MODEL: str = "text-embedding-3-small"
69
71
 
70
72
  LIONAGI_CHAT_PROVIDER: str = "openai"
71
- LIONAGI_CHAT_MODEL: str = "gpt-4.1-nano"
73
+ LIONAGI_CHAT_MODEL: str = "gpt-4.1-mini"
72
74
 
73
75
  # default storage
74
76
  LIONAGI_AUTO_STORE_EVENT: bool = False
@@ -11,7 +11,6 @@ from lionagi.libs.validate.common_field_validators import (
11
11
  validate_nullable_jsonvalue_field,
12
12
  )
13
13
  from lionagi.models import FieldModel, HashableModel
14
- from lionagi.utils import to_num
15
14
 
16
15
  __all__ = (
17
16
  "Instruct",