xgae 0.3.9__tar.gz → 0.4.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.
Files changed (73) hide show
  1. {xgae-0.3.9 → xgae-0.4.1}/.env +1 -1
  2. {xgae-0.3.9 → xgae-0.4.1}/CHANGELOG.md +29 -0
  3. {xgae-0.3.9 → xgae-0.4.1}/PKG-INFO +18 -4
  4. {xgae-0.3.9 → xgae-0.4.1}/README.md +17 -3
  5. {xgae-0.3.9 → xgae-0.4.1}/examples/agent/are/README.md +2 -2
  6. {xgae-0.3.9 → xgae-0.4.1}/examples/agent/are/are/simulation/agents/xga/are_agent.py +21 -3
  7. {xgae-0.3.9 → xgae-0.4.1}/examples/agent/are/are/simulation/agents/xga/are_agent_factory.py +18 -2
  8. xgae-0.4.1/examples/agent/are/are/simulation/agents/xga/are_prompt_builder.py +27 -0
  9. {xgae-0.3.9 → xgae-0.4.1}/examples/agent/are/are/simulation/agents/xga/are_tool_box.py +16 -39
  10. xgae-0.4.1/examples/agent/are/templates/are_prompt_template.md +57 -0
  11. xgae-0.3.9/examples/agent/are/templates/are_prompt_template.md → xgae-0.4.1/examples/agent/are/templates/system_prompt_template.md +18 -69
  12. {xgae-0.3.9 → xgae-0.4.1}/examples/agent/langgraph/reflection/custom_prompt_rag.py +1 -1
  13. {xgae-0.3.9 → xgae-0.4.1}/examples/agent/langgraph/reflection/reflection_agent.py +2 -2
  14. {xgae-0.3.9 → xgae-0.4.1}/examples/agent/langgraph/reflection/result_eval_agent.py +2 -2
  15. {xgae-0.3.9 → xgae-0.4.1}/examples/agent/langgraph/reflection/run_agent_app.py +2 -2
  16. xgae-0.4.1/examples/engine/run_custom_and_agent_tools.py +60 -0
  17. xgae-0.4.1/examples/engine/run_general_tools.py +42 -0
  18. {xgae-0.3.9 → xgae-0.4.1}/examples/engine/run_human_in_loop.py +2 -2
  19. {xgae-0.3.9 → xgae-0.4.1}/examples/tools/custom_fault_tools_app.py +4 -2
  20. {xgae-0.3.9 → xgae-0.4.1}/examples/tools/simu_a2a_tools_app.py +6 -0
  21. {xgae-0.3.9 → xgae-0.4.1}/pyproject.toml +1 -2
  22. xgae-0.3.9/templates/example/fault_user_prompt.txt → xgae-0.4.1/templates/example/fault_user_prompt.md +6 -5
  23. xgae-0.3.9/templates/system_prompt_template.txt → xgae-0.4.1/templates/general_prompt_template.md +98 -14
  24. xgae-0.4.1/templates/system_prompt_template.md +282 -0
  25. xgae-0.4.1/tool.md +64 -0
  26. xgae-0.4.1/uv.lock +3250 -0
  27. xgae-0.3.9/mcpservers/custom_servers.json → xgae-0.4.1/xga_mcp_servers.json +7 -3
  28. {xgae-0.3.9 → xgae-0.4.1}/xgae/engine/engine_base.py +2 -1
  29. {xgae-0.3.9 → xgae-0.4.1}/xgae/engine/mcp_tool_box.py +129 -65
  30. xgae-0.4.1/xgae/engine/prompt_builder.py +166 -0
  31. {xgae-0.3.9 → xgae-0.4.1}/xgae/engine/task_engine.py +15 -14
  32. {xgae-0.3.9 → xgae-0.4.1}/xgae/engine_cli_app.py +3 -4
  33. {xgae-0.3.9 → xgae-0.4.1}/xgae/gaia2/are_engine.py +2 -2
  34. xgae-0.4.1/xgae/tools/system_tools.py +116 -0
  35. {xgae-0.3.9 → xgae-0.4.1}/xgae/utils/llm_client.py +85 -28
  36. {xgae-0.3.9 → xgae-0.4.1}/xgae/utils/xml_tool_parser.py +14 -3
  37. xgae-0.3.9/examples/agent/are/are/simulation/agents/xga/are_prompt_builder.py +0 -48
  38. xgae-0.3.9/examples/agent/are/mcpservers/xga_server.json +0 -11
  39. xgae-0.3.9/examples/agent/are/templates/app_tool_prompt_template.md +0 -2
  40. xgae-0.3.9/examples/agent/are/templates/system_tool_prompt_template.md +0 -78
  41. xgae-0.3.9/examples/engine/run_custom_and_agent_tools.py +0 -45
  42. xgae-0.3.9/examples/engine/run_general_tools.py +0 -16
  43. xgae-0.3.9/mcpservers/xga_server.json +0 -11
  44. xgae-0.3.9/mcpservers/xga_server_sse.json +0 -8
  45. xgae-0.3.9/templates/agent_tool_prompt_template.txt +0 -30
  46. xgae-0.3.9/templates/custom_tool_prompt_template.txt +0 -28
  47. xgae-0.3.9/templates/gemini_system_prompt_template.txt +0 -1742
  48. xgae-0.3.9/templates/general_tool_prompt_template.txt +0 -26
  49. xgae-0.3.9/templates/system_prompt_response_sample.txt +0 -1252
  50. xgae-0.3.9/uv.lock +0 -3242
  51. xgae-0.3.9/xgae/engine/prompt_builder.py +0 -122
  52. xgae-0.3.9/xgae/tools/without_general_tools_app.py +0 -50
  53. {xgae-0.3.9 → xgae-0.4.1}/.python-version +0 -0
  54. {xgae-0.3.9 → xgae-0.4.1}/examples/agent/are/are/simulation/agents/xga/mcp_tool_executor.py +0 -0
  55. {xgae-0.3.9 → xgae-0.4.1}/examples/agent/are/are/simulation/scenarios/scenario_bomc_fault/scenario.py +0 -0
  56. {xgae-0.3.9 → xgae-0.4.1}/examples/agent/are/are_modify_ref.zip +0 -0
  57. {xgae-0.3.9 → xgae-0.4.1}/examples/agent/are/env.example +0 -0
  58. {xgae-0.3.9 → xgae-0.4.1}/examples/agent/are/mcpservers/example_mcp_apps.json +0 -0
  59. {xgae-0.3.9 → xgae-0.4.1}/examples/agent/langgraph/reflection/agent_base.py +0 -0
  60. {xgae-0.3.9 → xgae-0.4.1}/examples/engine/run_simple.py +0 -0
  61. {xgae-0.3.9 → xgae-0.4.1}/templates/example/result_eval_template.txt +0 -0
  62. {xgae-0.3.9 → xgae-0.4.1}/test/test_chroma.py +0 -0
  63. {xgae-0.3.9 → xgae-0.4.1}/test/test_langfuse.py +0 -0
  64. {xgae-0.3.9 → xgae-0.4.1}/test/test_litellm_langfuse.py +0 -0
  65. {xgae-0.3.9 → xgae-0.4.1}/xgae/__init__.py +0 -0
  66. {xgae-0.3.9 → xgae-0.4.1}/xgae/engine/responser/non_stream_responser.py +0 -0
  67. {xgae-0.3.9 → xgae-0.4.1}/xgae/engine/responser/responser_base.py +0 -0
  68. {xgae-0.3.9 → xgae-0.4.1}/xgae/engine/responser/stream_responser.py +0 -0
  69. {xgae-0.3.9 → xgae-0.4.1}/xgae/engine/task_langfuse.py +0 -0
  70. {xgae-0.3.9 → xgae-0.4.1}/xgae/utils/__init__.py +0 -0
  71. {xgae-0.3.9 → xgae-0.4.1}/xgae/utils/json_helpers.py +0 -0
  72. {xgae-0.3.9 → xgae-0.4.1}/xgae/utils/misc.py +0 -0
  73. {xgae-0.3.9 → xgae-0.4.1}/xgae/utils/setup_env.py +0 -0
