xgae 0.3.0__tar.gz → 0.3.1__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.

Potentially problematic release.


This version of xgae might be problematic. Click here for more details.

Files changed (50) hide show
  1. {xgae-0.3.0 → xgae-0.3.1}/PKG-INFO +3 -3
  2. {xgae-0.3.0 → xgae-0.3.1}/examples/agent/langgraph/reflection/custom_prompt_rag.py +2 -1
  3. {xgae-0.3.0 → xgae-0.3.1}/pyproject.toml +3 -3
  4. {xgae-0.3.0 → xgae-0.3.1}/uv.lock +23 -9
  5. {xgae-0.3.0 → xgae-0.3.1}/xgae/engine/engine_base.py +5 -1
  6. {xgae-0.3.0 → xgae-0.3.1}/xgae/engine/mcp_tool_box.py +14 -8
  7. {xgae-0.3.0 → xgae-0.3.1}/xgae/engine/responser/non_stream_responser.py +2 -1
  8. {xgae-0.3.0 → xgae-0.3.1}/xgae/engine/responser/stream_responser.py +3 -2
  9. {xgae-0.3.0 → xgae-0.3.1}/xgae/engine/task_engine.py +7 -5
  10. {xgae-0.3.0 → xgae-0.3.1}/xgae/gaia2/are_engine.py +4 -3
  11. {xgae-0.3.0 → xgae-0.3.1}/.env +0 -0
  12. {xgae-0.3.0 → xgae-0.3.1}/.python-version +0 -0
  13. {xgae-0.3.0 → xgae-0.3.1}/CHANGELOG.md +0 -0
  14. {xgae-0.3.0 → xgae-0.3.1}/README.md +0 -0
  15. {xgae-0.3.0 → xgae-0.3.1}/examples/agent/langgraph/reflection/agent_base.py +0 -0
  16. {xgae-0.3.0 → xgae-0.3.1}/examples/agent/langgraph/reflection/reflection_agent.py +0 -0
  17. {xgae-0.3.0 → xgae-0.3.1}/examples/agent/langgraph/reflection/result_eval_agent.py +0 -0
  18. {xgae-0.3.0 → xgae-0.3.1}/examples/agent/langgraph/reflection/run_agent_app.py +0 -0
  19. {xgae-0.3.0 → xgae-0.3.1}/examples/engine/run_custom_and_agent_tools.py +0 -0
  20. {xgae-0.3.0 → xgae-0.3.1}/examples/engine/run_general_tools.py +0 -0
  21. {xgae-0.3.0 → xgae-0.3.1}/examples/engine/run_human_in_loop.py +0 -0
  22. {xgae-0.3.0 → xgae-0.3.1}/examples/engine/run_simple.py +0 -0
  23. {xgae-0.3.0 → xgae-0.3.1}/examples/tools/custom_fault_tools_app.py +0 -0
  24. {xgae-0.3.0 → xgae-0.3.1}/examples/tools/simu_a2a_tools_app.py +0 -0
  25. {xgae-0.3.0 → xgae-0.3.1}/mcpservers/custom_servers.json +0 -0
  26. {xgae-0.3.0 → xgae-0.3.1}/mcpservers/xga_server.json +0 -0
  27. {xgae-0.3.0 → xgae-0.3.1}/mcpservers/xga_server_sse.json +0 -0
  28. {xgae-0.3.0 → xgae-0.3.1}/templates/agent_tool_prompt_template.txt +0 -0
  29. {xgae-0.3.0 → xgae-0.3.1}/templates/custom_tool_prompt_template.txt +0 -0
  30. {xgae-0.3.0 → xgae-0.3.1}/templates/example/fault_user_prompt.txt +0 -0
  31. {xgae-0.3.0 → xgae-0.3.1}/templates/example/result_eval_template.txt +0 -0
  32. {xgae-0.3.0 → xgae-0.3.1}/templates/gemini_system_prompt_template.txt +0 -0
  33. {xgae-0.3.0 → xgae-0.3.1}/templates/general_tool_prompt_template.txt +0 -0
  34. {xgae-0.3.0 → xgae-0.3.1}/templates/system_prompt_response_sample.txt +0 -0
  35. {xgae-0.3.0 → xgae-0.3.1}/templates/system_prompt_template.txt +0 -0
  36. {xgae-0.3.0 → xgae-0.3.1}/test/test_chroma.py +0 -0
  37. {xgae-0.3.0 → xgae-0.3.1}/test/test_langfuse.py +0 -0
  38. {xgae-0.3.0 → xgae-0.3.1}/test/test_litellm_langfuse.py +0 -0
  39. {xgae-0.3.0 → xgae-0.3.1}/xgae/__init__.py +0 -0
  40. {xgae-0.3.0 → xgae-0.3.1}/xgae/engine/prompt_builder.py +0 -0
  41. {xgae-0.3.0 → xgae-0.3.1}/xgae/engine/responser/responser_base.py +0 -0
  42. {xgae-0.3.0 → xgae-0.3.1}/xgae/engine/task_langfuse.py +0 -0
  43. {xgae-0.3.0 → xgae-0.3.1}/xgae/engine_cli_app.py +0 -0
  44. {xgae-0.3.0 → xgae-0.3.1}/xgae/tools/without_general_tools_app.py +0 -0
  45. {xgae-0.3.0 → xgae-0.3.1}/xgae/utils/__init__.py +0 -0
  46. {xgae-0.3.0 → xgae-0.3.1}/xgae/utils/json_helpers.py +0 -0
  47. {xgae-0.3.0 → xgae-0.3.1}/xgae/utils/llm_client.py +0 -0
  48. {xgae-0.3.0 → xgae-0.3.1}/xgae/utils/misc.py +0 -0
  49. {xgae-0.3.0 → xgae-0.3.1}/xgae/utils/setup_env.py +0 -0
  50. {xgae-0.3.0 → xgae-0.3.1}/xgae/utils/xml_tool_parser.py +0 -0
