agentica 0.2.1__tar.gz → 0.2.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. agentica-0.2.3/MANIFEST.in +1 -0
  2. {agentica-0.2.1 → agentica-0.2.3}/PKG-INFO +35 -22
  3. {agentica-0.2.1 → agentica-0.2.3}/README.md +34 -21
  4. {agentica-0.2.1 → agentica-0.2.3}/agentica/__init__.py +3 -1
  5. {agentica-0.2.1 → agentica-0.2.3}/agentica/agent.py +4 -2
  6. agentica-0.2.3/agentica/emb/zhipuai_emb.py +15 -0
  7. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/doubao/chat.py +1 -1
  8. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/message.py +4 -3
  9. agentica-0.2.3/agentica/model/zhipuai/__init__.py +1 -0
  10. agentica-0.2.3/agentica/model/zhipuai/chat.py +24 -0
  11. {agentica-0.2.1 → agentica-0.2.3}/agentica/python_agent.py +5 -0
  12. agentica-0.2.3/agentica/react_agent.py +195 -0
  13. agentica-0.2.3/agentica/tools/cogvideo_tool.py +153 -0
  14. agentica-0.2.3/agentica/tools/cogview_tool.py +127 -0
  15. agentica-0.2.1/agentica/tools/create_image_tool.py → agentica-0.2.3/agentica/tools/dalle_tool.py +5 -5
  16. {agentica-0.2.1 → agentica-0.2.3}/agentica/tools/jina_tool.py +0 -1
  17. agentica-0.2.3/agentica/tools/string_tool.py +61 -0
  18. {agentica-0.2.1 → agentica-0.2.3}/agentica/tools/url_crawler_tool.py +20 -6
  19. agentica-0.2.3/agentica/tools/web_search_pro_tool.py +81 -0
  20. {agentica-0.2.1 → agentica-0.2.3}/agentica/utils/file_parser.py +51 -87
  21. agentica-0.2.3/agentica/version.py +1 -0
  22. {agentica-0.2.1 → agentica-0.2.3}/agentica.egg-info/PKG-INFO +35 -22
  23. {agentica-0.2.1 → agentica-0.2.3}/agentica.egg-info/SOURCES.txt +11 -9
  24. {agentica-0.2.1 → agentica-0.2.3}/agentica.egg-info/top_level.txt +0 -1
  25. {agentica-0.2.1 → agentica-0.2.3}/setup.py +4 -1
  26. agentica-0.2.1/agentica/version.py +0 -1
  27. agentica-0.2.1/tests/__init__.py +0 -5
  28. agentica-0.2.1/tests/test_create_image.py +0 -43
  29. agentica-0.2.1/tests/test_file_reader.py +0 -65
  30. agentica-0.2.1/tests/test_jina_tool.py +0 -80
  31. agentica-0.2.1/tests/test_llm.py +0 -34
  32. agentica-0.2.1/tests/test_run_nb_code.py +0 -119
  33. agentica-0.2.1/tests/test_url_crawler.py +0 -120
  34. {agentica-0.2.1 → agentica-0.2.3}/LICENSE +0 -0
  35. {agentica-0.2.1 → agentica-0.2.3}/agentica/agent_session.py +0 -0
  36. {agentica-0.2.1 → agentica-0.2.3}/agentica/config.py +0 -0
  37. {agentica-0.2.1 → agentica-0.2.3}/agentica/document.py +0 -0
  38. {agentica-0.2.1 → agentica-0.2.3}/agentica/emb/__init__.py +0 -0
  39. {agentica-0.2.1 → agentica-0.2.3}/agentica/emb/azure_openai_emb.py +0 -0
  40. {agentica-0.2.1 → agentica-0.2.3}/agentica/emb/base.py +0 -0
  41. {agentica-0.2.1 → agentica-0.2.3}/agentica/emb/fireworks_emb.py +0 -0
  42. {agentica-0.2.1 → agentica-0.2.3}/agentica/emb/genimi_emb.py +0 -0
  43. {agentica-0.2.1 → agentica-0.2.3}/agentica/emb/hash_emb.py +0 -0
  44. {agentica-0.2.1 → agentica-0.2.3}/agentica/emb/huggingface_emb.py +0 -0
  45. {agentica-0.2.1 → agentica-0.2.3}/agentica/emb/ollama_emb.py +0 -0
  46. {agentica-0.2.1 → agentica-0.2.3}/agentica/emb/openai_emb.py +0 -0
  47. {agentica-0.2.1 → agentica-0.2.3}/agentica/emb/sentence_transformer_emb.py +0 -0
  48. {agentica-0.2.1 → agentica-0.2.3}/agentica/emb/text2vec_emb.py +0 -0
  49. {agentica-0.2.1 → agentica-0.2.3}/agentica/emb/together_emb.py +0 -0
  50. {agentica-0.2.1 → agentica-0.2.3}/agentica/emb/word2vec_emb.py +0 -0
  51. {agentica-0.2.1 → agentica-0.2.3}/agentica/file/__init__.py +0 -0
  52. {agentica-0.2.1 → agentica-0.2.3}/agentica/file/base.py +0 -0
  53. {agentica-0.2.1 → agentica-0.2.3}/agentica/file/csv.py +0 -0
  54. {agentica-0.2.1 → agentica-0.2.3}/agentica/file/txt.py +0 -0
  55. {agentica-0.2.1 → agentica-0.2.3}/agentica/knowledge/__init__.py +0 -0
  56. {agentica-0.2.1 → agentica-0.2.3}/agentica/knowledge/base.py +0 -0
  57. {agentica-0.2.1 → agentica-0.2.3}/agentica/knowledge/langchain_knowledge.py +0 -0
  58. {agentica-0.2.1 → agentica-0.2.3}/agentica/knowledge/llamaindex_knowledge.py +0 -0
  59. {agentica-0.2.1 → agentica-0.2.3}/agentica/memory.py +0 -0
  60. {agentica-0.2.1 → agentica-0.2.3}/agentica/memorydb.py +0 -0
  61. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/__init__.py +0 -0
  62. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/anthropic/__init__.py +0 -0
  63. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/anthropic/claude.py +0 -0
  64. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/aws/__init__.py +0 -0
  65. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/aws/api_client.py +0 -0
  66. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/aws/bedrock.py +0 -0
  67. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/aws/claude.py +0 -0
  68. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/azure/__init__.py +0 -0
  69. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/azure/openai_chat.py +0 -0
  70. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/base.py +0 -0
  71. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/cohere/__init__.py +0 -0
  72. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/cohere/chat.py +0 -0
  73. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/content.py +0 -0
  74. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/deepseek/__init__.py +0 -0
  75. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/deepseek/chat.py +0 -0
  76. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/doubao/__init__.py +0 -0
  77. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/fireworks/__init__.py +0 -0
  78. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/fireworks/fireworks.py +0 -0
  79. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/google/__init__.py +0 -0
  80. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/google/gemini.py +0 -0
  81. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/google/gemini_openai.py +0 -0
  82. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/groq/__init__.py +0 -0
  83. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/groq/groq.py +0 -0
  84. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/huggingface/__init__.py +0 -0
  85. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/huggingface/hf.py +0 -0
  86. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/internlm/__init__.py +0 -0
  87. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/internlm/chat.py +0 -0
  88. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/mistral/__init__.py +0 -0
  89. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/mistral/mistral.py +0 -0
  90. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/moonshot/__init__.py +0 -0
  91. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/moonshot/chat.py +0 -0
  92. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/nvidia/__init__.py +0 -0
  93. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/nvidia/chat.py +0 -0
  94. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/ollama/__init__.py +0 -0
  95. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/ollama/chat.py +0 -0
  96. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/ollama/hermes.py +0 -0
  97. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/ollama/tools.py +0 -0
  98. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/openai/__init__.py +0 -0
  99. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/openai/chat.py +0 -0
  100. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/openai/like.py +0 -0
  101. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/openrouter/__init__.py +0 -0
  102. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/openrouter/openrouter.py +0 -0
  103. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/response.py +0 -0
  104. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/sambanova/__init__.py +0 -0
  105. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/sambanova/sambanova.py +0 -0
  106. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/together/__init__.py +0 -0
  107. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/together/togetherchat.py +0 -0
  108. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/vertexai/__init__.py +0 -0
  109. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/vertexai/gemini.py +0 -0
  110. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/xai/__init__.py +0 -0
  111. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/xai/grok.py +0 -0
  112. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/yi/__init__.py +0 -0
  113. {agentica-0.2.1 → agentica-0.2.3}/agentica/model/yi/chat.py +0 -0
  114. {agentica-0.2.1 → agentica-0.2.3}/agentica/reasoning.py +0 -0
  115. {agentica-0.2.1 → agentica-0.2.3}/agentica/reranker/__init__.py +0 -0
  116. {agentica-0.2.1 → agentica-0.2.3}/agentica/reranker/base.py +0 -0
  117. {agentica-0.2.1 → agentica-0.2.3}/agentica/reranker/bge.py +0 -0
  118. {agentica-0.2.1 → agentica-0.2.3}/agentica/reranker/cohere.py +0 -0
  119. {agentica-0.2.1 → agentica-0.2.3}/agentica/run_response.py +0 -0
  120. {agentica-0.2.1 → agentica-0.2.3}/agentica/storage/__init__.py +0 -0
  121. {agentica-0.2.1 → agentica-0.2.3}/agentica/storage/agent/__init__.py +0 -0
  122. {agentica-0.2.1 → agentica-0.2.3}/agentica/storage/agent/base.py +0 -0
  123. {agentica-0.2.1 → agentica-0.2.3}/agentica/storage/agent/json_file.py +0 -0
  124. {agentica-0.2.1 → agentica-0.2.3}/agentica/storage/agent/postgres.py +0 -0
  125. {agentica-0.2.1 → agentica-0.2.3}/agentica/storage/agent/sqlite.py +0 -0
  126. {agentica-0.2.1 → agentica-0.2.3}/agentica/storage/agent/yaml_file.py +0 -0
  127. {agentica-0.2.1 → agentica-0.2.3}/agentica/storage/workflow/__init__.py +0 -0
  128. {agentica-0.2.1 → agentica-0.2.3}/agentica/storage/workflow/base.py +0 -0
  129. {agentica-0.2.1 → agentica-0.2.3}/agentica/storage/workflow/postgres.py +0 -0
  130. {agentica-0.2.1 → agentica-0.2.3}/agentica/storage/workflow/sqlite.py +0 -0
  131. {agentica-0.2.1 → agentica-0.2.3}/agentica/template.py +0 -0
  132. {agentica-0.2.1 → agentica-0.2.3}/agentica/tools/__init__.py +0 -0
  133. {agentica-0.2.1 → agentica-0.2.3}/agentica/tools/airflow_tool.py +0 -0
  134. {agentica-0.2.1 → agentica-0.2.3}/agentica/tools/analyze_image_tool.py +0 -0
  135. {agentica-0.2.1 → agentica-0.2.3}/agentica/tools/apify_tool.py +0 -0
  136. {agentica-0.2.1 → agentica-0.2.3}/agentica/tools/arxiv_tool.py +0 -0
  137. {agentica-0.2.1 → agentica-0.2.3}/agentica/tools/baidusearch_tool.py +0 -0
  138. {agentica-0.2.1 → agentica-0.2.3}/agentica/tools/base.py +0 -0
  139. {agentica-0.2.1 → agentica-0.2.3}/agentica/tools/calculator_tool.py +0 -0
  140. {agentica-0.2.1 → agentica-0.2.3}/agentica/tools/dblp_tool.py +0 -0
  141. {agentica-0.2.1 → agentica-0.2.3}/agentica/tools/duckduckgo_tool.py +0 -0
  142. {agentica-0.2.1 → agentica-0.2.3}/agentica/tools/file_tool.py +0 -0
  143. {agentica-0.2.1 → agentica-0.2.3}/agentica/tools/hackernews_tool.py +0 -0
  144. {agentica-0.2.1 → agentica-0.2.3}/agentica/tools/newspaper_tool.py +0 -0
  145. {agentica-0.2.1 → agentica-0.2.3}/agentica/tools/ocr_tool.py +0 -0
  146. {agentica-0.2.1 → agentica-0.2.3}/agentica/tools/resend_tools.py +0 -0
  147. {agentica-0.2.1 → agentica-0.2.3}/agentica/tools/run_nb_code_tool.py +0 -0
  148. {agentica-0.2.1 → agentica-0.2.3}/agentica/tools/run_python_code_tool.py +0 -0
  149. {agentica-0.2.1 → agentica-0.2.3}/agentica/tools/search_exa_tool.py +0 -0
  150. {agentica-0.2.1 → agentica-0.2.3}/agentica/tools/search_serper_tool.py +0 -0
  151. {agentica-0.2.1 → agentica-0.2.3}/agentica/tools/shell_tool.py +0 -0
  152. {agentica-0.2.1 → agentica-0.2.3}/agentica/tools/sql_tool.py +0 -0
  153. {agentica-0.2.1 → agentica-0.2.3}/agentica/tools/text_analysis_tool.py +0 -0
  154. {agentica-0.2.1 → agentica-0.2.3}/agentica/tools/wikipedia_tool.py +0 -0
  155. {agentica-0.2.1 → agentica-0.2.3}/agentica/tools/yfinance_tool.py +0 -0
  156. {agentica-0.2.1 → agentica-0.2.3}/agentica/utils/__init__.py +0 -0
  157. {agentica-0.2.1 → agentica-0.2.3}/agentica/utils/console.py +0 -0
  158. {agentica-0.2.1 → agentica-0.2.3}/agentica/utils/io.py +0 -0
  159. {agentica-0.2.1 → agentica-0.2.3}/agentica/utils/json_util.py +0 -0
  160. {agentica-0.2.1 → agentica-0.2.3}/agentica/utils/log.py +0 -0
  161. {agentica-0.2.1 → agentica-0.2.3}/agentica/utils/misc.py +0 -0
  162. {agentica-0.2.1 → agentica-0.2.3}/agentica/utils/shell.py +0 -0
  163. {agentica-0.2.1 → agentica-0.2.3}/agentica/utils/timer.py +0 -0
  164. {agentica-0.2.1 → agentica-0.2.3}/agentica/vectordb/__init__.py +0 -0
  165. {agentica-0.2.1 → agentica-0.2.3}/agentica/vectordb/base.py +0 -0
  166. {agentica-0.2.1 → agentica-0.2.3}/agentica/vectordb/chromadb_vectordb.py +0 -0
  167. {agentica-0.2.1 → agentica-0.2.3}/agentica/vectordb/lancedb_vectordb.py +0 -0
  168. {agentica-0.2.1 → agentica-0.2.3}/agentica/vectordb/memory_vectordb.py +0 -0
  169. {agentica-0.2.1 → agentica-0.2.3}/agentica/vectordb/pgvectordb.py +0 -0
  170. {agentica-0.2.1 → agentica-0.2.3}/agentica/vectordb/pineconedb.py +0 -0
  171. {agentica-0.2.1 → agentica-0.2.3}/agentica/vectordb/qdrantdb.py +0 -0
  172. {agentica-0.2.1 → agentica-0.2.3}/agentica/workflow.py +0 -0
  173. {agentica-0.2.1 → agentica-0.2.3}/agentica/workflow_session.py +0 -0
  174. {agentica-0.2.1 → agentica-0.2.3}/agentica.egg-info/dependency_links.txt +0 -0
  175. {agentica-0.2.1 → agentica-0.2.3}/agentica.egg-info/entry_points.txt +0 -0
  176. {agentica-0.2.1 → agentica-0.2.3}/agentica.egg-info/not-zip-safe +0 -0
  177. {agentica-0.2.1 → agentica-0.2.3}/agentica.egg-info/requires.txt +0 -0
  178. {agentica-0.2.1 → agentica-0.2.3}/setup.cfg +0 -0
