xgae 0.2.2__tar.gz → 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of xgae might be problematic. Click here for more details.
- {xgae-0.2.2 → xgae-0.3.0}/CHANGELOG.md +18 -8
- {xgae-0.2.2 → xgae-0.3.0}/PKG-INFO +2 -3
- {xgae-0.2.2/src/examples/agent/langgraph/react → xgae-0.3.0/examples/agent/langgraph/reflection}/agent_base.py +1 -0
- {xgae-0.2.2/src/examples/agent/langgraph/react → xgae-0.3.0/examples/agent/langgraph/reflection}/custom_prompt_rag.py +2 -2
- xgae-0.2.2/src/examples/agent/langgraph/react/react_agent.py → xgae-0.3.0/examples/agent/langgraph/reflection/reflection_agent.py +14 -8
- xgae-0.2.2/src/examples/agent/langgraph/react/run_react_agent.py → xgae-0.3.0/examples/agent/langgraph/reflection/run_agent_app.py +2 -2
- {xgae-0.2.2 → xgae-0.3.0}/pyproject.toml +2 -3
- xgae-0.3.0/test/test_chroma.py +31 -0
- {xgae-0.2.2 → xgae-0.3.0}/uv.lock +795 -5
- {xgae-0.2.2/src → xgae-0.3.0}/xgae/engine/task_engine.py +37 -2
- xgae-0.3.0/xgae/gaia2/are_engine.py +122 -0
- {xgae-0.2.2 → xgae-0.3.0}/.env +0 -0
- {xgae-0.2.2 → xgae-0.3.0}/.python-version +0 -0
- {xgae-0.2.2 → xgae-0.3.0}/README.md +0 -0
- {xgae-0.2.2/src/examples/agent/langgraph/react → xgae-0.3.0/examples/agent/langgraph/reflection}/result_eval_agent.py +0 -0
- {xgae-0.2.2/src → xgae-0.3.0}/examples/engine/run_custom_and_agent_tools.py +0 -0
- {xgae-0.2.2/src → xgae-0.3.0}/examples/engine/run_general_tools.py +0 -0
- {xgae-0.2.2/src → xgae-0.3.0}/examples/engine/run_human_in_loop.py +0 -0
- {xgae-0.2.2/src → xgae-0.3.0}/examples/engine/run_simple.py +0 -0
- {xgae-0.2.2/src → xgae-0.3.0}/examples/tools/custom_fault_tools_app.py +0 -0
- {xgae-0.2.2/src → xgae-0.3.0}/examples/tools/simu_a2a_tools_app.py +0 -0
- {xgae-0.2.2 → xgae-0.3.0}/mcpservers/custom_servers.json +0 -0
- {xgae-0.2.2 → xgae-0.3.0}/mcpservers/xga_server.json +0 -0
- {xgae-0.2.2 → xgae-0.3.0}/mcpservers/xga_server_sse.json +0 -0
- {xgae-0.2.2 → xgae-0.3.0}/templates/agent_tool_prompt_template.txt +0 -0
- {xgae-0.2.2 → xgae-0.3.0}/templates/custom_tool_prompt_template.txt +0 -0
- {xgae-0.2.2 → xgae-0.3.0}/templates/example/fault_user_prompt.txt +0 -0
- {xgae-0.2.2 → xgae-0.3.0}/templates/example/result_eval_template.txt +0 -0
- {xgae-0.2.2 → xgae-0.3.0}/templates/gemini_system_prompt_template.txt +0 -0
- {xgae-0.2.2 → xgae-0.3.0}/templates/general_tool_prompt_template.txt +0 -0
- {xgae-0.2.2 → xgae-0.3.0}/templates/system_prompt_response_sample.txt +0 -0
- {xgae-0.2.2 → xgae-0.3.0}/templates/system_prompt_template.txt +0 -0
- {xgae-0.2.2 → xgae-0.3.0}/test/test_langfuse.py +0 -0
- {xgae-0.2.2 → xgae-0.3.0}/test/test_litellm_langfuse.py +0 -0
- {xgae-0.2.2/src → xgae-0.3.0}/xgae/__init__.py +0 -0
- {xgae-0.2.2/src → xgae-0.3.0}/xgae/engine/engine_base.py +0 -0
- {xgae-0.2.2/src → xgae-0.3.0}/xgae/engine/mcp_tool_box.py +0 -0
- {xgae-0.2.2/src → xgae-0.3.0}/xgae/engine/prompt_builder.py +0 -0
- {xgae-0.2.2/src → xgae-0.3.0}/xgae/engine/responser/non_stream_responser.py +0 -0
- {xgae-0.2.2/src → xgae-0.3.0}/xgae/engine/responser/responser_base.py +0 -0
- {xgae-0.2.2/src → xgae-0.3.0}/xgae/engine/responser/stream_responser.py +0 -0
- {xgae-0.2.2/src → xgae-0.3.0}/xgae/engine/task_langfuse.py +0 -0
- {xgae-0.2.2/src → xgae-0.3.0}/xgae/engine_cli_app.py +0 -0
- {xgae-0.2.2/src → xgae-0.3.0}/xgae/tools/without_general_tools_app.py +0 -0
- {xgae-0.2.2/src → xgae-0.3.0}/xgae/utils/__init__.py +0 -0
- {xgae-0.2.2/src → xgae-0.3.0}/xgae/utils/json_helpers.py +0 -0
- {xgae-0.2.2/src → xgae-0.3.0}/xgae/utils/llm_client.py +0 -0
- {xgae-0.2.2/src → xgae-0.3.0}/xgae/utils/misc.py +0 -0
- {xgae-0.2.2/src → xgae-0.3.0}/xgae/utils/setup_env.py +0 -0
- {xgae-0.2.2/src → xgae-0.3.0}/xgae/utils/xml_tool_parser.py +0 -0
|
@@ -1,33 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
## [0.2.2] - 2025-9-18
|
|
1
|
+
## [0.3.0] - 2025-10-24
|
|
3
2
|
### Added
|
|
4
|
-
-
|
|
3
|
+
- Support GAIA2 ARE Engine
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
## [0.2.4] - 2025-9-23
|
|
8
|
+
### Modified
|
|
9
|
+
- Project structure
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
## [0.2.3] - 2025-9-19
|
|
5
13
|
### Modified
|
|
6
14
|
- CustomPromptRag: remove FastEmbedEmbeddings, use 'text-embedding-v3' model for chinese, avoid download 'bge-small-zh-v1.5'
|
|
7
15
|
|
|
16
|
+
|
|
8
17
|
## [0.2.1] - 2025-9-17
|
|
9
18
|
### Added
|
|
10
|
-
- Example
|
|
19
|
+
- Example ReflectionAgent: add CustomPromptRag, use FastEmbedEmbeddings and 'BAAI/bge-small-zh-v1.5' model
|
|
11
20
|
### Modified
|
|
12
21
|
- pyproject.toml: add [project.optional-dependencies] 'examples'
|
|
13
22
|
|
|
23
|
+
|
|
14
24
|
## [0.2.0] - 2025-9-10
|
|
15
25
|
### Added
|
|
16
26
|
- Agent Engine release 0.2
|
|
17
|
-
- Example: Langgraph
|
|
27
|
+
- Example: Langgraph ReflectionAgent release 0.2
|
|
18
28
|
### Fixed
|
|
19
29
|
- Agent Engine: call mcp tool fail, call 'ask' tool again and again
|
|
20
|
-
- Example Langgraph
|
|
30
|
+
- Example Langgraph ReflectionAgent: retry on 'ask', user_input is ask answer
|
|
21
31
|
|
|
22
32
|
|
|
23
33
|
## [0.1.20] - 2025-9-9
|
|
24
34
|
### Added
|
|
25
|
-
- Example: Langgraph
|
|
35
|
+
- Example: Langgraph ReflectionAgent add final_result_agent
|
|
26
36
|
|
|
27
37
|
|
|
28
38
|
## [0.1.19] - 2025-9-8
|
|
29
39
|
### Added
|
|
30
|
-
- Example: Langgraph
|
|
40
|
+
- Example: Langgraph ReflectionAgent release V1, full logic but no final result agent and tool select agent
|
|
31
41
|
|
|
32
42
|
|
|
33
43
|
# Release Changelog
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: xgae
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: Extreme General Agent Engine
|
|
5
|
-
Requires-Python: >=3.
|
|
5
|
+
Requires-Python: >=3.11
|
|
6
6
|
Requires-Dist: colorlog==6.9.0
|
|
7
7
|
Requires-Dist: langchain-mcp-adapters==0.1.9
|
|
8
|
-
Requires-Dist: langchain==0.3.27
|
|
9
8
|
Requires-Dist: langfuse==2.60.9
|
|
10
9
|
Requires-Dist: litellm==1.74.15
|
|
11
10
|
Requires-Dist: mcp==1.13.0
|
|
@@ -7,7 +7,7 @@ from langchain_core.embeddings import Embeddings
|
|
|
7
7
|
from langchain_core.vectorstores import VectorStore
|
|
8
8
|
|
|
9
9
|
from langchain_community.vectorstores import Chroma
|
|
10
|
-
from chromadb.utils import
|
|
10
|
+
from chromadb.utils.embedding_functions import OpenAIEmbeddingFunction
|
|
11
11
|
|
|
12
12
|
class ChromaEmbedding(Embeddings):
|
|
13
13
|
embedding_model_name = "text-embedding-v3"
|
|
@@ -16,7 +16,7 @@ class ChromaEmbedding(Embeddings):
|
|
|
16
16
|
api_key = os.getenv('LLM_API_KEY')
|
|
17
17
|
api_base = os.getenv('LLM_API_BASE', "https://dashscope.aliyuncs.com/compatible-mode/v1")
|
|
18
18
|
|
|
19
|
-
self.embedding_function =
|
|
19
|
+
self.embedding_function = OpenAIEmbeddingFunction(
|
|
20
20
|
api_key = api_key,
|
|
21
21
|
api_base = api_base,
|
|
22
22
|
model_name = self.embedding_model_name,
|
|
@@ -7,7 +7,6 @@ from uuid import uuid4
|
|
|
7
7
|
from langfuse.callback import CallbackHandler
|
|
8
8
|
from langfuse import Langfuse
|
|
9
9
|
|
|
10
|
-
|
|
11
10
|
from langgraph.graph import END, START, StateGraph
|
|
12
11
|
from langgraph.types import interrupt, Command
|
|
13
12
|
from langgraph.checkpoint.memory import MemorySaver
|
|
@@ -20,11 +19,12 @@ from xgae.engine.engine_base import XGATaskResult
|
|
|
20
19
|
from xgae.engine.mcp_tool_box import XGAMcpToolBox
|
|
21
20
|
from xgae.engine.task_engine import XGATaskEngine
|
|
22
21
|
|
|
23
|
-
from examples.agent.langgraph.
|
|
24
|
-
from examples.agent.langgraph.
|
|
25
|
-
from examples.agent.langgraph.
|
|
22
|
+
from examples.agent.langgraph.reflection.agent_base import AgentContext, TaskState, EvaluateResult
|
|
23
|
+
from examples.agent.langgraph.reflection.result_eval_agent import TaskResultEvalAgent
|
|
24
|
+
from examples.agent.langgraph.reflection.custom_prompt_rag import CustomPromptRag
|
|
25
|
+
|
|
26
26
|
|
|
27
|
-
class
|
|
27
|
+
class ReflectiontAgent:
|
|
28
28
|
MAX_TASK_RETRY = 2
|
|
29
29
|
QUALIFIED_RESULT_SCORE = 0.7
|
|
30
30
|
|
|
@@ -89,18 +89,24 @@ class XGAReactAgent:
|
|
|
89
89
|
|
|
90
90
|
|
|
91
91
|
def _search_system_prompt(self, user_input: str) -> str:
|
|
92
|
+
system_prompt = None
|
|
92
93
|
if hasattr(self, 'custom_prompt_rag'):
|
|
93
|
-
|
|
94
|
+
system_prompt_path = self.custom_prompt_rag.search_prompt(user_input)
|
|
95
|
+
if system_prompt_path:
|
|
96
|
+
system_prompt = read_file(system_prompt_path)
|
|
94
97
|
else:
|
|
95
|
-
|
|
98
|
+
if "fault" in user_input: # only for example
|
|
99
|
+
system_prompt = read_file("templates/example/fault_user_prompt.txt")
|
|
96
100
|
return system_prompt
|
|
97
101
|
|
|
98
102
|
|
|
99
103
|
async def _supervisor_node(self, state: TaskState) -> Dict[str, Any]:
|
|
100
104
|
user_input = state['user_inputs'][0]
|
|
101
105
|
eval_result = state.get('eval_result', None)
|
|
106
|
+
system_prompt = state.get('system_prompt', None)
|
|
102
107
|
|
|
103
|
-
system_prompt
|
|
108
|
+
if system_prompt is None and eval_result is None:
|
|
109
|
+
system_prompt = self._search_system_prompt(user_input)
|
|
104
110
|
is_system_prompt = True if system_prompt is not None else False
|
|
105
111
|
|
|
106
112
|
general_tools = [] if system_prompt else ["*"]
|
|
@@ -4,7 +4,7 @@ from uuid import uuid4
|
|
|
4
4
|
|
|
5
5
|
from xgae.utils.setup_env import setup_logging
|
|
6
6
|
|
|
7
|
-
from examples.agent.langgraph.
|
|
7
|
+
from examples.agent.langgraph.reflection.reflection_agent import ReflectiontAgent, AgentContext
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
async def main():
|
|
@@ -17,7 +17,7 @@ async def main():
|
|
|
17
17
|
]
|
|
18
18
|
|
|
19
19
|
for user_input in user_inputs:
|
|
20
|
-
agent =
|
|
20
|
+
agent = ReflectiontAgent(use_prompt_rag=True)
|
|
21
21
|
task_no += 1
|
|
22
22
|
context: AgentContext = {
|
|
23
23
|
'task_id': f"agent_task_{uuid4()}", # can be set with request_id, must be unique
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "xgae"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.3.0"
|
|
4
4
|
description = "Extreme General Agent Engine"
|
|
5
5
|
readme = "README.md"
|
|
6
|
-
requires-python = ">=3.
|
|
6
|
+
requires-python = ">=3.11"
|
|
7
7
|
dependencies = [
|
|
8
8
|
"colorlog==6.9.0",
|
|
9
9
|
"litellm==1.74.15",
|
|
10
10
|
"mcp==1.13.0",
|
|
11
11
|
"langfuse==2.60.9",
|
|
12
|
-
"langchain==0.3.27",
|
|
13
12
|
"langchain-mcp-adapters==0.1.9",
|
|
14
13
|
]
|
|
15
14
|
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import chromadb
|
|
2
|
+
|
|
3
|
+
chroma_client = chromadb.EphemeralClient()
|
|
4
|
+
|
|
5
|
+
# default use 'ONNXMiniLM_L6_V2' embedding function
|
|
6
|
+
collection = chroma_client.get_or_create_collection(name="fault_collection")
|
|
7
|
+
|
|
8
|
+
collection.upsert(
|
|
9
|
+
documents=[
|
|
10
|
+
"Fault location and analysis of fault causes",
|
|
11
|
+
"This is a analyse about alarm"
|
|
12
|
+
],
|
|
13
|
+
ids=["id1", "id2"],
|
|
14
|
+
metadatas=[{"type": 1}, {"type": 2}]
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
querys = ["locate fault and solution",
|
|
18
|
+
"alarm search"
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
for query in querys:
|
|
22
|
+
results = collection.query(
|
|
23
|
+
query_texts=query,
|
|
24
|
+
n_results=2,
|
|
25
|
+
#where={"type": 1},
|
|
26
|
+
where={"type": {"$gt": 0}},
|
|
27
|
+
where_document = {"$contains": "fault"}
|
|
28
|
+
)
|
|
29
|
+
print("*"*50)
|
|
30
|
+
print(f"query='{query}', id={results['ids'][0]}, score={results['distances'][0]}")
|
|
31
|
+
|