@@ -1,13 +1,13 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xgae
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Summary: Extreme General Agent Engine
5
5
  Requires-Python: >=3.11
6
6
  Requires-Dist: colorlog==6.9.0
7
7
  Requires-Dist: langchain-mcp-adapters==0.1.9
8
8
  Requires-Dist: langfuse==2.60.9
9
- Requires-Dist: litellm==1.74.15
10
- Requires-Dist: mcp==1.13.0
9
+ Requires-Dist: litellm==1.71.1
10
+ Requires-Dist: mcp==1.11.0
11
11
  Provides-Extra: examples
12
12
  Requires-Dist: chromadb==1.1.0; extra == 'examples'
13
13
  Requires-Dist: langchain-community==0.3.29; extra == 'examples'
@@ -1,6 +1,7 @@
1
1
  import logging
2
2
  import os
3
- from typing import override, List
3
+ from typing import List
4
+ from typing_extensions import override
4
5
 
5
6
  from langchain_core.documents import Document
6
7
  from langchain_core.embeddings import Embeddings
@@ -1,13 +1,13 @@
1
1
  [project]
2
2
  name = "xgae"
3
- version = "0.3.0"
3
+ version = "0.3.1"
4
4
  description = "Extreme General Agent Engine"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
7
7
  dependencies = [
8
8
  "colorlog==6.9.0",
9
- "litellm==1.74.15",
10
- "mcp==1.13.0",
9
+ "litellm==1.71.1",
10
+ "mcp==1.11.0",
11
11
  "langfuse==2.60.9",
12
12
  "langchain-mcp-adapters==0.1.9",
13
13
  ]
