agstack 1.10.2__tar.gz → 1.11.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.11.0}/PKG-INFO +1 -1
- {agstack-1.10.2 → agstack-1.11.0}/agstack/llm/flow/agent.py +3 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack/llm/flow/registry.py +26 -2
- {agstack-1.10.2 → agstack-1.11.0}/agstack/llm/flow/tool.py +3 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack.egg-info/PKG-INFO +1 -1
- {agstack-1.10.2 → agstack-1.11.0}/pyproject.toml +1 -1
- {agstack-1.10.2 → agstack-1.11.0}/LICENSE +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/README.md +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack/__init__.py +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack/config/__init__.py +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack/config/logger.py +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack/config/manager.py +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack/config/types.py +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack/contexts.py +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack/decorators.py +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack/events.py +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack/exceptions.py +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack/fastapi/__init__.py +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack/fastapi/exception.py +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack/fastapi/middleware.py +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack/fastapi/offline.py +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack/fastapi/sse.py +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack/infra/db/__init__.py +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack/infra/es/__init__.py +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack/infra/kg/__init__.py +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack/infra/mq/__init__.py +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack/llm/__init__.py +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack/llm/client.py +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack/llm/flow/__init__.py +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack/llm/flow/context.py +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack/llm/flow/event.py +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack/llm/flow/exceptions.py +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack/llm/flow/factory.py +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack/llm/flow/flow.py +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack/llm/flow/loader.py +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack/llm/flow/nodes/__init__.py +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack/llm/flow/nodes/agent_node.py +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack/llm/flow/nodes/base.py +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack/llm/flow/nodes/detect_node.py +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack/llm/flow/nodes/llm_chat_node.py +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack/llm/flow/nodes/llm_embed_node.py +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack/llm/flow/nodes/llm_rerank_node.py +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack/llm/flow/nodes/python_node.py +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack/llm/flow/nodes/subflow_node.py +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack/llm/flow/nodes/switch_node.py +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack/llm/flow/nodes/tool_node.py +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack/llm/flow/records.py +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack/llm/flow/sandbox.py +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack/llm/flow/state.py +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack/llm/prompts.py +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack/llm/token.py +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack/schema.py +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack/security/__init__.py +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack/security/casbin.py +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack/security/crypt.py +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack/status.py +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack.egg-info/SOURCES.txt +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack.egg-info/dependency_links.txt +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack.egg-info/requires.txt +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/agstack.egg-info/top_level.txt +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/setup.cfg +0 -0
- {agstack-1.10.2 → agstack-1.11.0}/tests/test_flow_io.py +0 -0
- {agstack-1.10.2 → agstack-1.11.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.11.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,7 @@ class Agent:
|
|
|
30
30
|
temperature: float = 0.7,
|
|
31
31
|
max_tokens: int | None = None,
|
|
32
32
|
max_turns: int = 10,
|
|
33
|
+
display_name: str | None = None,
|
|
33
34
|
):
|
|
34
35
|
"""初始化 Agent
|
|
35
36
|
|
|
@@ -40,6 +41,7 @@ class Agent:
|
|
|
40
41
|
:param temperature: 温度参数
|
|
41
42
|
:param max_tokens: 最大 token 数
|
|
42
43
|
:param max_turns: 最大轮次
|
|
44
|
+
:param display_name: 面向用户的展示名称(用于前端脱敏展示)
|
|
43
45
|
"""
|
|
44
46
|
self.name = name
|
|
45
47
|
self.instructions = instructions or f"You are {name}, a helpful AI assistant."
|
|
@@ -48,6 +50,7 @@ class Agent:
|
|
|
48
50
|
self.temperature = temperature
|
|
49
51
|
self.max_tokens = max_tokens
|
|
50
52
|
self.max_turns = max_turns
|
|
53
|
+
self.display_name = display_name
|
|
51
54
|
|
|
52
55
|
def get_system_message(self) -> dict[str, Any]:
|
|
53
56
|
"""获取系统消息"""
|
|
@@ -19,6 +19,8 @@ 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_display_names: dict[str, str] = {}
|
|
23
|
+
self._agent_display_names: dict[str, str] = {}
|
|
22
24
|
|
|
23
25
|
def _ensure_builtins(self) -> None:
|
|
24
26
|
"""延迟加载内置 node handlers(避免循环导入)"""
|
|
@@ -32,13 +34,17 @@ class FlowRegistry:
|
|
|
32
34
|
|
|
33
35
|
# ── 注册 ──
|
|
34
36
|
|
|
35
|
-
def register_tool(self, name: str, tool_class) -> None:
|
|
37
|
+
def register_tool(self, name: str, tool_class, display_name: str | None = None) -> None:
|
|
36
38
|
"""注册工具工厂/类/实例"""
|
|
37
39
|
self._tools[name] = tool_class
|
|
40
|
+
if display_name is not None:
|
|
41
|
+
self._tool_display_names[name] = display_name
|
|
38
42
|
|
|
39
|
-
def register_agent(self, name: str, agent_class: type[Agent]) -> None:
|
|
43
|
+
def register_agent(self, name: str, agent_class: type[Agent], display_name: str | None = None) -> None:
|
|
40
44
|
"""注册 Agent 类型"""
|
|
41
45
|
self._agents[name] = agent_class
|
|
46
|
+
if display_name is not None:
|
|
47
|
+
self._agent_display_names[name] = display_name
|
|
42
48
|
|
|
43
49
|
def register_flow(self, name: str, flow_class: type) -> None:
|
|
44
50
|
"""注册 Flow 类型"""
|
|
@@ -87,6 +93,24 @@ class FlowRegistry:
|
|
|
87
93
|
|
|
88
94
|
# ── 查询 ──
|
|
89
95
|
|
|
96
|
+
def get_tool_display_name(self, name: str) -> str | None:
|
|
97
|
+
"""获取工具的展示名称(用于前端脱敏展示)"""
|
|
98
|
+
if name in self._tool_display_names:
|
|
99
|
+
return self._tool_display_names[name]
|
|
100
|
+
component = self._tools.get(name)
|
|
101
|
+
if component and hasattr(component, "display_name"):
|
|
102
|
+
return component.display_name
|
|
103
|
+
return None
|
|
104
|
+
|
|
105
|
+
def get_agent_display_name(self, name: str) -> str | None:
|
|
106
|
+
"""获取 Agent 的展示名称(用于前端脱敏展示)"""
|
|
107
|
+
if name in self._agent_display_names:
|
|
108
|
+
return self._agent_display_names[name]
|
|
109
|
+
component = self._agents.get(name)
|
|
110
|
+
if component and hasattr(component, "display_name"):
|
|
111
|
+
return getattr(component, "display_name", None)
|
|
112
|
+
return None
|
|
113
|
+
|
|
90
114
|
def get_tool_class(self, name: str) -> Any | None:
|
|
91
115
|
"""获取工具工厂/类"""
|
|
92
116
|
return self._tools.get(name)
|
|
@@ -33,6 +33,7 @@ class Tool:
|
|
|
33
33
|
description: str,
|
|
34
34
|
function: Callable,
|
|
35
35
|
parameters: dict[str, Any] | None = None,
|
|
36
|
+
display_name: str | None = None,
|
|
36
37
|
):
|
|
37
38
|
"""初始化工具
|
|
38
39
|
|
|
@@ -40,11 +41,13 @@ class Tool:
|
|
|
40
41
|
:param description: 工具描述
|
|
41
42
|
:param function: 工具函数,签名 fn(context, inputs) -> dict[str, Any]
|
|
42
43
|
:param parameters: JSON Schema 参数定义(用于 LLM 调用)
|
|
44
|
+
:param display_name: 面向用户的展示名称(用于前端脱敏展示)
|
|
43
45
|
"""
|
|
44
46
|
self.name = name
|
|
45
47
|
self.description = description
|
|
46
48
|
self.function = function
|
|
47
49
|
self.parameters = parameters or {"type": "object", "properties": {}, "required": []}
|
|
50
|
+
self.display_name = display_name
|
|
48
51
|
|
|
49
52
|
async def execute_async(self, context: "FlowContext", inputs: dict[str, Any] | None = None) -> ToolResult:
|
|
50
53
|
"""异步执行工具"""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: agstack
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.11.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
|