agstack 1.10.2__tar.gz → 1.12.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.
- {agstack-1.10.2 → agstack-1.12.0}/PKG-INFO +1 -1
- {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/flow/agent.py +7 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/flow/registry.py +33 -3
- {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/flow/tool.py +7 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack.egg-info/PKG-INFO +1 -1
- {agstack-1.10.2 → agstack-1.12.0}/pyproject.toml +1 -1
- {agstack-1.10.2 → agstack-1.12.0}/LICENSE +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/README.md +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack/__init__.py +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack/config/__init__.py +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack/config/logger.py +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack/config/manager.py +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack/config/types.py +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack/contexts.py +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack/decorators.py +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack/events.py +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack/exceptions.py +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack/fastapi/__init__.py +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack/fastapi/exception.py +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack/fastapi/middleware.py +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack/fastapi/offline.py +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack/fastapi/sse.py +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack/infra/db/__init__.py +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack/infra/es/__init__.py +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack/infra/kg/__init__.py +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack/infra/mq/__init__.py +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/__init__.py +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/client.py +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/flow/__init__.py +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/flow/context.py +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/flow/event.py +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/flow/exceptions.py +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/flow/factory.py +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/flow/flow.py +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/flow/loader.py +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/flow/nodes/__init__.py +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/flow/nodes/agent_node.py +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/flow/nodes/base.py +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/flow/nodes/detect_node.py +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/flow/nodes/llm_chat_node.py +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/flow/nodes/llm_embed_node.py +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/flow/nodes/llm_rerank_node.py +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/flow/nodes/python_node.py +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/flow/nodes/subflow_node.py +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/flow/nodes/switch_node.py +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/flow/nodes/tool_node.py +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/flow/records.py +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/flow/sandbox.py +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/flow/state.py +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/prompts.py +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/token.py +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack/schema.py +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack/security/__init__.py +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack/security/casbin.py +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack/security/crypt.py +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack/status.py +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack.egg-info/SOURCES.txt +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack.egg-info/dependency_links.txt +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack.egg-info/requires.txt +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/agstack.egg-info/top_level.txt +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/setup.cfg +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/tests/test_flow_io.py +0 -0
- {agstack-1.10.2 → agstack-1.12.0}/tests/test_flow_switch_subflow.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: agstack
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.12.0
|
|
4
4
|
Summary: Production-ready toolkit for building FastAPI and LLM applications
|
|
5
5
|
Author-email: XtraVisions <gitadmin@xtravisions.com>, Chen Hao <chenhao@xtravisions.com>
|
|
6
6
|
Maintainer-email: XtraVisions <gitadmin@xtravisions.com>, Chen Hao <chenhao@xtravisions.com>
|
|
@@ -30,6 +30,9 @@ class Agent:
|
|
|
30
30
|
temperature: float = 0.7,
|
|
31
31
|
max_tokens: int | None = None,
|
|
32
32
|
max_turns: int = 10,
|
|
33
|
+
*,
|
|
34
|
+
label: str | None = None,
|
|
35
|
+
echo: bool = False,
|
|
33
36
|
):
|
|
34
37
|
"""初始化 Agent
|
|
35
38
|
|
|
@@ -40,6 +43,8 @@ class Agent:
|
|
|
40
43
|
:param temperature: 温度参数
|
|
41
44
|
:param max_tokens: 最大 token 数
|
|
42
45
|
:param max_turns: 最大轮次
|
|
46
|
+
:param label: 面向用户的展示名称(控制 STEP 进度事件可见性)
|
|
47
|
+
:param echo: 是否转发 TEXT_MESSAGE 给用户
|
|
43
48
|
"""
|
|
44
49
|
self.name = name
|
|
45
50
|
self.instructions = instructions or f"You are {name}, a helpful AI assistant."
|
|
@@ -48,6 +53,8 @@ class Agent:
|
|
|
48
53
|
self.temperature = temperature
|
|
49
54
|
self.max_tokens = max_tokens
|
|
50
55
|
self.max_turns = max_turns
|
|
56
|
+
self.label = label
|
|
57
|
+
self.echo = echo
|
|
51
58
|
|
|
52
59
|
def get_system_message(self) -> dict[str, Any]:
|
|
53
60
|
"""获取系统消息"""
|
|
@@ -19,6 +19,10 @@ class FlowRegistry:
|
|
|
19
19
|
self._flows: dict[str, Any] = {}
|
|
20
20
|
self._node_handlers: dict[str, Any] = {}
|
|
21
21
|
self._builtins_loaded = False
|
|
22
|
+
self._tool_labels: dict[str, str] = {}
|
|
23
|
+
self._tool_echo: dict[str, bool] = {}
|
|
24
|
+
self._agent_labels: dict[str, str] = {}
|
|
25
|
+
self._agent_echo: dict[str, bool] = {}
|
|
22
26
|
|
|
23
27
|
def _ensure_builtins(self) -> None:
|
|
24
28
|
"""延迟加载内置 node handlers(避免循环导入)"""
|
|
@@ -32,13 +36,23 @@ class FlowRegistry:
|
|
|
32
36
|
|
|
33
37
|
# ── 注册 ──
|
|
34
38
|
|
|
35
|
-
def register_tool(self, name: str, tool_class) -> None:
|
|
39
|
+
def register_tool(self, name: str, tool_class, *, label: str | None = None, echo: bool = False) -> None:
|
|
36
40
|
"""注册工具工厂/类/实例"""
|
|
37
41
|
self._tools[name] = tool_class
|
|
38
|
-
|
|
39
|
-
|
|
42
|
+
if label is not None:
|
|
43
|
+
self._tool_labels[name] = label
|
|
44
|
+
if echo:
|
|
45
|
+
self._tool_echo[name] = True
|
|
46
|
+
|
|
47
|
+
def register_agent(
|
|
48
|
+
self, name: str, agent_class: type[Agent], *, label: str | None = None, echo: bool = False
|
|
49
|
+
) -> None:
|
|
40
50
|
"""注册 Agent 类型"""
|
|
41
51
|
self._agents[name] = agent_class
|
|
52
|
+
if label is not None:
|
|
53
|
+
self._agent_labels[name] = label
|
|
54
|
+
if echo:
|
|
55
|
+
self._agent_echo[name] = True
|
|
42
56
|
|
|
43
57
|
def register_flow(self, name: str, flow_class: type) -> None:
|
|
44
58
|
"""注册 Flow 类型"""
|
|
@@ -87,6 +101,22 @@ class FlowRegistry:
|
|
|
87
101
|
|
|
88
102
|
# ── 查询 ──
|
|
89
103
|
|
|
104
|
+
def get_tool_label(self, name: str) -> str | None:
|
|
105
|
+
"""获取工具的展示名称"""
|
|
106
|
+
return self._tool_labels.get(name)
|
|
107
|
+
|
|
108
|
+
def get_tool_echo(self, name: str) -> bool:
|
|
109
|
+
"""获取工具是否转发 TEXT_MESSAGE(label 隐含 echo)"""
|
|
110
|
+
return name in self._tool_labels or self._tool_echo.get(name, False)
|
|
111
|
+
|
|
112
|
+
def get_agent_label(self, name: str) -> str | None:
|
|
113
|
+
"""获取 Agent 的展示名称"""
|
|
114
|
+
return self._agent_labels.get(name)
|
|
115
|
+
|
|
116
|
+
def get_agent_echo(self, name: str) -> bool:
|
|
117
|
+
"""获取 Agent 是否转发 TEXT_MESSAGE(label 隐含 echo)"""
|
|
118
|
+
return name in self._agent_labels or self._agent_echo.get(name, False)
|
|
119
|
+
|
|
90
120
|
def get_tool_class(self, name: str) -> Any | None:
|
|
91
121
|
"""获取工具工厂/类"""
|
|
92
122
|
return self._tools.get(name)
|
|
@@ -33,6 +33,9 @@ class Tool:
|
|
|
33
33
|
description: str,
|
|
34
34
|
function: Callable,
|
|
35
35
|
parameters: dict[str, Any] | None = None,
|
|
36
|
+
*,
|
|
37
|
+
label: str | None = None,
|
|
38
|
+
echo: bool = False,
|
|
36
39
|
):
|
|
37
40
|
"""初始化工具
|
|
38
41
|
|
|
@@ -40,11 +43,15 @@ class Tool:
|
|
|
40
43
|
:param description: 工具描述
|
|
41
44
|
:param function: 工具函数,签名 fn(context, inputs) -> dict[str, Any]
|
|
42
45
|
:param parameters: JSON Schema 参数定义(用于 LLM 调用)
|
|
46
|
+
:param label: 面向用户的展示名称(控制 STEP/TOOL_CALL 进度事件可见性)
|
|
47
|
+
:param echo: 是否转发 TEXT_MESSAGE 给用户
|
|
43
48
|
"""
|
|
44
49
|
self.name = name
|
|
45
50
|
self.description = description
|
|
46
51
|
self.function = function
|
|
47
52
|
self.parameters = parameters or {"type": "object", "properties": {}, "required": []}
|
|
53
|
+
self.label = label
|
|
54
|
+
self.echo = echo
|
|
48
55
|
|
|
49
56
|
async def execute_async(self, context: "FlowContext", inputs: dict[str, Any] | None = None) -> ToolResult:
|
|
50
57
|
"""异步执行工具"""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: agstack
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.12.0
|
|
4
4
|
Summary: Production-ready toolkit for building FastAPI and LLM applications
|
|
5
5
|
Author-email: XtraVisions <gitadmin@xtravisions.com>, Chen Hao <chenhao@xtravisions.com>
|
|
6
6
|
Maintainer-email: XtraVisions <gitadmin@xtravisions.com>, Chen Hao <chenhao@xtravisions.com>
|
|
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
|
|
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
|
|
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
|