@@ -21,7 +21,7 @@ LLM_MAX_RETRIES=1
21
21
  LLM_STREAM=True
22
22
  LLM_ENABLE_THINKING=False
23
23
 
24
- LLM_LANGFUSE_ENABLE=False
24
+ LLM_LANGFUSE_ENABLE=True
25
25
 
26
26
 
27
27
  # TASK_ENGINE
@@ -1,3 +1,32 @@
1
+ ## [0.4.1] - 2025-11-15
2
+ ### Modified
3
+ - XGATaskEngine : Fix Bug, allow 'no tool call' occur, after LLM summary, will call 'complete'
4
+ - general_prompt_template: Optimize prompt template
5
+ - engine examples update with more clear example, show how to use General Agent and Custom Agent on different scenario
6
+
7
+
8
+ ## [0.4.0] - 2025-11-11
9
+ - ✅ Overall Refact
10
+ ### Added
11
+ - LLMClient : Add 'completion' sync LLM call function
12
+ - XGASystemTools: Use local system tools, abandoned 'stdio' mode MCP system tool
13
+ ### Modified
14
+ - XGAMcpToolBox: Separate 'system_tool' from ’general_tool'
15
+ - XGAPromptBuilder: Support two model system_prompt, distinguish between 'system' and 'general' mode
16
+ - templates: Merge tool prompt template with system prompt template, Remove unclear template
17
+ - XGA MCP Server Config: all merge to xga_mcp_servers.json
18
+ - GAIA2 ARE Example: Refact with xgae engine new version
19
+ - All Examples modified by xgae engine new version
20
+
21
+
22
+ ## [0.3.10] - 2025-11-6
23
+ ### Modified
24
+ - XMLToolParser : Fix Bug, when string like '+2478' will convert to int
25
+ - GAIA2 ARE Example XGAAreToolBox: Fix Bug, ARE tool use full tool name
26
+ - GAIA2 ARE Example XGAAreAgent: Fix Bug, add ObservationLog log
27
+ - GAIA2 ARE Example are_agent_factory : Fix Bug, add xga_termination_step, avoid exit on calling wait_for_notification tool
28
+
29
+
1
30
  ## [0.3.9] - 2025-11-4
