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.
Files changed (63) hide show
  1. {agstack-1.10.2 → agstack-1.12.0}/PKG-INFO +1 -1
  2. {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/flow/agent.py +7 -0
  3. {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/flow/registry.py +33 -3
  4. {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/flow/tool.py +7 -0
  5. {agstack-1.10.2 → agstack-1.12.0}/agstack.egg-info/PKG-INFO +1 -1
  6. {agstack-1.10.2 → agstack-1.12.0}/pyproject.toml +1 -1
  7. {agstack-1.10.2 → agstack-1.12.0}/LICENSE +0 -0
  8. {agstack-1.10.2 → agstack-1.12.0}/README.md +0 -0
  9. {agstack-1.10.2 → agstack-1.12.0}/agstack/__init__.py +0 -0
  10. {agstack-1.10.2 → agstack-1.12.0}/agstack/config/__init__.py +0 -0
  11. {agstack-1.10.2 → agstack-1.12.0}/agstack/config/logger.py +0 -0
  12. {agstack-1.10.2 → agstack-1.12.0}/agstack/config/manager.py +0 -0
  13. {agstack-1.10.2 → agstack-1.12.0}/agstack/config/types.py +0 -0
  14. {agstack-1.10.2 → agstack-1.12.0}/agstack/contexts.py +0 -0
  15. {agstack-1.10.2 → agstack-1.12.0}/agstack/decorators.py +0 -0
  16. {agstack-1.10.2 → agstack-1.12.0}/agstack/events.py +0 -0
  17. {agstack-1.10.2 → agstack-1.12.0}/agstack/exceptions.py +0 -0
  18. {agstack-1.10.2 → agstack-1.12.0}/agstack/fastapi/__init__.py +0 -0
  19. {agstack-1.10.2 → agstack-1.12.0}/agstack/fastapi/exception.py +0 -0
  20. {agstack-1.10.2 → agstack-1.12.0}/agstack/fastapi/middleware.py +0 -0
  21. {agstack-1.10.2 → agstack-1.12.0}/agstack/fastapi/offline.py +0 -0
  22. {agstack-1.10.2 → agstack-1.12.0}/agstack/fastapi/sse.py +0 -0
  23. {agstack-1.10.2 → agstack-1.12.0}/agstack/infra/db/__init__.py +0 -0
  24. {agstack-1.10.2 → agstack-1.12.0}/agstack/infra/es/__init__.py +0 -0
  25. {agstack-1.10.2 → agstack-1.12.0}/agstack/infra/kg/__init__.py +0 -0
  26. {agstack-1.10.2 → agstack-1.12.0}/agstack/infra/mq/__init__.py +0 -0
  27. {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/__init__.py +0 -0
  28. {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/client.py +0 -0
  29. {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/flow/__init__.py +0 -0
  30. {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/flow/context.py +0 -0
  31. {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/flow/event.py +0 -0
  32. {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/flow/exceptions.py +0 -0
  33. {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/flow/factory.py +0 -0
  34. {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/flow/flow.py +0 -0
  35. {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/flow/loader.py +0 -0
  36. {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/flow/nodes/__init__.py +0 -0
  37. {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/flow/nodes/agent_node.py +0 -0
  38. {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/flow/nodes/base.py +0 -0
  39. {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/flow/nodes/detect_node.py +0 -0
  40. {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/flow/nodes/llm_chat_node.py +0 -0
  41. {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/flow/nodes/llm_embed_node.py +0 -0
  42. {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/flow/nodes/llm_rerank_node.py +0 -0
  43. {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/flow/nodes/python_node.py +0 -0
  44. {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/flow/nodes/subflow_node.py +0 -0
  45. {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/flow/nodes/switch_node.py +0 -0
  46. {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/flow/nodes/tool_node.py +0 -0
  47. {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/flow/records.py +0 -0
  48. {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/flow/sandbox.py +0 -0
  49. {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/flow/state.py +0 -0
  50. {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/prompts.py +0 -0
  51. {agstack-1.10.2 → agstack-1.12.0}/agstack/llm/token.py +0 -0
  52. {agstack-1.10.2 → agstack-1.12.0}/agstack/schema.py +0 -0
  53. {agstack-1.10.2 → agstack-1.12.0}/agstack/security/__init__.py +0 -0
  54. {agstack-1.10.2 → agstack-1.12.0}/agstack/security/casbin.py +0 -0
  55. {agstack-1.10.2 → agstack-1.12.0}/agstack/security/crypt.py +0 -0
  56. {agstack-1.10.2 → agstack-1.12.0}/agstack/status.py +0 -0
  57. {agstack-1.10.2 → agstack-1.12.0}/agstack.egg-info/SOURCES.txt +0 -0
  58. {agstack-1.10.2 → agstack-1.12.0}/agstack.egg-info/dependency_links.txt +0 -0
  59. {agstack-1.10.2 → agstack-1.12.0}/agstack.egg-info/requires.txt +0 -0
  60. {agstack-1.10.2 → agstack-1.12.0}/agstack.egg-info/top_level.txt +0 -0
  61. {agstack-1.10.2 → agstack-1.12.0}/setup.cfg +0 -0
  62. {agstack-1.10.2 → agstack-1.12.0}/tests/test_flow_io.py +0 -0
  63. {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.10.2
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
- def register_agent(self, name: str, agent_class: type[Agent]) -> None:
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.10.2
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>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "agstack"
3
- version = "1.10.2"
3
+ version = "1.12.0"
4
4
  description = "Production-ready toolkit for building FastAPI and LLM applications"
5
5
  readme = "README.md"
6
6
  license = "MIT"
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