@@ -0,0 +1 @@
1
+ exclude tests/*
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: agentica
3
- Version: 0.2.1
3
+ Version: 0.2.3
4
4
  Summary: LLM agents
5
5
  Home-page: https://github.com/shibing624/agentica
6
6
  Author: XuMing
@@ -49,40 +49,53 @@ Requires-Dist: rich
49
49
  [![Wechat Group](https://img.shields.io/badge/wechat-group-green.svg?logo=wechat)](#Contact)
50
50
 
51
51
 
52
- **Agentica**: Build Smarter, Reflective, and Collaborative AI Agents with Ease!
52
+ **Agentica**: 轻松构建智能、具备反思能力、可协作的多模态AI Agent。
53
53
 
54
- **Agentica**: 快速打造智能、能反思、协作的AI Agent。
55
54
 
56
- ## Overview
55
+ ## 📖 Introduction
57
56
 
58
- #### LLM Agent
57
+ **Agentica** 可以构建AI Agent,包括规划、记忆和工具使用、执行等组件。
58
+
59
+ #### Agent Components
59
60
  <img src="https://github.com/shibing624/agentica/blob/main/docs/llm_agentv2.png" width="800" />
60
61
 
61
62
  - **规划(Planning)**:任务拆解、生成计划、反思
62
63
  - **记忆(Memory)**:短期记忆(prompt实现)、长期记忆(RAG实现)
63
64
  - **工具使用(Tool use)**:function call能力,调用外部API,以获取外部信息,包括当前日期、日历、代码执行能力、对专用信息源的访问等
64
65
 
65
- #### Agentica Architecture
66
+ #### Agentica Workflow
67
+
68
+ **Agentica** can also build multi-agent systems and workflows.
69
+
70
+ **Agentica** 还可以构建多Agent系统和工作流。
71
+
66
72
  <img src="https://github.com/shibing624/agentica/blob/main/docs/agent_arch.png" width="800" />
67
73
 
68
74
  - **Planner**:负责让LLM生成一个多步计划来完成复杂任务,生成相互依赖的“链式计划”,定义每一步所依赖的上一步的输出
69
75
  - **Worker**:接受“链式计划”,循环遍历计划中的每个子任务,并调用工具完成任务,可以自动反思纠错以完成任务
70
76
  - **Solver**:求解器将所有这些输出整合为最终答案
71
77
 
78
+ ## 🔥 News
79
+ [2024/12/29] v0.2.3版本: 支持了`ZhipuAI`的api调用,包括免费模型和工具使用,详见[Release-v0.2.3](https://github.com/shibing624/agentica/releases/tag/0.2.3)
80
+
81
+ [2024/12/25] v0.2.0版本: 支持了多模态模型,输入可以是文本、图片、音频、视频,升级Assistant为Agent,Workflow支持拆解并实现复杂任务,详见[Release-v0.2.0](https://github.com/shibing624/agentica/releases/tag/0.2.0)
82
+
83
+ [2024/07/02] v0.1.0版本:实现了基于LLM的Assistant,可以快速用function call搭建大语言模型助手,详见[Release-v0.1.0](https://github.com/shibing624/agentica/releases/tag/0.1.0)
84
+
72
85
 
73
- ## Features
86
+ ## 😊 Features
74
87
  `Agentica`是一个用于构建Agent的工具,具有以下功能:
75
88
 
76
- - **Agent编排**:通过简单代码快速编排Agent,支持 Reflection(反思)、Plan and Solve(计划并执行)、RAG、Agent、Multi-Agent、Multi-Role、Workflow等功能
89
+ - **Agent编排**:通过简单代码快速编排Agent,支持 Reflection(反思)、Plan and Solve(计划并执行)、RAG、Agent、Multi-Agent、Team、Workflow等功能
77
90
  - **自定义prompt**:Agent支持自定义prompt和多种工具调用(tool_calls)
78
91
  - **LLM集成**:支持OpenAI、Azure、Deepseek、Moonshot、Claude、Ollama、Together等多方大模型厂商的API
79
92
  - **记忆功能**:包括短期记忆和长期记忆功能
80
- - **Multi-Agent协作**:支持多Agent和多角色的团队协作。
93
+ - **Multi-Agent协作**:支持多Agent和任务委托(Team)的团队协作。
81
94
  - **Workflow工作流**:拆解复杂任务为多个Agent,基于工作流自动化串行逐步完成任务,如投资研究、新闻文章撰写和技术教程创建
82
95
  - **自我进化Agent**:具有反思和增强记忆能力的自我进化Agent
83
96
  - **Web UI**:兼容ChatPilot,可以基于Web页面交互,支持主流的open-webui、streamlit、gradio等前端交互框架
84
97
 
85
- ## Installation
98
+ ## 💾 Install
86
99
 
87
100
  ```bash
88
101
  pip install -U agentica
@@ -96,7 +109,7 @@ cd agentica
96
109
  pip install .
97
110
  ```
98
111
 
99
- ## Getting Started
112
+ ## 🚀 Getting Started
100
113
 
101
114
  #### Run the example
102
115
  ```shell
@@ -107,7 +120,7 @@ cd examples
107
120
  python web_search_moonshot_demo.py
108
121
  ```
109
122
 
110
- 1. 复制[.env.example](https://github.com/shibing624/agentica/blob/main/.env.example)文件为`~/.agentica/.env`,并填写LLM api key(选填DEEPSEEK_API_KEY、MOONSHOT_API_KEY、OPENAI_API_KEY等任一个即可)。或者使用`export`命令设置环境变量:
123
+ 1. 复制[.env.example](https://github.com/shibing624/agentica/blob/main/.env.example)文件为`~/.agentica/.env`,并填写LLM api key(选填DEEPSEEK_API_KEY、MOONSHOT_API_KEY、OPENAI_API_KEY、ZHIPUAI_API_KEY等任一个即可)。或者使用`export`命令设置环境变量:
111
124
 
112
125
  ```shell
113
126
  export MOONSHOT_API_KEY=your_moonshot_api_key
@@ -127,7 +140,7 @@ print(r)
127
140
  ```
128
141
 
129
142
 
130
- ## Web UI
143
+ ## ▶️ Web UI
131
144
 
132
145
  [shibing624/ChatPilot](https://github.com/shibing624/ChatPilot) 兼容`agentica`,可以通过Web UI进行交互。
133
146
 
@@ -146,7 +159,7 @@ bash start.sh
146
159
  ```
147
160
 
148
161
 
149
- ## Examples
162
+ ## 😀 Examples
150
163
 
151
164
 
152
165
  | 示例 | 描述 |
@@ -230,7 +243,7 @@ streamlit run 34_llm_os_demo.py
230
243
 
231
244
  <img alt="LLM OS" src="https://github.com/shibing624/agentica/blob/main/docs/llm_os_snap.png" width="800" />
232
245
 
233
- ## Contact
246
+ ## ☎️ Contact
234
247
 
235
248
  - Issue(建议)
236
249
  :[![GitHub issues](https://img.shields.io/github/issues/shibing624/agentica.svg)](https://github.com/shibing624/agentica/issues)
@@ -239,7 +252,7 @@ streamlit run 34_llm_os_demo.py
239
252
 
240
253
  <img src="https://github.com/shibing624/agentica/blob/main/docs/wechat.jpeg" width="200" />
241
254
 
242
- ## Citation
255
+ ## 😇 Citation
243
256
 
244
257
  如果你在研究中使用了`agentica`,请按如下格式引用:
245
258
 
@@ -260,10 +273,10 @@ BibTeX:
260
273
  }
261
274
  ```
262
275
 
263
- ## License
276
+ ## ⚠️ License
264
277
 
265
278
  授权协议为 [The Apache License 2.0](/LICENSE),可免费用做商业用途。请在产品说明中附加`agentica`的链接和授权协议。
266
- ## Contribute
279
+ ## 😍 Contribute
267
280
 
268
281
  项目代码还很粗糙,如果大家对代码有所改进,欢迎提交回本项目,在提交之前,注意以下两点:
269
282
 
@@ -272,11 +285,11 @@ BibTeX:
272
285
 
273
286
  之后即可提交PR。
274
287
 
275
- ## Acknowledgements
288
+ ## 💕 Acknowledgements
276
289
 
277
- - [https://github.com/langchain-ai/langchain](https://github.com/langchain-ai/langchain)
278
- - [https://github.com/simonmesmith/agentflow](https://github.com/simonmesmith/agentflow)
279
- - [https://github.com/phidatahq/phidata](https://github.com/phidatahq/phidata)
290
+ - [langchain-ai/langchain](https://github.com/langchain-ai/langchain)
291
+ - [simonmesmith/agentflow](https://github.com/simonmesmith/agentflow)
292
+ - [phidatahq/phidata](https://github.com/phidatahq/phidata)
280
293
 
281
294
 
282
295
  Thanks for their great work!
@@ -18,40 +18,53 @@
18
18
  [![Wechat Group](https://img.shields.io/badge/wechat-group-green.svg?logo=wechat)](#Contact)
19
19
 
20
20
 
21
- **Agentica**: Build Smarter, Reflective, and Collaborative AI Agents with Ease!
21
+ **Agentica**: 轻松构建智能、具备反思能力、可协作的多模态AI Agent。
22
22
 
23
- **Agentica**: 快速打造智能、能反思、协作的AI Agent。
24
23
 
25
- ## Overview
24
+ ## 📖 Introduction
26
25
 
27
- #### LLM Agent
26
+ **Agentica** 可以构建AI Agent,包括规划、记忆和工具使用、执行等组件。
27
+
28
+ #### Agent Components
28
29
  <img src="https://github.com/shibing624/agentica/blob/main/docs/llm_agentv2.png" width="800" />
29
30
 
30
31
  - **规划(Planning)**:任务拆解、生成计划、反思
31
32
  - **记忆(Memory)**:短期记忆(prompt实现)、长期记忆(RAG实现)
32
33
  - **工具使用(Tool use)**:function call能力,调用外部API,以获取外部信息,包括当前日期、日历、代码执行能力、对专用信息源的访问等
33
34
 
34
- #### Agentica Architecture
35
+ #### Agentica Workflow
36
+
37
+ **Agentica** can also build multi-agent systems and workflows.
38
+
39
+ **Agentica** 还可以构建多Agent系统和工作流。
40
+
35
41
  <img src="https://github.com/shibing624/agentica/blob/main/docs/agent_arch.png" width="800" />
36
42
 
37
43
  - **Planner**:负责让LLM生成一个多步计划来完成复杂任务,生成相互依赖的“链式计划”,定义每一步所依赖的上一步的输出
38
44
  - **Worker**:接受“链式计划”,循环遍历计划中的每个子任务,并调用工具完成任务,可以自动反思纠错以完成任务
39
45
  - **Solver**:求解器将所有这些输出整合为最终答案
40
46
 
47
+ ## 🔥 News
48
+ [2024/12/29] v0.2.3版本: 支持了`ZhipuAI`的api调用,包括免费模型和工具使用,详见[Release-v0.2.3](https://github.com/shibing624/agentica/releases/tag/0.2.3)
49
+
50
+ [2024/12/25] v0.2.0版本: 支持了多模态模型,输入可以是文本、图片、音频、视频,升级Assistant为Agent,Workflow支持拆解并实现复杂任务,详见[Release-v0.2.0](https://github.com/shibing624/agentica/releases/tag/0.2.0)
51
+
52
+ [2024/07/02] v0.1.0版本:实现了基于LLM的Assistant,可以快速用function call搭建大语言模型助手,详见[Release-v0.1.0](https://github.com/shibing624/agentica/releases/tag/0.1.0)
53
+
41
54
 
42
- ## Features
55
+ ## 😊 Features
43
56
  `Agentica`是一个用于构建Agent的工具,具有以下功能:
44
57
 
45
- - **Agent编排**:通过简单代码快速编排Agent,支持 Reflection(反思)、Plan and Solve(计划并执行)、RAG、Agent、Multi-Agent、Multi-Role、Workflow等功能
58
+ - **Agent编排**:通过简单代码快速编排Agent,支持 Reflection(反思)、Plan and Solve(计划并执行)、RAG、Agent、Multi-Agent、Team、Workflow等功能
46
59
  - **自定义prompt**:Agent支持自定义prompt和多种工具调用(tool_calls)
47
60
  - **LLM集成**:支持OpenAI、Azure、Deepseek、Moonshot、Claude、Ollama、Together等多方大模型厂商的API
48
61
  - **记忆功能**:包括短期记忆和长期记忆功能
49
- - **Multi-Agent协作**:支持多Agent和多角色的团队协作。
62
+ - **Multi-Agent协作**:支持多Agent和任务委托(Team)的团队协作。
50
63
  - **Workflow工作流**:拆解复杂任务为多个Agent,基于工作流自动化串行逐步完成任务,如投资研究、新闻文章撰写和技术教程创建
51
64
  - **自我进化Agent**:具有反思和增强记忆能力的自我进化Agent
52
65
  - **Web UI**:兼容ChatPilot,可以基于Web页面交互,支持主流的open-webui、streamlit、gradio等前端交互框架
53
66
 
54
- ## Installation
67
+ ## 💾 Install
55
68
 
56
69
  ```bash
57
70
  pip install -U agentica
@@ -65,7 +78,7 @@ cd agentica
65
78
  pip install .
66
79
  ```
67
80
 
68
- ## Getting Started
81
+ ## 🚀 Getting Started
69
82
 
70
83
  #### Run the example
71
84
  ```shell
@@ -76,7 +89,7 @@ cd examples
76
89
  python web_search_moonshot_demo.py
77
90
  ```
78
91
 
79
- 1. 复制[.env.example](https://github.com/shibing624/agentica/blob/main/.env.example)文件为`~/.agentica/.env`,并填写LLM api key(选填DEEPSEEK_API_KEY、MOONSHOT_API_KEY、OPENAI_API_KEY等任一个即可)。或者使用`export`命令设置环境变量:
92
+ 1. 复制[.env.example](https://github.com/shibing624/agentica/blob/main/.env.example)文件为`~/.agentica/.env`,并填写LLM api key(选填DEEPSEEK_API_KEY、MOONSHOT_API_KEY、OPENAI_API_KEY、ZHIPUAI_API_KEY等任一个即可)。或者使用`export`命令设置环境变量:
80
93
 
81
94
  ```shell
82
95
  export MOONSHOT_API_KEY=your_moonshot_api_key
@@ -96,7 +109,7 @@ print(r)
96
109
  ```
97
110
 
98
111
 
99
- ## Web UI
112
+ ## ▶️ Web UI
100
113
 
101
114
  [shibing624/ChatPilot](https://github.com/shibing624/ChatPilot) 兼容`agentica`,可以通过Web UI进行交互。
102
115
 
@@ -115,7 +128,7 @@ bash start.sh
115
128
  ```
116
129
 
117
130
 
118
- ## Examples
131
+ ## 😀 Examples
119
132
 
120
133
 
121
134
  | 示例 | 描述 |
@@ -199,7 +212,7 @@ streamlit run 34_llm_os_demo.py
199
212
 
200
213
  <img alt="LLM OS" src="https://github.com/shibing624/agentica/blob/main/docs/llm_os_snap.png" width="800" />
201
214
 
202
- ## Contact
215
+ ## ☎️ Contact
203
216
 
204
217
  - Issue(建议)
205
218
  :[![GitHub issues](https://img.shields.io/github/issues/shibing624/agentica.svg)](https://github.com/shibing624/agentica/issues)
@@ -208,7 +221,7 @@ streamlit run 34_llm_os_demo.py
208
221
 
209
222
  <img src="https://github.com/shibing624/agentica/blob/main/docs/wechat.jpeg" width="200" />
210
223
 
211
- ## Citation
224
+ ## 😇 Citation
212
225
 
213
226
  如果你在研究中使用了`agentica`,请按如下格式引用:
214
227
 
@@ -229,10 +242,10 @@ BibTeX:
229
242
  }
230
243
  ```
231
244
 
232
- ## License
245
+ ## ⚠️ License
233
246
 
234
247
  授权协议为 [The Apache License 2.0](/LICENSE),可免费用做商业用途。请在产品说明中附加`agentica`的链接和授权协议。
235
- ## Contribute
248
+ ## 😍 Contribute
236
249
 
237
250
  项目代码还很粗糙,如果大家对代码有所改进,欢迎提交回本项目,在提交之前,注意以下两点:
238
251
 
@@ -241,11 +254,11 @@ BibTeX:
241
254
 
242
255
  之后即可提交PR。
243
256
 
244
- ## Acknowledgements
257
+ ## 💕 Acknowledgements
245
258
 
246
- - [https://github.com/langchain-ai/langchain](https://github.com/langchain-ai/langchain)
247
- - [https://github.com/simonmesmith/agentflow](https://github.com/simonmesmith/agentflow)
248
- - [https://github.com/phidatahq/phidata](https://github.com/phidatahq/phidata)
259
+ - [langchain-ai/langchain](https://github.com/langchain-ai/langchain)
260
+ - [simonmesmith/agentflow](https://github.com/simonmesmith/agentflow)
261
+ - [phidatahq/phidata](https://github.com/phidatahq/phidata)
249
262
 
250
263
 
251
264
  Thanks for their great work!
@@ -21,6 +21,7 @@ from agentica.model.doubao.chat import DoubaoChat
21
21
  from agentica.model.together.togetherchat import TogetherChat
22
22
  from agentica.model.xai.grok import GrokChat
23
23
  from agentica.model.yi.chat import YiChat
24
+ from agentica.model.zhipuai.chat import ZhipuAIChat
24
25
 
25
26
  # memory
26
27
  from agentica.model.base import Model
@@ -72,6 +73,7 @@ from agentica.emb.hash_emb import HashEmb
72
73
  from agentica.emb.ollama_emb import OllamaEmb
73
74
  from agentica.emb.together_emb import TogetherEmb
74
75
  from agentica.emb.fireworks_emb import FireworksEmb
76
+ from agentica.emb.zhipuai_emb import ZhipuAIEmb
75
77
 
76
78
  # file
77
79
  from agentica.file.base import File
@@ -94,7 +96,7 @@ from agentica.tools.search_serper_tool import SearchSerperTool
94
96
  from agentica.tools.run_python_code_tool import RunPythonCodeTool
95
97
  from agentica.tools.analyze_image_tool import AnalyzeImageTool
96
98
  from agentica.tools.calculator_tool import CalculatorTool
97
- from agentica.tools.create_image_tool import CreateImageTool
99
+ from agentica.tools.dalle_tool import DalleTool
98
100
  from agentica.tools.file_tool import FileTool
99
101
  from agentica.tools.hackernews_tool import HackerNewsTool
100
102
  from agentica.tools.jina_tool import JinaTool
@@ -1998,7 +1998,8 @@ class Agent(BaseModel):
1998
1998
  logger.warning(f"Failed to convert response to pydantic model: {exc}")
1999
1999
  # Check if response starts with ```json
2000
2000
  if run_response.content.startswith("```json"):
2001
- run_response.content = run_response.content.replace("```json\n", "").replace("\n```", "")
2001
+ run_response.content = run_response.content.replace(
2002
+ "```json\n", "").replace("\n```", "")
2002
2003
  try:
2003
2004
  structured_output = self.response_model.model_validate_json(run_response.content)
2004
2005
  except ValidationError as exc:
@@ -2307,7 +2308,8 @@ class Agent(BaseModel):
2307
2308
  logger.warning(f"Failed to convert response to pydantic model: {exc}")
2308
2309
  # Check if response starts with ```json
2309
2310
  if run_response.content.startswith("```json"):
2310
- run_response.content = run_response.content.replace("```json\n", "").replace("\n```", "")
2311
+ run_response.content = run_response.content.replace(
2312
+ "```json\n", "").replace("\n```", "")
2311
2313
  try:
2312
2314
  structured_output = self.response_model.model_validate_json(run_response.content)
2313
2315
  except ValidationError as exc:
@@ -0,0 +1,15 @@
1
+ """
2
+ @author:XuMing(xuming624@qq.com)
3
+ @description:
4
+ """
5
+ from os import getenv
6
+ from typing import Optional
7
+
8
+ from agentica.emb.openai_emb import OpenAIEmb
9
+
10
+
11
+ class ZhipuAIEmb(OpenAIEmb):
12
+ model: str = "embedding-3"
13
+ dimensions: int = 2048
14
+ api_key: Optional[str] = getenv("ZHIPUAI_API_KEY")
15
+ base_url: str = "https://open.bigmodel.cn/api/paas/v4"
@@ -18,7 +18,7 @@ class DoubaoChat(OpenAILike):
18
18
 
19
19
  id: str = "ep-20241012172611-btlgr"
20
20
  name: str = "DoubaoChat"
21
- provider: str = "Doubao"
21
+ provider: str = "ByteDance"
22
22
 
23
23
  api_key: Optional[str] = getenv("ARK_API_KEY", None)
24
24
  base_url: str = "https://ark.cn-beijing.volces.com/api/v3"
@@ -85,7 +85,8 @@ class Message(BaseModel):
85
85
  @param level: The level to log the message at. One of debug, info, warning, or error.
86
86
  Defaults to debug.
87
87
  """
88
- _logger = logger.debug
88
+ level = level or "debug"
89
+ level = level.lower()
89
90
  if level == "debug":
90
91
  _logger = logger.debug
91
92
  elif level == "info":
@@ -94,6 +95,8 @@ class Message(BaseModel):
94
95
  _logger = logger.warning
95
96
  elif level == "error":
96
97
  _logger = logger.error
98
+ else:
99
+ _logger = logger.debug
97
100
 
98
101
  _logger(f"============== {self.role} ==============")
99
102
  if self.name:
@@ -120,8 +123,6 @@ class Message(BaseModel):
120
123
  _logger("Message contains raw audio data")
121
124
  else:
122
125
  _logger(f"Audio file added: {self.audio}")
123
- # if self.model_extra and "images" in self.model_extra:
124
- # _logger("images: {}".format(self.model_extra["images"]))
125
126
 
126
127
  def content_is_valid(self) -> bool:
127
128
  """Check if the message content is valid."""
@@ -0,0 +1 @@
1
+ from agentica.model.zhipuai.chat import ZhipuAIChat
@@ -0,0 +1,24 @@
1
+ from typing import Optional
2
+ from os import getenv
3
+
4
+ from agentica.model.openai.like import OpenAILike
5
+
6
+
7
+ class ZhipuAIChat(OpenAILike):
8
+ """
9
+ A model class for ZhipuAI Chat API.
10
+
11
+ Attributes:
12
+ - id: str: The unique identifier of the model, model_name.
13
+ - name: str: The name of the class.
14
+ - provider: str: The provider of the model.
15
+ - api_key: Optional[str]: The API key for the model.
16
+ - base_url: str: The base URL for the model.
17
+ """
18
+
19
+ id: str = "glm-4-flash"
20
+ name: str = "ZhipuAIChat"
21
+ provider: str = "ZhipuAI"
22
+
23
+ api_key: Optional[str] = getenv("ZHIPUAI_API_KEY", None)
24
+ base_url: str = "https://open.bigmodel.cn/api/paas/v4"
@@ -1,3 +1,8 @@
1
+ # -*- coding: utf-8 -*-
2
+ """
3
+ @author:XuMing(xuming624@qq.com)
4
+ @description:
5
+ """
1
6
  from typing import Optional, List, Dict, Any
2
7
  from pathlib import Path
3
8
  import json
@@ -0,0 +1,195 @@
1
+ # -*- coding: utf-8 -*-
2
+ """
3
+ A minimal implementation of a ReACT agent with support for multiple tools.
4
+ """
5
+ import re
6
+ from loguru import logger
7
+ from openai import OpenAI
8
+
9
+ # Registry to hold available actions
10
+ action_registry = {}
11
+
12
+
13
+ def register_action(action_name):
14
+ """Decorator to register an action in the action registry."""
15
+
16
+ def decorator(func):
17
+ action_registry[action_name] = func
18
+ return func
19
+
20
+ return decorator
21
+
22
+
23
+ def parse_response(response):
24
+ """Parse the model's response into thoughts and actions."""
25
+ thoughts = []
26
+ actions = []
27
+ lines = response.split('\n')
28
+ for line in lines:
29
+ if line.startswith("Thought:"):
30
+ thoughts.append(line[len("Thought:"):].strip())
31
+ elif line.startswith("Action:"):
32
+ actions.append(line[len("Action:"):].strip())
33
+ return thoughts, actions
34
+
35
+
36
+ def parse_action(action_str):
37
+ """Parse an action string into action name and parameters."""
38
+ match = re.match(r'^(\w+)\((.*)\)$', action_str)
39
+ if match:
40
+ action_name = match.group(1)
41
+ params = match.group(2)
42
+ # Remove parameter names and keep only values
43
+ params = re.sub(r'\w+=', '', params)
44
+ logger.debug(f"Action name: {action_name}, Params: {params}")
45
+ return action_name, params
46
+ else:
47
+ logger.warning(f"Invalid action string: {action_str}")
48
+ return None, None
49
+
50
+
51
+ TOOL_DESC = """{name_for_model}: Call this tool to interact with the {name_for_human} API. What is the {name_for_human} API useful for? {description_for_model} Parameters: {parameters}"""
52
+
53
+ PROMPT_REACT = """You are an assistant that uses the ReACT framework to answer questions.
54
+
55
+ First, describe your thought process in the "Thought:" section, then describe the action you will take in the "Action:" section.
56
+ Each section should start with its respective label.
57
+ Adjust your thoughts and actions based on the results of previous actions until you arrive at the final answer.
58
+ Ensure that each action is described in the format "Action: action_name(parameters)".
59
+ Available actions include:
60
+
61
+ {tools_text}
62
+
63
+ Begin!
64
+ """
65
+
66
+
67
+ class ReactAgent:
68
+ """A ReACT agent that interacts with the OpenAI API to perform actions based on user queries."""
69
+
70
+ def __init__(self, model_name="gpt-4o", tools=None):
71
+ self.model_name = model_name
72
+ self.tools = tools or []
73
+ self.action_registry = action_registry
74
+ self.client = OpenAI()
75
+ self.logger = logger
76
+ self.system_prompt = self._generate_system_prompt()
77
+
78
+ def _generate_system_prompt(self):
79
+ tools_text = "\n".join([TOOL_DESC.format(**tool) for tool in self.tools])
80
+ return PROMPT_REACT.format(tools_text=tools_text)
81
+
82
+ def get_model_response(self, messages):
83
+ """Get a response from the OpenAI model."""
84
+ response = self.client.chat.completions.create(
85
+ model=self.model_name,
86
+ messages=messages
87
+ )
88
+ return response.choices[0].message.content
89
+
90
+ def run(self, user_query, max_iterations=5):
91
+ """Run the agent with the given user query."""
92
+ context = []
93
+ for _ in range(max_iterations):
94
+ messages = [
95
+ {"role": "system", "content": self.system_prompt.format(query=user_query)},
96
+ {"role": "user", "content": user_query},
97
+ *context
98
+ ]
99
+ self.logger.info(f"Messages: {messages}")
100
+ response = self.get_model_response(messages)
101
+ self.logger.info(f"Model response: {response}")
102
+ thoughts, actions = parse_response(response)
103
+ if not actions:
104
+ break
105
+ action_str = actions[0]
106
+ self.logger.info(f"Executing action: {action_str}")
107
+ action_result = self.execute_action(action_str)
108
+ if action_result.startswith("Action"):
109
+ action_result = action_result.split("Result: ")[-1]
110
+ self.logger.info(f"Action result: {action_result}")
111
+ context.append({
112
+ "role": "assistant",
113
+ "content": f"Thought: {thoughts}\nAction: {action_str}\nResult: {action_result}"
114
+ })
115
+ return response
116
+
117
+ def execute_action(self, action_str):
118
+ """Execute an action based on the action string."""
119
+ action_name, params = parse_action(action_str)
120
+ if action_name in self.action_registry:
121
+ try:
122
+ self.logger.debug(f"Executing action: {action_name} with params: {params}")
123
+ result = self.action_registry[action_name](params)
124
+ self.logger.debug(f"Action '{action_name}' executed successfully, Result: {result}")
125
+ return f"Action '{action_name}' executed successfully, Result: {result}"
126
+ except Exception as e:
127
+ self.logger.warning(f"Action '{action_name}' failed, Error: {str(e)}")
128
+ return f"Action '{action_name}' failed, Error: {str(e)}"
129
+ else:
130
+ return f"Unknown action '{action_name}'"
131
+
132
+
133
+ if __name__ == '__main__':
134
+ @register_action("calculate")
135
+ def calculate(expression=""):
136
+ """Calculate the result of a mathematical expression."""
137
+ try:
138
+ result = eval(expression)
139
+ return result
140
+ except Exception as e:
141
+ return f"Error in calculation: {str(e)}"
142
+
143
+
144
+ @register_action("reverse_string")
145
+ def reverse_string(s=""):
146
+ """Reverse the input string."""
147
+ try:
148
+ logger.debug(f"Reversing string: {s}")
149
+ r = s[::-1]
150
+ logger.debug(f"Reversed string: {r}")
151
+ return r
152
+ except Exception as e:
153
+ return f"Error in reversing string: {str(e)}"
154
+
155
+
156
+ @register_action("text_length")
157
+ def text_length(s):
158
+ """Calculate the length of the input text string."""
159
+ try:
160
+ logger.debug(f"Calculating text length: {s}")
161
+ r = len(s)
162
+ logger.debug(f"Text length: {r}")
163
+ return r
164
+ except Exception as e:
165
+ return f"Error in calculating text length: {str(e)}"
166
+
167
+
168
+ tools = [
169
+ {
170
+ "name_for_model": "calculate",
171
+ "name_for_human": "Calculator",
172
+ "description_for_model": "useful for performing mathematical calculations.",
173
+ "parameters": "expression: a mathematical expression to evaluate."
174
+ },
175
+ {
176
+ "name_for_model": "reverse_string",
177
+ "name_for_human": "String Reverser",
178
+ "description_for_model": "useful for reversing strings.",
179
+ "parameters": "the string to reverse."
180
+ },
181
+ # get text string length
182
+ {
183
+ "name_for_model": "text_length",
184
+ "name_for_human": "Text Length Calculator",
185
+ "description_for_model": "useful for calculating the length of a text string.",
186
+ "parameters": "the text string to calculate the length."
187
+ }
188
+ ]
189
+
190
+ agent = ReactAgent(tools=tools)
191
+
192
+ # Run the agent with a query that requires both tools
193
+ response = agent.run(
194
+ "What is the result of reversing the string '123hello111---232323k23你好,水电费不着调。。。。--23' and then calculating the length of the reversed string, 不要包括引号")
195
+ logger.info(response)