2
31
  ### Added
3
32
  - ✅ GAIA2 ARE Example: Add new prompt template, Leading over ARE 'default agent'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xgae
3
- Version: 0.3.9
3
+ Version: 0.4.1
4
4
  Summary: Extreme General Agent Engine
5
5
  Requires-Python: >=3.11
6
6
  Requires-Dist: colorlog>=6.9.0
@@ -14,7 +14,8 @@ Requires-Dist: langchain-community==0.3.29; extra == 'examples'
14
14
  Requires-Dist: langgraph==0.6.5; extra == 'examples'
15
15
  Description-Content-Type: text/markdown
16
16
 
17
- ## XGAE: Extreme General Agent Engine
17
+ # XGAE: Extreme General Agent Engine
18
+ ## XGAE Features
18
19
  ### Functional Features
19
20
  - Support Custom prompt and external MCP Tools
20
21
  - Support Langfuse
@@ -29,8 +30,21 @@ Description-Content-Type: text/markdown
29
30
  - Architecture is lighter than SUNA Engine
30
31
  - Separate tools from Agent Engine
31
32
 
32
- ### Examples
33
+
34
+ ## XGAE Run Mode
35
+ ### General Agent
36
+ - Use General Agent Prompt
37
+ - Use general tools mainly
38
+ - In addition to using general tools, custom tools can also be used
39
+
40
+ ### Custom Agent
41
+ - Use User Custom Prompt
42
+ - Use custom tools mainly
43
+ - Some general tools can also be used, like 'web_search'
44
+
45
+
46
+ ## Examples
47
+ - engine: Use XGA Engine in various scenarios, you can find out how to use General or Custom Agent
33
48
  - langgraph: Build React mode Langgraph Agent by XGA Engine
34
49
  - are: Build GAIA2 ARE Agent by XGA Engine
35
- - engine: Use XGA Engine in various scenarios
36
50
  - tools: Simulation tools for example and test
@@ -1,4 +1,5 @@
1
- ## XGAE: Extreme General Agent Engine
1
+ # XGAE: Extreme General Agent Engine
2
+ ## XGAE Features
2
3
  ### Functional Features
3
4
  - Support Custom prompt and external MCP Tools
4
5
  - Support Langfuse
@@ -13,8 +14,21 @@
13
14
  - Architecture is lighter than SUNA Engine
14
15
  - Separate tools from Agent Engine
15
16
 
16
- ### Examples
17
+
18
+ ## XGAE Run Mode
19
+ ### General Agent
20
+ - Use General Agent Prompt
21
+ - Use general tools mainly
22
+ - In addition to using general tools, custom tools can also be used
23
+
24
+ ### Custom Agent
25
+ - Use User Custom Prompt
26
+ - Use custom tools mainly
27
+ - Some general tools can also be used, like 'web_search'
28
+
29
+
30
+ ## Examples
31
+ - engine: Use XGA Engine in various scenarios, you can find out how to use General or Custom Agent
17
32
  - langgraph: Build React mode Langgraph Agent by XGA Engine
18
33
  - are: Build GAIA2 ARE Agent by XGA Engine
19
- - engine: Use XGA Engine in various scenarios
20
34
  - tools: Simulation tools for example and test
@@ -35,8 +35,8 @@
35
35
 
36
36
 
37
37
  - Modify ARE .env, add XGAE .env config, refer to env.example
38
- - Copy XGAE package 'mcpservers' and 'templates' directory to ARE project root
39
- - You can use prompt template by two modes, 'prior' mode is leading over ARE 'default agent'
38
+ - Copy XGAE package 'templates' directory to ARE project root
39
+
40
40
 
41
41
  ### Run XGA Agent in ARE
42
42
  ```
@@ -1,6 +1,8 @@
1
1
  import re
2
2
  import asyncio
3
3
  from typing import List, Dict, Any
4
+
5
+ from mammoth.results import success
4
6
  from typing_extensions import override
5
7
 
6
8
  from are.simulation.agents.are_simulation_agent import AgentStoppedException
@@ -14,7 +16,9 @@ from are.simulation.agents.agent_log import (
14
16
  SystemPromptLog,
15
17
  ThoughtLog,
16
18
  ToolCallLog,
17
- FinalAnswerLog
19
+ FinalAnswerLog,
20
+ ObservationLog,
21
+ ErrorLog
18
22
  )
19
23
  from are.simulation.agents.default_agent.base_agent import (
20
24
  BaseAgent,
@@ -64,6 +68,10 @@ def pre_run_task_check(agent, iterations: int, llm_messages: List[Dict[str, Any]
64
68
  raise AgentStoppedException("Agent stopped.")
65
69
 
66
70
  # Begin step()
71
+ agent.build_history_from_logs(
72
+ exclude_log_types=["tool_call", "rationale", "action"]
73
+ )
74
+
67
75
  agent.append_agent_log(
68
76
  LLMInputLog(
69
77
  content = llm_messages,
@@ -139,7 +147,7 @@ def terminate_task_check(agent, iterations: int) -> bool:
139
147
  is_terminate_task = False
140
148
 
141
149
  try:
142
- if agent.termination_step.condition:
150
+ if agent.termination_step and agent.termination_step.condition:
143
151
  is_terminate_task = agent.termination_step.condition(agent)
144
152
  if is_terminate_task:
145
153
  agent.logger.info(f"terminate_task_check[{iterations}]: termination_step.condition is True")
@@ -164,7 +172,7 @@ class XGAAreAgent(BaseAgent):
164
172
  tool_box = XGAAreToolBox(self.tools)
165
173
 
166
174
  general_system_prompt = "\n\n".join(prompt for prompt in self.init_system_prompts.values())
167
- prompt_builder = XGAArePromptBuilder(general_system_prompt, "prior")
175
+ prompt_builder = XGAArePromptBuilder(general_system_prompt)
168
176
 
169
177
  model_config = self.llm_engine.model_config
170
178
  llm_config = LLMConfig(
@@ -247,6 +255,16 @@ class XGAAreAgent(BaseAgent):
247
255
  elif chunk_type == "tool":
248
256
  tool_content = chunk['content']
249
257
  tool_execution = tool_content.get('tool_execution')
258
+ tool_result = tool_execution.get('result')
259
+ self.append_agent_log(
260
+ ObservationLog(
261
+ content = str(tool_result),
262
+ attachments = [],
263
+ timestamp = self.make_timestamp(),
264
+ agent_id = self.agent_id,
265
+ )
266
+ )
267
+
250
268
  self.append_agent_log(
251
269
  ToolCallLog(
252
270
  tool_name = tool_execution.get('function_name'),
@@ -1,11 +1,27 @@
1
+ from functools import partial
2
+
3
+ from are.simulation.agents.llm.llm_engine import LLMEngine
1
4
  from are.simulation.agents.are_simulation_agent_config import ARESimulationReactBaseAgentConfig
2
5
  from are.simulation.agents.default_agent.steps.are_simulation import get_are_simulation_update_pre_step
3
6
  from are.simulation.agents.default_agent.termination_methods.are_simulation import get_gaia2_termination_step
4
7
  from are.simulation.agents.default_agent.tools.json_action_executor import JsonActionExecutor
5
- from are.simulation.agents.llm.llm_engine import LLMEngine
8
+ from are.simulation.agents.default_agent.base_agent import TerminationStep
9
+ from are.simulation.agents.default_agent.termination_methods.are_simulation import termination_condition_are_simulation
6
10
 
7
11
  from are.simulation.agents.xga.are_agent import XGAAreAgent
8
12
 
13
+ termination_condition_are_simulation_send_message_to_user = partial(
14
+ termination_condition_are_simulation,
15
+ termination_tool_names=[
16
+ "AgentUserInterface__send_message_to_user"
17
+ ],
18
+ )
19
+
20
+ def get_xga_termination_step() -> TerminationStep:
21
+ return TerminationStep(
22
+ name="end_scenario",
23
+ condition=termination_condition_are_simulation_send_message_to_user,
24
+ )
9
25
 
10
26
  def xga_simulation_react_xml_agent(
11
27
  llm_engine: LLMEngine, base_agent_config: ARESimulationReactBaseAgentConfig
@@ -16,7 +32,7 @@ def xga_simulation_react_xml_agent(
16
32
  system_prompts={
17
33
  "system_prompt": str(base_agent_config.system_prompt),
18
34
  },
19
- termination_step=get_gaia2_termination_step(),
35
+ termination_step=get_xga_termination_step(),
20
36
  max_iterations=base_agent_config.max_iterations,
21
37
  action_executor=JsonActionExecutor( # Just for compatible BaseAgent, useless
22
38
  use_custom_logger=base_agent_config.use_custom_logger
@@ -0,0 +1,27 @@
1
+ import re
2
+ from typing import Optional, List, Literal
3
+
4
+ from xgae.engine.prompt_builder import XGAPromptBuilder
5
+ from xgae.utils.misc import read_file
6
+
7
+
8
+ class XGAArePromptBuilder(XGAPromptBuilder):
9
+ def __init__(self, general_system_prompt: Optional[str]):
10
+ are_system_prompt = self.build_are_system_prompt(general_system_prompt)
11
+ super().__init__(are_system_prompt)
12
+
13
+
14
+ def build_are_system_prompt(self, _system_prompt: str)-> str:
15
+ pattern = r'<general_instructions>(.*?)</general_instructions>'
16
+ prompt_are_general = re.search(pattern, _system_prompt, re.DOTALL)
17
+ prompt_header = "# CORE IDENTITY\n"
18
+ if prompt_are_general:
19
+ prompt_are_general = prompt_header + prompt_are_general.group(1).strip() + "\n\n"
20
+ else:
21
+ prompt_are_general = prompt_header + _system_prompt + "\n\n"
22
+
23
+ are_tool_prompt = read_file("templates/are_prompt_template.md")
24
+ are_system_prompt = prompt_are_general + are_tool_prompt
25
+
26
+ return are_system_prompt
27
+
@@ -21,58 +21,34 @@ class XGAAreToolBox(XGAMcpToolBox):
21
21
 
22
22
  @override
23
23
  async def init_tool_schemas(self):
24
- await self._load_mcp_tools_schema()
24
+ #await self._load_mcp_tools_schema()
25
25
  self._load_are_tools_schema()
26
26
 
27
27
 
28
28
  @override
29
29
  async def call_tool(self, task_id: str, tool_name: str, args: Optional[Dict[str, Any]] = None) -> XGAToolResult:
30
- if tool_name == "end_task":
31
- server_name = self.GENERAL_MCP_SERVER_NAME
32
- else:
33
- task_tool_schemas = self.task_tool_schemas.get(task_id, {})
34
- tool_schema = task_tool_schemas.get(tool_name, None)
35
- if tool_schema is None:
36
- raise XGAError(f"MCP tool not found: '{tool_name}'")
37
- server_name = tool_schema.server_name
30
+ task_tool_schemas = self.task_tool_schemas.get(task_id, {})
31
+ tool_schema = task_tool_schemas.get(tool_name, None)
32
+ if tool_schema is None:
33
+ raise XGAError(f"ARE tool not found: '{tool_name}'")
34
+ server_name = tool_schema.server_name
38
35
 
39
36
  tool_type = self._get_tool_type(server_name)
40
- if tool_type == "custom": # ARE Tools
41
- full_tool_name = server_name + "__" + tool_name
42
37
 
38
+ if tool_type == "system":
39
+ tool_args = args or {}
40
+ tool_args = dict({'task_id': task_id}, **tool_args)
41
+ result = self.system_tools.call_tool(tool_name, tool_args)
42
+ elif tool_type == "custom": # ARE Tools
43
43
  try:
44
- tool_result = self.are_tools[full_tool_name](**args)
44
+ tool_result = self.are_tools[tool_name](**args)
45
45
  result = convert_mcp_tool_result(str(tool_result))
46
46
  except Exception as e:
47
47
  error = f"Call ARE Tool '{tool_name}' error: {str(e)}"
48
48
  logging.error(f"AreToolBox call_are_tool: {error}")
49
49
  result = XGAToolResult(success=False, output=str(e))
50
50
  else:
51
- async with self._mcp_client.session(server_name) as session:
52
- tools = await load_mcp_tools(session)
53
- mcp_tool = next((t for t in tools if t.name == tool_name), None)
54
-
55
- if mcp_tool:
56
- tool_args = args or {}
57
-
58
- if tool_type == "general" or tool_type == "agent":
59
- tool_args = dict({'task_id': task_id}, **tool_args)
60
-
61
- try:
62
- tool_result = await mcp_tool.arun(tool_args)
63
- if tool_type == "general":
64
- tool_result = json.loads(tool_result)
65
- result = XGAToolResult(success=tool_result['success'], output=str(tool_result['output']))
66
- else:
67
- result = XGAToolResult(success=True, output=str(tool_result))
68
- except Exception as e:
69
- error = f"Call MCP Tool '{tool_name}' error: {str(e)}"
70
- logging.error(f"AreToolBox call_mcp_tool: {error}")
71
- result = XGAToolResult(success=False, output=error)
72
- else:
73
- error = f"No MCP tool found with name: {tool_name}"
74
- logging.info(f"AreToolBox call_mcp_tool: error={error}")
75
- result = XGAToolResult(success=False, output=error)
51
+ raise XGAError(f"ARE tool no support type: '{tool_type}'")
76
52
 
77
53
  return result
78
54
 
@@ -86,8 +62,8 @@ class XGAAreToolBox(XGAMcpToolBox):
86
62
  def _load_are_tools_schema(self) -> None:
87
63
  if not self._is_loaded_are_tool_schemas:
88
64
  for are_tool in self.are_tools.values():
89
- full_tool_name = are_tool.name
90
- server_name , tool_name = full_tool_name.split("__")
65
+ tool_name = are_tool.name
66
+ server_name , unction_name = tool_name.split("__")
91
67
  tool_type :XGAToolType = "custom"
92
68
  input_schema = {
93
69
  'properties': are_tool.inputs,
@@ -95,6 +71,7 @@ class XGAAreToolBox(XGAMcpToolBox):
95
71
  }
96
72
 
97
73
  tool_schema = XGAToolSchema(tool_name = tool_name,
74
+ function_name = tool_name,
98
75
  tool_type = tool_type,
99
76
  server_name = server_name,
100
77
  description = are_tool.description,
@@ -0,0 +1,57 @@
1
+ # MetaOSSAgent System Prompt
2
+
3
+ ## Core Identity
4
+
5
+ **Name**: MetaOSSAgent
6
+ **Role**: Expert Assistant for Meta Agents Research Environments
7
+ **Mission**: Deliver accurate, reliable, and effective task completion with minimal overhead
8
+
9
+ ---
10
+
11
+ ## Execution Philosophy
12
+
13
+ ### 🎯 Fundamental Principles
14
+
15
+ 1. **Silent Execution Mode**
16
+ - Work quietly and autonomously throughout task execution
17
+ - **Only communicate with users when**:
18
+ - All tasks are completely finished
19
+ - Tasks are genuinely impossible to complete
20
+ - Critical ambiguity blocks progress and requires clarification
21
+ - No status updates, progress reports, or interim communications
22
+
23
+ 2. **Complete & Thorough Delivery**
24
+ - Finish all tasks comprehensively before reporting
25
+ - Ensure all deliverables meet requirements
26
+ - Verify nothing is left incomplete
27
+
28
+ 3. **Precise Instruction Following**
29
+ - Adhere strictly to user specifications
30
+ - Respect stated constraints and preferences
31
+ - Maintain fidelity to original requirements
32
+
33
+ 4. **Proactive Problem-Solving**
34
+ - Exhaust multiple solution approaches before declaring failure
35
+ - Leverage available tools creatively
36
+ - Research and gather information independently
37
+
38
+ 5. **Self-Sufficient Information Gathering**
39
+ - Use available tools to find answers first
40
+ - Minimize unnecessary user interruptions
41
+ - Ask only when information is truly unavailable through other means
42
+
43
+ ### 🔄 Ambiguity Resolution Strategy
44
+
45
+ **When encountering unclear requirements**:
46
+
47
+ 1. **Execute Immediately**: Complete all unambiguous portions of the task
48
+ 2. **Stop Promptly**: Halt when reaching genuine ambiguity, contradictions, or impossibilities
49
+ 3. **Clarify Explicitly**: After completing clear subtasks, use the `ask` tool to request specific clarification
50
+
51
+ **Never guess or assume** when dealing with:
52
+ - Multiple entities with identical names
53
+ - Conflicting requirements
54
+ - Missing critical information
55
+ - Interpretable specifications with significant impact differences
56
+
57
+ ---
@@ -1,61 +1,3 @@
1
- # MetaOSSAgent System Prompt
2
-
3
- ## Core Identity
4
-
5
- **Name**: MetaOSSAgent
6
- **Role**: Expert Assistant for Meta Agents Research Environments
7
- **Mission**: Deliver accurate, reliable, and effective task completion with minimal overhead
8
-
9
- ---
10
-
11
- ## Execution Philosophy
12
-
13
- ### 🎯 Fundamental Principles
14
-
15
- 1. **Silent Execution Mode**
16
- - Work quietly and autonomously throughout task execution
17
- - **Only communicate with users when**:
18
- - All tasks are completely finished
19
- - Tasks are genuinely impossible to complete
20
- - Critical ambiguity blocks progress and requires clarification
21
- - No status updates, progress reports, or interim communications
22
-
23
- 2. **Complete & Thorough Delivery**
24
- - Finish all tasks comprehensively before reporting
25
- - Ensure all deliverables meet requirements
26
- - Verify nothing is left incomplete
27
-
28
- 3. **Precise Instruction Following**
29
- - Adhere strictly to user specifications
30
- - Respect stated constraints and preferences
31
- - Maintain fidelity to original requirements
32
-
33
- 4. **Proactive Problem-Solving**
34
- - Exhaust multiple solution approaches before declaring failure
35
- - Leverage available tools creatively
36
- - Research and gather information independently
37
-
38
- 5. **Self-Sufficient Information Gathering**
39
- - Use available tools to find answers first
40
- - Minimize unnecessary user interruptions
41
- - Ask only when information is truly unavailable through other means
42
-
43
- ### 🔄 Ambiguity Resolution Strategy
44
-
45
- **When encountering unclear requirements**:
46
-
47
- 1. **Execute Immediately**: Complete all unambiguous portions of the task
48
- 2. **Stop Promptly**: Halt when reaching genuine ambiguity, contradictions, or impossibilities
49
- 3. **Clarify Explicitly**: After completing clear subtasks, use the `ask` tool to request specific clarification
50
-
51
- **Never guess or assume** when dealing with:
52
- - Multiple entities with identical names
53
- - Conflicting requirements
54
- - Missing critical information
55
- - Interpretable specifications with significant impact differences
56
-
57
- ---
58
-
59
1
  ## Tool Execution Framework
60
2
 
61
3
  ### Standard Execution Cycle
@@ -121,13 +63,13 @@ THOUGHT → ACTION → OBSERVATION → [Repeat until objective achieved]
121
63
 
122
64
  ### Parameter Formatting Rules
123
65
 
124
- | Data Type | Format | Example |
125
- |-----------|--------------------------------------|---------|
126
- | String | Direct text without wrapping quotes | `<parameter name="title">Buy groceries</parameter>` |
127
- | Number | Direct numeric value | `<parameter name="count">42</parameter>` |
128
- | Boolean | Lowercase true/false | `<parameter name="active">true</parameter>` |
129
- | Object | JSON string | `<parameter name="config">{"key": "value"}</parameter>` |
130
- | Array | JSON string | `<parameter name="items">["item1", "item2"]</parameter>` |
66
+ | Data Type | Format | Example |
67
+ |-----------|-----------------------------------|---------|
68
+ | String | Direct text with wrapping quotes | `<parameter name="title">"Buy groceries"</parameter>` |
69
+ | Number | Direct numeric value | `<parameter name="count">42</parameter>` |
70
+ | Boolean | Lowercase true/false | `<parameter name="active">true</parameter>` |
71
+ | Object | JSON string | `<parameter name="config">{"key": "value"}</parameter>` |
72
+ | Array | JSON string | `<parameter name="items">["item1", "item2"]</parameter>` |
131
73
 
132
74
  ### Complete Execution Example
133
75
 
@@ -138,8 +80,8 @@ The user wants to know the current weather in Paris. I'll use the weather query
138
80
 
139
81
  <function_calls>
140
82
  <invoke name="get_weather">
141
- <parameter name="city_name">Paris</parameter>
142
- <parameter name="units">celsius</parameter>
83
+ <parameter name="city_name">"Paris"</parameter>
84
+ <parameter name="units">"celsius"</parameter>
143
85
  </invoke>
144
86
  </function_calls>
145
87
  ```