@@ -733,6 +733,19 @@ wheels = [
733
733
  { url = "https://pypi.tuna.tsinghua.edu.cn/packages/2a/39/e50c7c3a983047577ee07d2a9e53faf5a69493943ec3f6a384bdc792deb2/httpx-0.28.1-py3-none-any.whl", hash = "sha256:d909fcccc110f8c7faf814ca82a9a4d816bc5a6dbfea25d6591d6985b8ba59ad", size = 73517, upload-time = "2024-12-06T15:37:21.509Z" },
734
734
  ]
735
735
 
736
+ [[package]]
737
+ name = "httpx-aiohttp"
738
+ version = "0.1.9"
739
+ source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }
740
+ dependencies = [
741
+ { name = "aiohttp" },
742
+ { name = "httpx" },
743
+ ]
744
+ sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d8/f2/9a86ce9bc48cf57dabb3a3160dfed26d8bbe5a2478a51f9d1dbf89f2f1fc/httpx_aiohttp-0.1.9.tar.gz", hash = "sha256:4ee8b22e6f2e7c80cd03be29eff98bfe7d89bd77f021ce0b578ee76b73b4bfe6", size = 206023, upload-time = "2025-10-15T08:52:57.475Z" }
745
+ wheels = [
746
+ { url = "https://pypi.tuna.tsinghua.edu.cn/packages/a1/db/5cfa8254a86c34a1ab7fe0dbec9f81bb5ebd831cbdd65aa4be4f37027804/httpx_aiohttp-0.1.9-py3-none-any.whl", hash = "sha256:3dc2845568b07742588710fcf3d72db2cbcdf2acc93376edf85f789c4d8e5fda", size = 6180, upload-time = "2025-10-15T08:52:56.521Z" },
747
+ ]
748
+
736
749
  [[package]]
737
750
  name = "httpx-sse"
738
751
  version = "0.4.1"
@@ -1125,12 +1138,13 @@ wheels = [
1125
1138
 
1126
1139
  [[package]]
1127
1140
  name = "litellm"
1128
- version = "1.74.15"
1141
+ version = "1.71.1"
1129
1142
  source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }
1130
1143
  dependencies = [
1131
1144
  { name = "aiohttp" },
1132
1145
  { name = "click" },
1133
1146
  { name = "httpx" },
1147
+ { name = "httpx-aiohttp" },
1134
1148
  { name = "importlib-metadata" },
1135
1149
  { name = "jinja2" },
1136
1150
  { name = "jsonschema" },
@@ -1140,9 +1154,9 @@ dependencies = [
1140
1154
  { name = "tiktoken" },
1141
1155
  { name = "tokenizers" },
1142
1156
  ]
1143
- sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/4b/13/90865340f76d54c1c2709074f882bf8ef3be0ac612a2164da5eed07ebe11/litellm-1.74.15.tar.gz", hash = "sha256:530a4b3918c02f87079ca7efb77eaf13d31f281218863f65b2da4bd863790677", size = 9748743, upload-time = "2025-08-02T21:49:08.631Z" }
1157
+ sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/8d/f7/1d51b81e608543c6a79b275a4e2b43f6b4b7f32588566b303102014b725d/litellm-1.71.1.tar.gz", hash = "sha256:c20e5917fdbe771ba4b6d1862b3d38d6e89cfba53e85bb337013f848256566eb", size = 7935681, upload-time = "2025-05-25T14:24:10.744Z" }
1144
1158
  wheels = [
1145
- { url = "https://pypi.tuna.tsinghua.edu.cn/packages/b9/9c/f4dd62d790d65c924699450d8789df437e63c8d99229e95bd7467ce7b82a/litellm-1.74.15-py3-none-any.whl", hash = "sha256:bf3db744dee982e53196cb688097ba76e2867004e39ad201b3761c5de9e3265b", size = 8835438, upload-time = "2025-08-02T21:49:05.817Z" },
1159
+ { url = "https://pypi.tuna.tsinghua.edu.cn/packages/34/0e/328e077a66726dc1d4cfee37c67548b151a33a6d196a32737c85a034712b/litellm-1.71.1-py3-none-any.whl", hash = "sha256:9b94e250c58fba3c87c6ebb77e33c1cc8aa9110cee99dfdc37b368a11cec57c7", size = 7921387, upload-time = "2025-05-25T14:24:08.205Z" },
1146
1160
  ]
1147
1161
 
1148
1162
  [[package]]
@@ -1219,7 +1233,7 @@ wheels = [
1219
1233
 
1220
1234
  [[package]]
1221
1235
  name = "mcp"
1222
- version = "1.13.0"
1236
+ version = "1.11.0"
1223
1237
  source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple" }
1224
1238
  dependencies = [
1225
1239
  { name = "anyio" },
@@ -1234,9 +1248,9 @@ dependencies = [
1234
1248
  { name = "starlette" },
1235
1249
  { name = "uvicorn", marker = "sys_platform != 'emscripten'" },
1236
1250
  ]
1237
- sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d3/a8/564c094de5d6199f727f5d9f5672dbec3b00dfafd0f67bf52d995eaa5951/mcp-1.13.0.tar.gz", hash = "sha256:70452f56f74662a94eb72ac5feb93997b35995e389b3a3a574e078bed2aa9ab3", size = 434709, upload-time = "2025-08-14T15:03:58.58Z" }
1251
+ sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/3a/f5/9506eb5578d5bbe9819ee8ba3198d0ad0e2fbe3bab8b257e4131ceb7dfb6/mcp-1.11.0.tar.gz", hash = "sha256:49a213df56bb9472ff83b3132a4825f5c8f5b120a90246f08b0dac6bedac44c8", size = 406907, upload-time = "2025-07-10T16:41:09.388Z" }
1238
1252
  wheels = [
1239
- { url = "https://pypi.tuna.tsinghua.edu.cn/packages/8b/6b/46b8bcefc2ee9e2d2e8d2bd25f1c2512f5a879fac4619d716b194d6e7ccc/mcp-1.13.0-py3-none-any.whl", hash = "sha256:8b1a002ebe6e17e894ec74d1943cc09aa9d23cb931bf58d49ab2e9fa6bb17e4b", size = 160226, upload-time = "2025-08-14T15:03:56.641Z" },
1253
+ { url = "https://pypi.tuna.tsinghua.edu.cn/packages/92/9c/c9ca79f9c512e4113a5d07043013110bb3369fc7770040c61378c7fbcf70/mcp-1.11.0-py3-none-any.whl", hash = "sha256:58deac37f7483e4b338524b98bc949b7c2b7c33d978f5fafab5bde041c5e2595", size = 155880, upload-time = "2025-07-10T16:41:07.935Z" },
1240
1254
  ]
1241
1255
 
1242
1256
  [[package]]
@@ -2994,7 +3008,7 @@ wheels = [
2994
3008
 
2995
3009
  [[package]]
2996
3010
  name = "xgae"
2997
- version = "0.3.0"
3011
+ version = "0.3.1"
2998
3012
  source = { editable = "." }
2999
3013
  dependencies = [
3000
3014
  { name = "colorlog" },
@@ -3019,8 +3033,8 @@ requires-dist = [
3019
3033
  { name = "langchain-mcp-adapters", specifier = "==0.1.9" },
3020
3034
  { name = "langfuse", specifier = "==2.60.9" },
3021
3035
  { name = "langgraph", marker = "extra == 'examples'", specifier = "==0.6.5" },
3022
- { name = "litellm", specifier = "==1.74.15" },
3023
- { name = "mcp", specifier = "==1.13.0" },
3036
+ { name = "litellm", specifier = "==1.71.1" },
3037
+ { name = "mcp", specifier = "==1.11.0" },
3024
3038
  ]
3025
3039
  provides-extras = ["examples"]
3026
3040
 
@@ -6,7 +6,7 @@ class XGAError(Exception):
6
6
  """Custom exception for errors in the XGA system."""
7
7
  pass
8
8
 
9
- XGAMsgStatusType = Literal["error", "finish", "tool_started", "tool_completed", "tool_error", "tool_failed"]
9
+ XGAMsgStatusType = Literal["error", "stop", "finish", "tool_started", "tool_completed", "tool_error", "tool_failed"]
10
10
  XGAResponseMsgType = Literal["user", "status", "tool", "assistant", "assistant_chunk"]
11
11
 
12
12
  class XGAResponseMessage(TypedDict, total=False):
@@ -40,6 +40,10 @@ class XGAToolResult:
40
40
 
41
41
 
42
42
  class XGAToolBox(ABC):
43
+ @abstractmethod
44
+ async def init_tool_schemas(self):
45
+ pass
46
+
43
47
  @abstractmethod
44
48
  async def creat_task_tool_box(self, task_id: str, general_tools: List[str], custom_tools: List[str]):
45
49
  pass
@@ -2,7 +2,8 @@ import json
2
2
  import logging
3
3
  import os
4
4
 
5
- from typing import List, Any, Dict, Optional, Literal, override
5
+ from typing import List, Any, Dict, Optional, Literal
6
+ from typing_extensions import override
6
7
 
7
8
  from langchain_mcp_adapters.client import MultiServerMCPClient
8
9
  from langchain_mcp_adapters.tools import load_mcp_tools
@@ -33,7 +34,11 @@ class XGAMcpToolBox(XGAToolBox):
33
34
  self.mcp_tool_schemas: Dict[str, List[XGAToolSchema]] = {}
34
35
  self.task_tool_schemas: Dict[str, Dict[str,XGAToolSchema]] = {}
35
36
 
36
- self.is_loaded_tool_schemas = False
37
+ self._is_loaded_mcp_tool_schemas = False
38
+
39
+ @override
40
+ async def init_tool_schemas(self):
41
+ await self._load_mcp_tools_schema()
37
42
 
38
43
  @override
39
44
  async def creat_task_tool_box(self, task_id: str, general_tools: List[str], custom_tools: List[str]):
@@ -139,8 +144,8 @@ class XGAMcpToolBox(XGAToolBox):
139
144
  return result
140
145
 
141
146
 
142
- async def load_mcp_tools_schema(self)-> None:
143
- if not self.is_loaded_tool_schemas:
147
+ async def _load_mcp_tools_schema(self)-> None:
148
+ if not self._is_loaded_mcp_tool_schemas:
144
149
  for server_name in self.mcp_server_names:
145
150
  self.mcp_tool_schemas[server_name] = []
146
151
  try:
@@ -169,11 +174,12 @@ class XGAMcpToolBox(XGAToolBox):
169
174
  input_schema=input_schema,
170
175
  metadata=metadata)
171
176
  self.mcp_tool_schemas[server_name].append(tool_schema)
172
- self.is_loaded_tool_schemas = True
177
+
178
+ self._is_loaded_mcp_tool_schemas = True
173
179
 
174
180
  async def reload_mcp_tools_schema(self) -> None:
175
- self.is_loaded_tool_schemas = False
176
- await self.load_mcp_tools_schema()
181
+ self._is_loaded_mcp_tool_schemas = False
182
+ await self.init_tool_schemas()
177
183
 
178
184
 
179
185
  def _load_mcp_servers_config(self, mcp_config_path: str) -> Dict[str, Any]:
@@ -219,7 +225,7 @@ if __name__ == "__main__":
219
225
  #mcp_tool_box = XGAMcpToolBox()
220
226
 
221
227
  task_id = "task1"
222
- await mcp_tool_box.load_mcp_tools_schema()
228
+ await mcp_tool_box.init_tool_schemas()
223
229
  await mcp_tool_box.creat_task_tool_box(task_id=task_id, general_tools=["*"], custom_tools=["*"])
224
230
  tool_schemas = mcp_tool_box.get_task_tool_schemas(task_id, "general")
225
231
  print("general_tools_schemas" + "*"*50)
@@ -1,6 +1,7 @@
1
1
  import logging
2
2
 
3
- from typing import List, Dict, Any, AsyncGenerator, override,Optional
3
+ from typing import List, Dict, Any, AsyncGenerator,Optional
4
+ from typing_extensions import override
4
5
 
5
6
  from xgae.utils import log_trace
6
7
 
@@ -1,6 +1,7 @@
1
1
  import logging
2
- import asyncio
3
- from typing import List, Dict, Any, Optional, AsyncGenerator, override
2
+
3
+ from typing import List, Dict, Any, Optional, AsyncGenerator
4
+ from typing_extensions import override
4
5
 
5
6
  from xgae.utils import log_trace
6
7
 
@@ -116,8 +116,7 @@ class XGATaskEngine:
116
116
  general_tools.append("ask")
117
117
 
118
118
  custom_tools = self.custom_tools or []
119
- if isinstance(self.tool_box, XGAMcpToolBox):
120
- await self.tool_box.load_mcp_tools_schema()
119
+ await self.tool_box.init_tool_schemas()
121
120
 
122
121
  await self.tool_box.creat_task_tool_box(self.task_id, general_tools, custom_tools)
123
122
  general_tool_schemas = self.tool_box.get_task_tool_schemas(self.task_id, "general")
@@ -201,6 +200,9 @@ class XGATaskEngine:
201
200
  yield error_msg
202
201
  finally:
203
202
  if not self.running_task_checkpoint("termination_check", iterations):
203
+ status_content = {'status_type': "stop", 'role': "system", 'message': "Task is termiated by Stop Command"}
204
+ error_msg = self.add_response_message(type="status", content=status_content, is_llm_message=False)
205
+ yield error_msg
204
206
  break
205
207
 
206
208
  async def _run_task_once(self, continuous_state: TaskRunContinuousState) -> AsyncGenerator[Dict[str, Any], None]:
@@ -239,8 +241,8 @@ class XGATaskEngine:
239
241
  reverse_chunks = reversed(chunks)
240
242
  chunk = None
241
243
 
242
- if self.terminate_task:
243
- return XGATaskResult(type="error", content="LLM Task is terminated !")
244
+ # if self.terminate_task:
245
+ # return XGATaskResult(type="error", content="LLM Task is terminated !")
244
246
 
245
247
  try:
246
248
  finish_reason = ''
@@ -249,7 +251,7 @@ class XGATaskEngine:
249
251
  if chunk_type == "status":
250
252
  status_content = chunk['content']
251
253
  status_type = status_content['status_type']
252
- if status_type == "error":
254
+ if status_type == "error" or status_type == "stop":
253
255
  error = status_content['message']
254
256
  final_result = XGATaskResult(type="error", content=error)
255
257
  elif status_type == "finish":
@@ -1,5 +1,6 @@
1
1
  import logging
2
- from typing import Any, Optional, override, Callable, Literal, Dict, List
2
+ from typing import Any, Optional, Callable, Literal, Dict, List
3
+ from typing_extensions import override
3
4
 
4
5
  from xgae.engine.engine_base import XGAToolBox
5
6
  from xgae.engine.task_engine import XGATaskEngine
@@ -81,12 +82,12 @@ if __name__ == "__main__":
81
82
 
82
83
  def terminate_task(agent, iterations: int) -> bool:
83
84
  logging.info(f"terminate_task: iterations={iterations}")
84
- return iterations > 6 # can test terminate by > 3
85
+ return iterations > 3 # can test terminate by > 3
85
86
 
86
87
 
87
88
  async def main():
88
89
  # Before Run Exec: uv run example-fault-tools
89
- # LLAMA_API_KEY ,
90
+ # LLAMA_API_KEY , LLAMA_API_BASE
90
91
  tool_box = XGAMcpToolBox(custom_mcp_server_file="mcpservers/custom_servers.json")
91
92
  system_prompt = read_file("templates/example/fault_user_prompt.txt")
92
93
  llm_config = LLMConfig(
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes