xgae 0.1.6__tar.gz → 0.1.8__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.1.6 → xgae-0.1.8}/.env +3 -0
- {xgae-0.1.6 → xgae-0.1.8}/.idea/misc.xml +1 -1
- {xgae-0.1.6 → xgae-0.1.8}/.idea/workspace.xml +72 -58
- {xgae-0.1.6 → xgae-0.1.8}/.idea/xgae.iml +1 -1
- xgae-0.1.8/PKG-INFO +11 -0
- xgae-0.1.8/mcpservers/xga_server.json +11 -0
- {xgae-0.1.6 → xgae-0.1.8}/pyproject.toml +8 -7
- xgae-0.1.8/src/examples/run_human_in_loop.py +29 -0
- xgae-0.1.8/src/examples/run_simple.py +12 -0
- xgae-0.1.8/src/examples/run_user_prompt.py +30 -0
- {xgae-0.1.6 → xgae-0.1.8}/src/xgae/engine/engine_base.py +1 -1
- {xgae-0.1.6 → xgae-0.1.8}/src/xgae/engine/mcp_tool_box.py +8 -6
- {xgae-0.1.6 → xgae-0.1.8}/src/xgae/engine/prompt_builder.py +1 -1
- {xgae-0.1.6 → xgae-0.1.8}/src/xgae/engine/responser/non_stream_responser.py +5 -7
- {xgae-0.1.6 → xgae-0.1.8}/src/xgae/engine/responser/responser_base.py +30 -42
- {xgae-0.1.6 → xgae-0.1.8}/src/xgae/engine/responser/stream_responser.py +24 -25
- {xgae-0.1.6 → xgae-0.1.8}/src/xgae/engine/task_engine.py +147 -110
- xgae-0.1.8/src/xgae/tools/without_general_tools_app.py +48 -0
- {xgae-0.1.6 → xgae-0.1.8}/src/xgae/utils/__init__.py +1 -5
- {xgae-0.1.6 → xgae-0.1.8}/src/xgae/utils/llm_client.py +50 -33
- {xgae-0.1.6 → xgae-0.1.8}/src/xgae/utils/setup_env.py +20 -18
- xgae-0.1.8/templates/example_user_prompt.txt +22 -0
- xgae-0.1.8/test/test_langfuse.py +28 -0
- xgae-0.1.8/test/test_litellm_langfuse.py +58 -0
- {xgae-0.1.6 → xgae-0.1.8}/uv.lock +18 -127
- xgae-0.1.6/PKG-INFO +0 -11
- xgae-0.1.6/templates/scp_test_prompt.txt +0 -21
- {xgae-0.1.6 → xgae-0.1.8}/.idea/.gitignore +0 -0
- {xgae-0.1.6 → xgae-0.1.8}/.idea/inspectionProfiles/Project_Default.xml +0 -0
- {xgae-0.1.6 → xgae-0.1.8}/.idea/inspectionProfiles/profiles_settings.xml +0 -0
- {xgae-0.1.6 → xgae-0.1.8}/.idea/modules.xml +0 -0
- {xgae-0.1.6 → xgae-0.1.8}/.idea/vcs.xml +0 -0
- {xgae-0.1.6 → xgae-0.1.8}/.python-version +0 -0
- {xgae-0.1.6 → xgae-0.1.8}/README.md +0 -0
- {xgae-0.1.6 → xgae-0.1.8}/mcpservers/custom_servers.json +0 -0
- /xgae-0.1.6/mcpservers/xga_server.json → /xgae-0.1.8/mcpservers/xga_server_sse.json +0 -0
- {xgae-0.1.6 → xgae-0.1.8}/src/xgae/__init__.py +0 -0
- {xgae-0.1.6 → xgae-0.1.8}/src/xgae/utils/json_helpers.py +0 -0
- {xgae-0.1.6 → xgae-0.1.8}/src/xgae/utils/misc.py +0 -0
- {xgae-0.1.6 → xgae-0.1.8}/src/xgae/utils/xml_tool_parser.py +0 -0
- {xgae-0.1.6 → xgae-0.1.8}/templates/custom_tool_prompt_template.txt +0 -0
- {xgae-0.1.6 → xgae-0.1.8}/templates/gemini_system_prompt_template.txt +0 -0
- {xgae-0.1.6 → xgae-0.1.8}/templates/general_tool_prompt_template.txt +0 -0
- {xgae-0.1.6 → xgae-0.1.8}/templates/system_prompt_response_sample.txt +0 -0
- {xgae-0.1.6 → xgae-0.1.8}/templates/system_prompt_template.txt +0 -0
{xgae-0.1.6 → xgae-0.1.8}/.env
RENAMED
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
<component name="Black">
|
|
4
4
|
<option name="sdkName" value="Python 3.13 (xgae)" />
|
|
5
5
|
</component>
|
|
6
|
-
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.13 virtualenv at ~/
|
|
6
|
+
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.13 virtualenv at ~/DevProjects/xga/xgae/.venv" project-jdk-type="Python SDK" />
|
|
7
7
|
</project>
|
|
@@ -25,26 +25,37 @@
|
|
|
25
25
|
<option name="hideEmptyMiddlePackages" value="true" />
|
|
26
26
|
<option name="showLibraryContents" value="true" />
|
|
27
27
|
</component>
|
|
28
|
-
<component name="PropertiesComponent"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
28
|
+
<component name="PropertiesComponent"><![CDATA[{
|
|
29
|
+
"keyToString": {
|
|
30
|
+
"ModuleVcsDetector.initialDetectionPerformed": "true",
|
|
31
|
+
"Python.llm_client.executor": "Run",
|
|
32
|
+
"Python.mcp_tool_box.executor": "Run",
|
|
33
|
+
"Python.message_tools_app.executor": "Run",
|
|
34
|
+
"Python.responser_base.executor": "Run",
|
|
35
|
+
"Python.run_engine_with_human_in_loop.executor": "Run",
|
|
36
|
+
"Python.run_simple.executor": "Run",
|
|
37
|
+
"Python.run_task_engine.executor": "Run",
|
|
38
|
+
"Python.run_user_prompt.executor": "Run",
|
|
39
|
+
"Python.run_xga_engine.executor": "Run",
|
|
40
|
+
"Python.setup_env.executor": "Run",
|
|
41
|
+
"Python.task_engine.executor": "Run",
|
|
42
|
+
"Python.test_langfuse.executor": "Run",
|
|
43
|
+
"Python.test_litellm_langfuse.executor": "Run",
|
|
44
|
+
"Python.utils.executor": "Run",
|
|
45
|
+
"Python.xga_engine.executor": "Run",
|
|
46
|
+
"Python.xga_mcp_tool_box.executor": "Debug",
|
|
47
|
+
"Python.xga_prompt_builder.executor": "Debug",
|
|
48
|
+
"RunOnceActivity.ShowReadmeOnStart": "true",
|
|
49
|
+
"last_opened_file_path": "/Users/sharkystar/DevProjects/xga/xgae",
|
|
50
|
+
"node.js.detected.package.eslint": "true",
|
|
51
|
+
"node.js.detected.package.tslint": "true",
|
|
52
|
+
"node.js.selected.package.eslint": "(autodetect)",
|
|
53
|
+
"node.js.selected.package.tslint": "(autodetect)",
|
|
54
|
+
"nodejs_package_manager_path": "npm",
|
|
55
|
+
"settings.editor.selected.configurable": "com.intellij.pycharm.community.ide.impl.configuration.PythonContentEntriesConfigurable",
|
|
56
|
+
"vue.rearranger.settings.migration": "true"
|
|
46
57
|
}
|
|
47
|
-
}
|
|
58
|
+
}]]></component>
|
|
48
59
|
<component name="RecentsManager">
|
|
49
60
|
<key name="MoveFile.RECENT_KEYS">
|
|
50
61
|
<recent name="$PROJECT_DIR$/src/xgae/engine/responser" />
|
|
@@ -60,6 +71,7 @@
|
|
|
60
71
|
<env name="PYTHONUNBUFFERED" value="1" />
|
|
61
72
|
</envs>
|
|
62
73
|
<option name="SDK_HOME" value="" />
|
|
74
|
+
<option name="SDK_NAME" value="Python 3.13 virtualenv at ~/DevProjects/xga/xgae/.venv" />
|
|
63
75
|
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
|
64
76
|
<option name="IS_MODULE_SDK" value="false" />
|
|
65
77
|
<option name="ADD_CONTENT_ROOTS" value="true" />
|
|
@@ -84,7 +96,7 @@
|
|
|
84
96
|
<option name="INPUT_FILE" value="" />
|
|
85
97
|
<method v="2" />
|
|
86
98
|
</configuration>
|
|
87
|
-
<configuration name="
|
|
99
|
+
<configuration name="run_task_engine" type="PythonConfigurationType" factoryName="Python">
|
|
88
100
|
<module name="xgae" />
|
|
89
101
|
<option name="ENV_FILES" value="" />
|
|
90
102
|
<option name="INTERPRETER_OPTIONS" value="" />
|
|
@@ -117,11 +129,6 @@
|
|
|
117
129
|
<option name="INPUT_FILE" value="" />
|
|
118
130
|
<method v="2" />
|
|
119
131
|
</configuration>
|
|
120
|
-
<recent_temporary>
|
|
121
|
-
<list>
|
|
122
|
-
<item itemvalue="Python.run_xga_engine" />
|
|
123
|
-
</list>
|
|
124
|
-
</recent_temporary>
|
|
125
132
|
</component>
|
|
126
133
|
<component name="SharedIndexes">
|
|
127
134
|
<attachedChunks>
|
|
@@ -145,46 +152,53 @@
|
|
|
145
152
|
<workItem from="1755270285722" duration="12068000" />
|
|
146
153
|
<workItem from="1755283728206" duration="1511000" />
|
|
147
154
|
<workItem from="1755286552901" duration="3130000" />
|
|
148
|
-
<workItem from="
|
|
149
|
-
<workItem from="
|
|
150
|
-
<workItem from="
|
|
151
|
-
<workItem from="
|
|
152
|
-
<workItem from="
|
|
153
|
-
<workItem from="
|
|
154
|
-
<workItem from="
|
|
155
|
-
<workItem from="
|
|
156
|
-
<workItem from="
|
|
157
|
-
<workItem from="
|
|
158
|
-
<workItem from="
|
|
159
|
-
<workItem from="
|
|
160
|
-
<workItem from="
|
|
161
|
-
<workItem from="1755690345086" duration="6847000" />
|
|
162
|
-
<workItem from="1755781193226" duration="485000" />
|
|
163
|
-
<workItem from="1755781685826" duration="38000" />
|
|
164
|
-
<workItem from="1755781735460" duration="170000" />
|
|
165
|
-
<workItem from="1755817545372" duration="285000" />
|
|
166
|
-
<workItem from="1755862006389" duration="1051000" />
|
|
167
|
-
<workItem from="1755863094184" duration="553000" />
|
|
168
|
-
<workItem from="1755863979826" duration="4236000" />
|
|
169
|
-
<workItem from="1755875255916" duration="2308000" />
|
|
170
|
-
<workItem from="1755877576514" duration="2000" />
|
|
171
|
-
<workItem from="1755878805800" duration="3590000" />
|
|
172
|
-
<workItem from="1755904284653" duration="7803000" />
|
|
173
|
-
<workItem from="1755912586948" duration="1553000" />
|
|
174
|
-
<workItem from="1755915353109" duration="5872000" />
|
|
175
|
-
<workItem from="1755997335603" duration="7550000" />
|
|
155
|
+
<workItem from="1755409529770" duration="670000" />
|
|
156
|
+
<workItem from="1755478595168" duration="20000" />
|
|
157
|
+
<workItem from="1755479257156" duration="16895000" />
|
|
158
|
+
<workItem from="1755525531052" duration="13030000" />
|
|
159
|
+
<workItem from="1755585869510" duration="5796000" />
|
|
160
|
+
<workItem from="1755593112104" duration="786000" />
|
|
161
|
+
<workItem from="1755611972189" duration="13340000" />
|
|
162
|
+
<workItem from="1755668525673" duration="14877000" />
|
|
163
|
+
<workItem from="1755700523844" duration="24000" />
|
|
164
|
+
<workItem from="1755737435202" duration="48139000" />
|
|
165
|
+
<workItem from="1756044658912" duration="1248000" />
|
|
166
|
+
<workItem from="1756082326044" duration="23657000" />
|
|
167
|
+
<workItem from="1756168626188" duration="26778000" />
|
|
176
168
|
</task>
|
|
177
169
|
<servers />
|
|
178
170
|
</component>
|
|
179
171
|
<component name="TypeScriptGeneratedFilesManager">
|
|
180
172
|
<option name="version" value="3" />
|
|
181
173
|
</component>
|
|
174
|
+
<component name="XDebuggerManager">
|
|
175
|
+
<breakpoint-manager>
|
|
176
|
+
<default-breakpoints>
|
|
177
|
+
<breakpoint type="python-exception">
|
|
178
|
+
<properties notifyOnTerminate="true" exception="BaseException">
|
|
179
|
+
<option name="notifyOnTerminate" value="true" />
|
|
180
|
+
</properties>
|
|
181
|
+
</breakpoint>
|
|
182
|
+
</default-breakpoints>
|
|
183
|
+
</breakpoint-manager>
|
|
184
|
+
</component>
|
|
182
185
|
<component name="com.intellij.coverage.CoverageDataManagerImpl">
|
|
183
|
-
<SUITE FILE_PATH="coverage/xgae$
|
|
184
|
-
<SUITE FILE_PATH="coverage/xgae$
|
|
185
|
-
<SUITE FILE_PATH="coverage/xgae$
|
|
186
|
-
<SUITE FILE_PATH="coverage/xgae$run_xga_engine.coverage" NAME="
|
|
187
|
-
<SUITE FILE_PATH="coverage/xgae$
|
|
186
|
+
<SUITE FILE_PATH="coverage/xgae$test_litellm_langfuse.coverage" NAME="test_litellm_langfuse Coverage Results" MODIFIED="1756196476262" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
|
|
187
|
+
<SUITE FILE_PATH="coverage/xgae$xga_engine.coverage" NAME="xga_engine Coverage Results" MODIFIED="1755580277172" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
|
|
188
|
+
<SUITE FILE_PATH="coverage/xgae$run_simple.coverage" NAME="run_simple Coverage Results" MODIFIED="1756111714718" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
|
|
189
|
+
<SUITE FILE_PATH="coverage/xgae$run_xga_engine.coverage" NAME="run_task_engine Coverage Results" MODIFIED="1756111613459" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
|
|
190
|
+
<SUITE FILE_PATH="coverage/xgae$message_tools_app.coverage" NAME="message_tools_app Coverage Results" MODIFIED="1756094157566" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
|
|
191
|
+
<SUITE FILE_PATH="coverage/xgae$run_engine_with_human_in_loop.coverage" NAME="run_engine_with_human_in_loop Coverage Results" MODIFIED="1756089269027" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
|
|
192
|
+
<SUITE FILE_PATH="coverage/xgae$xga_prompt_builder.coverage" NAME="xga_prompt_builder Coverage Results" MODIFIED="1755587456555" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
|
|
193
|
+
<SUITE FILE_PATH="coverage/xgae$test_langfuse.coverage" NAME="test_langfuse Coverage Results" MODIFIED="1756196410142" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
|
|
194
|
+
<SUITE FILE_PATH="coverage/xgae$run_task_engine.coverage" NAME="run_task_engine Coverage Results" MODIFIED="1756207048901" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
|
|
195
|
+
<SUITE FILE_PATH="coverage/xgae$responser_base.coverage" NAME="responser_base Coverage Results" MODIFIED="1756103040764" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
|
|
196
|
+
<SUITE FILE_PATH="coverage/xgae$mcp_tool_box.coverage" NAME="mcp_tool_box Coverage Results" MODIFIED="1756188784603" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
|
|
188
197
|
<SUITE FILE_PATH="coverage/xgae$utils.coverage" NAME="utils Coverage Results" MODIFIED="1755226923439" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
|
|
198
|
+
<SUITE FILE_PATH="coverage/xgae$setup_env.coverage" NAME="setup_env Coverage Results" MODIFIED="1756200209483" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
|
|
199
|
+
<SUITE FILE_PATH="coverage/xgae$run_user_prompt.coverage" NAME="run_user_prompt Coverage Results" MODIFIED="1756089624828" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
|
|
200
|
+
<SUITE FILE_PATH="coverage/xgae$xga_mcp_tool_box.coverage" NAME="xga_mcp_tool_box Coverage Results" MODIFIED="1755583099719" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
|
|
201
|
+
<SUITE FILE_PATH="coverage/xgae$llm_client.coverage" NAME="llm_client Coverage Results" MODIFIED="1756188100577" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
|
|
202
|
+
<SUITE FILE_PATH="coverage/xgae$task_engine.coverage" NAME="task_engine Coverage Results" MODIFIED="1756199881134" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
|
|
189
203
|
</component>
|
|
190
204
|
</project>
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
|
6
6
|
<excludeFolder url="file://$MODULE_DIR$/.venv" />
|
|
7
7
|
</content>
|
|
8
|
-
<orderEntry type="jdk" jdkName="Python 3.13 virtualenv at ~/
|
|
8
|
+
<orderEntry type="jdk" jdkName="Python 3.13 virtualenv at ~/DevProjects/xga/xgae/.venv" jdkType="Python SDK" />
|
|
9
9
|
<orderEntry type="sourceFolder" forTests="false" />
|
|
10
10
|
</component>
|
|
11
11
|
</module>
|
xgae-0.1.8/PKG-INFO
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: xgae
|
|
3
|
+
Version: 0.1.8
|
|
4
|
+
Summary: Extreme General Agent Engine
|
|
5
|
+
Requires-Python: >=3.13
|
|
6
|
+
Requires-Dist: colorlog==6.9.0
|
|
7
|
+
Requires-Dist: langchain-mcp-adapters==0.1.9
|
|
8
|
+
Requires-Dist: langfuse==2.60.9
|
|
9
|
+
Requires-Dist: langgraph==0.6.5
|
|
10
|
+
Requires-Dist: litellm==1.74.15
|
|
11
|
+
Requires-Dist: mcp==1.13.0
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "xgae"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.8"
|
|
4
4
|
description = "Extreme General Agent Engine"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.13"
|
|
7
7
|
dependencies = [
|
|
8
|
-
"colorlog
|
|
9
|
-
"langchain-mcp-adapters
|
|
10
|
-
"langgraph
|
|
11
|
-
"litellm
|
|
12
|
-
"mcp
|
|
13
|
-
"langfuse
|
|
8
|
+
"colorlog==6.9.0",
|
|
9
|
+
"langchain-mcp-adapters==0.1.9",
|
|
10
|
+
"langgraph==0.6.5",
|
|
11
|
+
"litellm==1.74.15",
|
|
12
|
+
"mcp==1.13.0",
|
|
13
|
+
"langfuse==2.60.9",
|
|
14
14
|
]
|
|
15
15
|
|
|
16
16
|
[build-system]
|
|
@@ -21,3 +21,4 @@ build-backend = "hatchling.build"
|
|
|
21
21
|
exclude = ["log/*"]
|
|
22
22
|
|
|
23
23
|
[project.scripts]
|
|
24
|
+
xgae-tools = "xgae.tools.without_general_tools_app:main"
|
|
@@ -0,0 +1,29 @@
|
|
|
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.llm_client import LLMConfig
|
|
6
|
+
from xgae.utils.misc import read_file
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
async def main() -> None:
|
|
10
|
+
tool_box = XGAMcpToolBox(custom_mcp_server_file="mcpservers/custom_servers.json")
|
|
11
|
+
system_prompt = read_file("templates/example_user_prompt.txt")
|
|
12
|
+
engine = XGATaskEngine(tool_box=tool_box,
|
|
13
|
+
general_tools=[],
|
|
14
|
+
custom_tools=["*"],
|
|
15
|
+
llm_config=LLMConfig(stream=False),
|
|
16
|
+
system_prompt=system_prompt,
|
|
17
|
+
max_auto_run=8)
|
|
18
|
+
|
|
19
|
+
user_input = "locate fault and solution"
|
|
20
|
+
final_result = await engine.run_task_with_final_answer(task_message={"role": "user", "content": user_input})
|
|
21
|
+
print("FINAL RESULT:", final_result)
|
|
22
|
+
|
|
23
|
+
if final_result["type"] == "ask":
|
|
24
|
+
print("====== Wait for user input ... ======")
|
|
25
|
+
user_input = "ip=10.0.1.1"
|
|
26
|
+
final_result = await engine.run_task_with_final_answer(task_message={"role": "user", "content": user_input})
|
|
27
|
+
print("FINAL RESULT:", final_result)
|
|
28
|
+
|
|
29
|
+
asyncio.run(main())
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
|
|
3
|
+
from xgae.engine.task_engine import XGATaskEngine
|
|
4
|
+
from xgae.utils.llm_client import LLMConfig
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
async def main() -> None:
|
|
8
|
+
engine = XGATaskEngine(llm_config=LLMConfig(stream=False), max_auto_run=1)
|
|
9
|
+
final_result = await engine.run_task_with_final_answer(task_message={"role": "user", "content": "1+1"})
|
|
10
|
+
print("FINAL RESULT:", final_result)
|
|
11
|
+
|
|
12
|
+
asyncio.run(main())
|
|
@@ -0,0 +1,30 @@
|
|
|
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.llm_client import LLMConfig
|
|
6
|
+
from xgae.utils.misc import read_file
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
async def main() -> None:
|
|
10
|
+
tool_box = XGAMcpToolBox(custom_mcp_server_file="mcpservers/custom_servers.json")
|
|
11
|
+
system_prompt = read_file("templates/example_user_prompt.txt")
|
|
12
|
+
engine = XGATaskEngine(tool_box=tool_box,
|
|
13
|
+
general_tools=[],
|
|
14
|
+
custom_tools=["*"],
|
|
15
|
+
llm_config=LLMConfig(stream=False),
|
|
16
|
+
system_prompt=system_prompt,
|
|
17
|
+
max_auto_run=8)
|
|
18
|
+
|
|
19
|
+
user_input = "locate 10.2.3.4 fault and solution"
|
|
20
|
+
is_final_result = False
|
|
21
|
+
|
|
22
|
+
if is_final_result:
|
|
23
|
+
final_result = await engine.run_task_with_final_answer(task_message={"role": "user", "content": user_input})
|
|
24
|
+
print("FINAL RESULT:", final_result)
|
|
25
|
+
else:
|
|
26
|
+
# Get All Task Process Message
|
|
27
|
+
async for chunk in engine.run_task(task_message={"role": "user", "content": user_input}):
|
|
28
|
+
print(chunk)
|
|
29
|
+
|
|
30
|
+
asyncio.run(main())
|
|
@@ -8,7 +8,6 @@ from langchain_mcp_adapters.client import MultiServerMCPClient
|
|
|
8
8
|
from langchain_mcp_adapters.tools import load_mcp_tools
|
|
9
9
|
|
|
10
10
|
from xgae.engine.engine_base import XGAError, XGAToolSchema, XGAToolBox, XGAToolResult
|
|
11
|
-
from xgae.utils import langfuse
|
|
12
11
|
|
|
13
12
|
class XGAMcpToolBox(XGAToolBox):
|
|
14
13
|
GENERAL_MCP_SERVER_NAME = "xga_general"
|
|
@@ -46,6 +45,12 @@ class XGAMcpToolBox(XGAToolBox):
|
|
|
46
45
|
task_tool_schemas[tool_schema.tool_name] = tool_schema
|
|
47
46
|
task_tool_schemas.pop("end_task", None)
|
|
48
47
|
|
|
48
|
+
if len(custom_tools) == 1 and custom_tools[0] == "*":
|
|
49
|
+
custom_tools = []
|
|
50
|
+
for server_name in self.mcp_server_names:
|
|
51
|
+
if server_name != XGAMcpToolBox.GENERAL_MCP_SERVER_NAME:
|
|
52
|
+
custom_tools.append(f"{server_name}.*")
|
|
53
|
+
|
|
49
54
|
for server_tool_name in custom_tools:
|
|
50
55
|
parts = server_tool_name.split(".")
|
|
51
56
|
if len(parts) != 2:
|
|
@@ -188,8 +193,8 @@ if __name__ == "__main__":
|
|
|
188
193
|
|
|
189
194
|
async def main():
|
|
190
195
|
task_id = "task1"
|
|
191
|
-
|
|
192
|
-
mcp_tool_box = XGAMcpToolBox()
|
|
196
|
+
mcp_tool_box = XGAMcpToolBox(custom_mcp_server_file="mcpservers/custom_servers.json")
|
|
197
|
+
#mcp_tool_box = XGAMcpToolBox()
|
|
193
198
|
await mcp_tool_box.load_mcp_tools_schema()
|
|
194
199
|
await mcp_tool_box.creat_task_tool_box(task_id=task_id, general_tools=["*"], custom_tools=["bomc_fault.*"])
|
|
195
200
|
tool_schemas = mcp_tool_box.get_task_tool_schemas(task_id, "general_tool")
|
|
@@ -204,9 +209,6 @@ if __name__ == "__main__":
|
|
|
204
209
|
print(asdict(tool_schema))
|
|
205
210
|
print()
|
|
206
211
|
|
|
207
|
-
result = await mcp_tool_box.call_tool(task_id=task_id, tool_name="web_search", args={"task_id": task_id, "query": "查询天津天气"})
|
|
208
|
-
print(f"call web_search result: {result}")
|
|
209
|
-
|
|
210
212
|
result = await mcp_tool_box.call_tool(task_id=task_id, tool_name="complete", args={"task_id": task_id})
|
|
211
213
|
print(f"call complete result: {result}")
|
|
212
214
|
|
|
@@ -3,7 +3,6 @@ import logging
|
|
|
3
3
|
from typing import List, Dict, Any, AsyncGenerator, override,Optional
|
|
4
4
|
|
|
5
5
|
from xgae.engine.responser.responser_base import TaskResponseProcessor, TaskResponserContext, TaskRunContinuousState
|
|
6
|
-
from xgae.utils import langfuse
|
|
7
6
|
from xgae.utils.json_helpers import format_for_yield
|
|
8
7
|
|
|
9
8
|
class NonStreamTaskResponser(TaskResponseProcessor):
|
|
@@ -16,6 +15,7 @@ class NonStreamTaskResponser(TaskResponseProcessor):
|
|
|
16
15
|
llm_content = ""
|
|
17
16
|
parsed_xml_data = []
|
|
18
17
|
finish_reason = None
|
|
18
|
+
llm_count = continuous_state.get("auto_continue_count")
|
|
19
19
|
|
|
20
20
|
try:
|
|
21
21
|
# Extract finish_reason, content, tool calls
|
|
@@ -24,8 +24,8 @@ class NonStreamTaskResponser(TaskResponseProcessor):
|
|
|
24
24
|
finish_reason = llm_response.choices[0].finish_reason
|
|
25
25
|
logging.info(f"NonStreamTask:LLM response finish_reason={finish_reason}")
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
status_message=(f"
|
|
27
|
+
self.root_span.event(name=f"non_stream_processor_start[{self.task_no}]({llm_count})", level="DEFAULT",
|
|
28
|
+
status_message=(f"finish_reason={finish_reason}, tool_exec_strategy={self.tool_execution_strategy}"))
|
|
29
29
|
|
|
30
30
|
response_message = llm_response.choices[0].message if hasattr(llm_response.choices[0], 'message') else None
|
|
31
31
|
if response_message:
|
|
@@ -54,8 +54,6 @@ class NonStreamTaskResponser(TaskResponseProcessor):
|
|
|
54
54
|
tool_calls_to_execute = [item['tool_call'] for item in parsed_xml_data]
|
|
55
55
|
if len(tool_calls_to_execute) > 0:
|
|
56
56
|
logging.info(f"NonStreamTask:Executing {len(tool_calls_to_execute)} tools with strategy: {self.tool_execution_strategy}")
|
|
57
|
-
langfuse.create_event(trace_context=self.trace_context, name="executing_tools_with_strategy", level="DEFAULT", status_message=(
|
|
58
|
-
f"NonStreamTask Executing {len(tool_calls_to_execute)} tools with strategy: {self.tool_execution_strategy}"))
|
|
59
57
|
|
|
60
58
|
tool_results = await self._execute_tools(tool_calls_to_execute, self.tool_execution_strategy)
|
|
61
59
|
|
|
@@ -92,7 +90,7 @@ class NonStreamTaskResponser(TaskResponseProcessor):
|
|
|
92
90
|
|
|
93
91
|
except Exception as e:
|
|
94
92
|
logging.error(f"NonStreamTask: Error processing non-streaming response: {llm_content}")
|
|
95
|
-
|
|
93
|
+
self.root_span.event(name="error_processing_non_streaming_response", level="ERROR",
|
|
96
94
|
status_message=(f"Error processing non-streaming response: {str(e)}"))
|
|
97
95
|
|
|
98
96
|
content = {"role": "system", "status_type": "error", "message": str(e)}
|
|
@@ -102,7 +100,7 @@ class NonStreamTaskResponser(TaskResponseProcessor):
|
|
|
102
100
|
|
|
103
101
|
# Re-raise the same exception (not a new one) to ensure proper error propagation
|
|
104
102
|
logging.critical(f"NonStreamTask: Re-raising error to stop further processing: {str(e)}")
|
|
105
|
-
|
|
103
|
+
self.root_span.event(name="re_raising_error_to_stop_further_processing", level="CRITICAL",
|
|
106
104
|
status_message=(f"Re-raising error to stop further processing: {str(e)}"))
|
|
107
105
|
raise # Use bare 'raise' to preserve the original exception with its traceback
|
|
108
106
|
|