@@ -236,8 +178,15 @@ The weather data has been successfully retrieved. The temperature is 20°C with
236
178
 
237
179
  ---
238
180
 
239
- ### 📱 Application Tools
240
- {tool_schemas}
181
+ ### General Tools
182
+ <<general_tool_schemas>>
183
+
184
+
185
+ ### Application Tools
186
+ <<custom_tool_schemas>>
187
+
188
+ ### A2A Tools
189
+ <<agent_tool_schemas>>
241
190
 
242
191
  ## Critical Operating Rules
243
192
 
@@ -47,7 +47,7 @@ class CustomPromptRag:
47
47
  prompt_docs = []
48
48
  prompt_docs.append(self._create_prompt_doc(
49
49
  prompt_summary="Fault location and analysis of fault causes",
50
- prompt_path="templates/example/fault_user_prompt.txt"
50
+ prompt_path="templates/example/fault_user_prompt.md"
51
51
  ))
52
52
  return prompt_docs
53
53
 
@@ -35,7 +35,7 @@ class ReflectiontAgent:
35
35
  self.graph_langfuse = None
36
36
  self.task_engine: XGATaskEngine = None
37
37
 
38
- self.tool_box = XGAMcpToolBox(custom_mcp_server_file="mcpservers/custom_servers.json")
38
+ self.tool_box = XGAMcpToolBox(custom_mcp_server_file="xga_mcp_servers.json")
39
39
  self.result_eval_agent = TaskResultEvalAgent()
40
40
 
41
41
  if use_prompt_rag:
@@ -96,7 +96,7 @@ class ReflectiontAgent:
96
96
  system_prompt = read_file(system_prompt_path)
97
97
  else:
98
98
  if "fault" in user_input: # only for example
99
- system_prompt = read_file("templates/example/fault_user_prompt.txt")
99
+ system_prompt = read_file("templates/example/fault_user_prompt.md")
100
100
  return system_prompt
101
101
 
102
102
 
@@ -29,7 +29,7 @@ class TaskResultEvalAgent:
29
29
 
30
30
  logging.info("TaskResultEvalAgent: LLM Eval result.....")
31
31
  response = await self.model_client.acompletion(messages, langfuse_metadata)
32
- response_text = await self.model_client.get_response_result(response)
32
+ response_text = await self.model_client.get_acompletion_response(response)
33
33
 
34
34
  cleaned_text = re.sub(r'^\s*```json|```\s*$', '', response_text, flags=re.MULTILINE).strip()
35
35
  eval_result = json.loads(cleaned_text)
@@ -93,7 +93,7 @@ if __name__ == "__main__":
93
93
  async def main():
94
94
  final_result_agent = TaskResultEvalAgent()
95
95
 
96
- task_plan = read_file("templates/example/fault_user_prompt.txt")
96
+ task_plan = read_file("templates/example/fault_user_prompt.md")
97
97
  user_input = "locate 10.2.3.4 fault and solution"
98
98
 
99
99
  answer = ("Task Summary: The fault for IP 10.2.3.4 was identified as a Business Recharge Fault (Code: F01), "
@@ -12,8 +12,8 @@ async def main():
12
12
  task_no = 0
13
13
  user_inputs = [
14
14
  #"5+5", # For no tool call
15
- "locate 10.2.3.4 fault and solution", # For custom tool
16
- #"locate fault and solution", # For human append input
15
+ #"locate 10.2.3.4 fault and solution", # For custom tool
16
+ "locate fault and solution", # For human append input
17
17
  ]
18
18
 
19
19
  for user_input in user_inputs:
@@ -0,0 +1,60 @@
1
+ import asyncio
2
+
3
+ from xgae.engine.mcp_tool_box import XGAMcpToolBox
4
+ from xgae.engine.task_engine import XGATaskEngine
5
+ from xgae.utils.misc import read_file
6
+
7
+ from xgae.utils.setup_env import setup_logging
8
+
9
+
10
+ is_stream = False
11
+ if is_stream:
12
+ setup_logging(log_level="ERROR") # only show chunk
13
+ else:
14
+ setup_logging()
15
+
16
+ system_prompt = read_file("templates/example/fault_user_prompt.md")
17
+ tool_box = XGAMcpToolBox(custom_mcp_server_file="xga_mcp_servers.json")
18
+
19
+ # Before Run Exec: uv run example-fault-tools --alarmtype 2 , uv run example-a2a-tools
20
+ # If want to use real A2A agent tool, use 'xgaproxy' project run: v run xga-a2a-proxy
21
+ async def run_custom_plus_a2a_tools() -> None:
22
+ engine = XGATaskEngine(tool_box=tool_box,
23
+ custom_tools=["*"],
24
+ system_prompt=system_prompt
25
+ )
26
+
27
+
28
+ user_input = "locate 10.2.3.4 fault and solution"
29
+ global is_stream
30
+ if is_stream:
31
+ chunks = []
32
+ async for chunk in engine.run_task(task_input={"role": "user", "content": user_input}):
33
+ chunks.append(chunk)
34
+ print(chunk)
35
+
36
+ final_result = engine.parse_final_result(chunks)
37
+ print(f"\n\nFINAL_RESULT: {final_result}")
38
+ else:
39
+ final_result = await engine.run_task_with_final_answer(task_input={"role": "user", "content": user_input})
40
+ print(f"\n\nFINAL_RESULT: {final_result}")
41
+
42
+
43
+ # Before run example execute with 'xgatools' project: uv run xgatools
44
+ # Before run exec: uv run example-fault-tools --alarmtype 3 , uv run example-a2a-tools
45
+ async def run_custom_plus_general_tools() -> None:
46
+ engine = XGATaskEngine(system_prompt=system_prompt,
47
+ tool_box=tool_box,
48
+ general_tools=["web_search"],
49
+ custom_tools=["*"])
50
+
51
+ user_input = "locate 10.3.4.5 fault and solution"
52
+ final_result = await engine.run_task_with_final_answer(task_input={"role": "user", "content": user_input})
53
+ print("FINAL RESULT:", final_result)
54
+
55
+
56
+ async def main() -> None:
57
+ #await run_custom_plus_a2a_tools()
58
+ await run_custom_plus_general_tools()
59
+
60
+ asyncio.run(main())