acps-math-multisolver 1.0.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 (30) hide show
  1. acps_math_multisolver-1.0.0/PKG-INFO +187 -0
  2. acps_math_multisolver-1.0.0/README.md +154 -0
  3. acps_math_multisolver-1.0.0/pyproject.toml +73 -0
  4. acps_math_multisolver-1.0.0/setup.cfg +4 -0
  5. acps_math_multisolver-1.0.0/src/acps_math_multisolver.egg-info/PKG-INFO +187 -0
  6. acps_math_multisolver-1.0.0/src/acps_math_multisolver.egg-info/SOURCES.txt +28 -0
  7. acps_math_multisolver-1.0.0/src/acps_math_multisolver.egg-info/dependency_links.txt +1 -0
  8. acps_math_multisolver-1.0.0/src/acps_math_multisolver.egg-info/entry_points.txt +2 -0
  9. acps_math_multisolver-1.0.0/src/acps_math_multisolver.egg-info/requires.txt +10 -0
  10. acps_math_multisolver-1.0.0/src/acps_math_multisolver.egg-info/top_level.txt +1 -0
  11. acps_math_multisolver-1.0.0/src/math_multisolver/__init__.py +6 -0
  12. acps_math_multisolver-1.0.0/src/math_multisolver/__main__.py +6 -0
  13. acps_math_multisolver-1.0.0/src/math_multisolver/agents/__init__.py +8 -0
  14. acps_math_multisolver-1.0.0/src/math_multisolver/agents/algebra.py +40 -0
  15. acps_math_multisolver-1.0.0/src/math_multisolver/agents/base.py +118 -0
  16. acps_math_multisolver-1.0.0/src/math_multisolver/agents/geometry.py +40 -0
  17. acps_math_multisolver-1.0.0/src/math_multisolver/agents/socratic.py +40 -0
  18. acps_math_multisolver-1.0.0/src/math_multisolver/cli.py +52 -0
  19. acps_math_multisolver-1.0.0/src/math_multisolver/demo.py +98 -0
  20. acps_math_multisolver-1.0.0/src/math_multisolver/engine/__init__.py +17 -0
  21. acps_math_multisolver-1.0.0/src/math_multisolver/engine/quadratic.py +169 -0
  22. acps_math_multisolver-1.0.0/src/math_multisolver/identity.py +79 -0
  23. acps_math_multisolver-1.0.0/src/math_multisolver/mesh.py +61 -0
  24. acps_math_multisolver-1.0.0/src/math_multisolver/models.py +103 -0
  25. acps_math_multisolver-1.0.0/src/math_multisolver/orchestrator.py +205 -0
  26. acps_math_multisolver-1.0.0/src/math_multisolver/py.typed +0 -0
  27. acps_math_multisolver-1.0.0/src/math_multisolver/registry.py +85 -0
  28. acps_math_multisolver-1.0.0/src/math_multisolver/report.py +90 -0
  29. acps_math_multisolver-1.0.0/src/math_multisolver/runtime.py +229 -0
  30. acps_math_multisolver-1.0.0/tests/test_workflow.py +127 -0
@@ -0,0 +1,187 @@
1
+ Metadata-Version: 2.4
2
+ Name: acps-math-multisolver
3
+ Version: 1.0.0
4
+ Summary: An acps-sdk 2.1.0 multi-agent workspace for exploring one mathematics problem through complementary paths. Algebra and Geometry agents solve in parallel; a Socratic agent turns both traces into progressive questions rather than premature answers. For Zhongkao/Gaokao finale problems, olympiad exploration and university proof seminars, it builds divergent thinking and auditable solution comparison. Includes a deterministic quadratic-function capstone and a local ACP mesh requiring no LLM API key.
5
+ Author: ACPs Math MultiSolver Engineering
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://pypi.org/project/acps-math-multisolver/
8
+ Keywords: acps-sdk,multi-agent,mathematics,multiple-solutions,socratic-tutoring,divergent-thinking,exam-preparation
9
+ Classifier: Development Status :: 5 - Production/Stable
10
+ Classifier: Intended Audience :: Education
11
+ Classifier: Intended Audience :: Science/Research
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3 :: Only
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Education
20
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
21
+ Classifier: Typing :: Typed
22
+ Requires-Python: >=3.10
23
+ Description-Content-Type: text/markdown
24
+ Requires-Dist: acps-sdk==2.1.0
25
+ Requires-Dist: fastapi>=0.100.0
26
+ Requires-Dist: pydantic>=2.0.0
27
+ Requires-Dist: uvicorn>=0.27.0
28
+ Provides-Extra: dev
29
+ Requires-Dist: build>=1.0.0; extra == "dev"
30
+ Requires-Dist: pytest>=8.0.0; extra == "dev"
31
+ Requires-Dist: ruff>=0.6.0; extra == "dev"
32
+ Requires-Dist: twine>=5.0.0; extra == "dev"
33
+
34
+ # acps-math-multisolver
35
+
36
+ **数学一题多解启发多智能体协作工具**:基于 `acps-sdk 2.1.0`,让 Algebra Agent 与 Geometry Agent 并行构造独立解法,再由 Socratic Agent 读取双路径产物,生成“共同表征 → 分岔探索 → 双路径贯通”的连续追问。每次求解都保留 ADP 发现、AIP 任务和结构化产物记录。
37
+
38
+ ## 命名与定位
39
+
40
+ **MultiSolver = Multiple + Solver**:不是把同一提示词复制给多个模型,而是用不同数学表征解决同一问题。`acps-` 表示任务分发、能力发现与通信均基于 ACPs SDK;`math` 表明面向数学学习。
41
+
42
+ 面向中高考压轴题、竞赛题研讨与大学证明题课堂,它把“看懂标准答案”改造成“比较多种路径、解释路径为何等价、在追问中自己重建关键一步”。苏格拉底导师只给问题与按需支架,不在问题链中直接报最终答案。
43
+
44
+ ## 协作机制
45
+
46
+ ```text
47
+ ┌─ AIP task → Algebra Agent ─┐
48
+ Leader → ADP 能力发现 ───┤ ├─ typed products → Socratic Agent
49
+ └─ AIP task → Geometry Agent ┘ │
50
+ └─ 七轮问题链 → Leader fan-in
51
+ ```
52
+
53
+ 1. 三个 Agent 各自运行在独立的 loopback FastAPI/AIP v2 JSON-RPC 服务中,拥有合法 AIC 与 ACS 能力描述。
54
+ 2. Leader 通过 `DiscoveryRequest` 和 `skills.tags` 过滤发现端点,使用 `AipRpcClient.start_task()` 并行派发给代数与几何 Agent。
55
+ 3. 两个 `StructuredDataItem` 解法产品经 Pydantic 校验后,一起进入 Socratic Agent;结论不一致时导师拒绝生成启发,避免把错误路径教给学生。
56
+ 4. 最终报告包含双解、启发记录、task ID、完成状态、耗时和在线 Agent,可审计而非单体函数伪装协作。
57
+
58
+ ## 安装与一键演示
59
+
60
+ 要求 Python 3.10+。在 PowerShell 中:
61
+
62
+ ```powershell
63
+ cd acps-math-multisolver
64
+ python -m venv .venv
65
+ .\.venv\Scripts\python -m pip install -e ".[dev]"
66
+ .\.venv\Scripts\python run_demo.py
67
+ ```
68
+
69
+ 也可使用安装产生的命令:
70
+
71
+ ```powershell
72
+ math-multisolver demo
73
+ math-multisolver demo --json # 完整 typed product,便于接入学习系统
74
+ math-multisolver tutor # 真人逐轮作答;:hint 支架,:quit 退出
75
+ math-multisolver --version # 1.0.0
76
+ ```
77
+
78
+ `run_demo.py` 自动模拟一名学生的七轮回答,但底层三个 Agent、ADP 发现、AIP 请求和结果回传均真实执行;无需 LLM API Key,也不需要外部服务。
79
+
80
+ ### 自定义输入
81
+
82
+ ```powershell
83
+ math-multisolver solve --problem "已知抛物线 y = -x² + 2x + 3 与 x 轴交于 A、B 两点(A 在 B 左侧),与 y 轴交于点 C。点 P 是抛物线弧 BC 上一动点(不与 B、C 重合)。(1) 求 A、B、C 的坐标;(2) 求 △PBC 面积的最大值及此时 P 的坐标。"
84
+ ```
85
+
86
+ v1.0.0 内置经过验证的二次函数动点面积策略,用于可复现演示与协议集成;它不是伪装成通用数学 AI 的提示词包装器。未注册题型会明确报错,不会编造答案。新增题型时可扩展 `engine`,复用现有 ACP 编排与 typed contracts。
87
+
88
+ ## 演示题与预期输出摘要
89
+
90
+ 输入题:抛物线 `y=-x²+2x+3` 与 x 轴交于 A、B,与 y 轴交于 C;P 在弧 BC 上运动,求三个定点坐标以及 `△PBC` 面积最大值和对应 P。
91
+
92
+ ```text
93
+ [acps-math-multisolver] 正在启动二次函数压轴题多解演示 ...
94
+ [acps-math-multisolver] 在线 Agent:Algebra Agent、Geometry Agent、Socratic Agent
95
+ ========================================================================================
96
+ ACPs Math MultiSolver v1.0.0 | session=multisolve-...
97
+ SDK=acps-sdk 2.1.0 | 端到端耗时 ... ms | report=report-...
98
+ ========================================================================================
99
+ [1/4] Algebra Agent · 代数路径:面积函数与配方
100
+ 核心洞察:以动点横坐标为单变量,把面积转化为区间上的二次函数最值。
101
+ 1. ... A(−1,0)、B(3,0);... C(0,3)。
102
+ 2. 设 P(t,−t²+2t+3),其中 0<t<3。直线 BC 为 x+y−3=0。
103
+ 4. S(t)=...=−3/2(t−3/2)²+27/8。
104
+ 结论:最大面积为 27/8,此时 P(3/2,15/4)。
105
+
106
+ [2/4] Geometry Agent · 几何路径:平行线平移与相切
107
+ 核心洞察:固定底边后,面积最大等价于高最大;最远平行线的临界状态是相切。
108
+ 3. 作 l∥BC,设 l:x+y=k。... 临界位置是与抛物线相切,切点即所求 P。
109
+ 4. ... 相切要求 Δ=...=21−4k=0,故 k=21/4。
110
+ 结论:最大面积为 27/8,此时 P(3/2,15/4)。
111
+
112
+ [3/4] Socratic Agent · 连续追问启发
113
+ 导师 1:在 P 移动时,BC 的长度会改变吗?若把 BC 作为底,真正变化的量是什么?
114
+ 学生 1:BC 的长度不变;面积变化来自 P 到 BC 的高。
115
+ 导师 5:如果作一条与 BC 平行的直线并向抛物线外侧平移,何时达到‘仍有公共点’的最后位置?
116
+ 学生 5:平行线向外平移,即将离开抛物线时的临界位置是相切。
117
+ 导师 7:代数面积函数的顶点与几何路径的切点重合,是巧合吗?它们共同刻画了什么事实?
118
+ 学生 7:不是巧合;... 都在刻画同一个‘到 BC 的距离最大’。
119
+
120
+ [4/4] AIP v2 协作审计
121
+ Algebra Agent | algebra-solution | completed | ... ms | task=task-...
122
+ Geometry Agent | geometry-solution | completed | ... ms | task=task-...
123
+ Socratic Agent | socratic-guidance | completed | ... ms | task=task-...
124
+ 调度拓扑:(Algebra Agent ∥ Geometry Agent) → Socratic Agent → Leader
125
+ ```
126
+
127
+ ## 测试
128
+
129
+ ```powershell
130
+ .\.venv\Scripts\python -m pytest
131
+ .\.venv\Scripts\python -m ruff check .
132
+ ```
133
+
134
+ 测试覆盖数学结果、区间条件、七轮启发不泄露最终答案、双路径一致性保护、不支持题型的失败行为,以及三个真实 AIP 任务的端到端往返。
135
+
136
+ ## 构建 wheel 与上传 PyPI
137
+
138
+ ```powershell
139
+ # 在开发虚拟环境中执行;构建 wheel 与 sdist 到 dist/
140
+ .\.venv\Scripts\python -m build
141
+
142
+ # 检查 METADATA、README 渲染与包描述
143
+ .\.venv\Scripts\python -m twine check dist/*
144
+
145
+ # 可选:先上传 TestPyPI 验证发布流程;密码提示中粘贴 TestPyPI API Token
146
+ .\.venv\Scripts\python -m twine upload --repository testpypi -u __token__ dist/*
147
+
148
+ # 正式发布;密码提示中粘贴 PyPI API Token
149
+ .\.venv\Scripts\python -m twine upload -u __token__ dist/*
150
+ ```
151
+
152
+ 不要把 API Token 写入代码、README 或命令历史。PyPI 不允许覆盖同版本文件;再次发布前必须提升 `pyproject.toml` 与 `identity.py` 中的版本号。上传是显式发布操作,本地构建和校验不会自动上传。
153
+
154
+ ## 项目结构
155
+
156
+ ```text
157
+ acps-math-multisolver/
158
+ ├── pyproject.toml # 1.0.0、acps-sdk==2.1.0、CLI、构建与质量工具
159
+ ├── README.md # 安装、交互、演示、测试和 PyPI 发布说明
160
+ ├── run_demo.py # 源码目录一键演示
161
+ ├── src/math_multisolver/
162
+ │ ├── __init__.py # 公共 API 与 __version__
163
+ │ ├── __main__.py # python -m math_multisolver
164
+ │ ├── cli.py # demo / solve / tutor
165
+ │ ├── models.py # AIP typed request/product/report
166
+ │ ├── identity.py # AIC、ACS 与项目版本
167
+ │ ├── registry.py # 基于 ADP 模型的能力注册与过滤发现
168
+ │ ├── runtime.py # AIP v2 服务、任务生命周期与产品编解码
169
+ │ ├── mesh.py # 三个独立 Agent 服务生命周期
170
+ │ ├── orchestrator.py # ADP 发现、并行 AIP 分发与 fan-in
171
+ │ ├── demo.py # 模拟对话、真人 tutor 与一键演示
172
+ │ ├── report.py # 双解、启发记录与审计渲染
173
+ │ ├── py.typed # PEP 561 类型标记
174
+ │ ├── agents/
175
+ │ │ ├── base.py # AIP handler 基类
176
+ │ │ ├── algebra.py # Algebra Agent
177
+ │ │ ├── geometry.py # Geometry Agent
178
+ │ │ └── socratic.py # Socratic Agent
179
+ │ └── engine/
180
+ │ ├── quadratic.py # 已验证双解与苏格拉底问题链
181
+ │ └── __init__.py
182
+ └── tests/test_workflow.py # 单元与真实 AIP 集成测试
183
+ ```
184
+
185
+ ## License
186
+
187
+ MIT
@@ -0,0 +1,154 @@
1
+ # acps-math-multisolver
2
+
3
+ **数学一题多解启发多智能体协作工具**:基于 `acps-sdk 2.1.0`,让 Algebra Agent 与 Geometry Agent 并行构造独立解法,再由 Socratic Agent 读取双路径产物,生成“共同表征 → 分岔探索 → 双路径贯通”的连续追问。每次求解都保留 ADP 发现、AIP 任务和结构化产物记录。
4
+
5
+ ## 命名与定位
6
+
7
+ **MultiSolver = Multiple + Solver**:不是把同一提示词复制给多个模型,而是用不同数学表征解决同一问题。`acps-` 表示任务分发、能力发现与通信均基于 ACPs SDK;`math` 表明面向数学学习。
8
+
9
+ 面向中高考压轴题、竞赛题研讨与大学证明题课堂,它把“看懂标准答案”改造成“比较多种路径、解释路径为何等价、在追问中自己重建关键一步”。苏格拉底导师只给问题与按需支架,不在问题链中直接报最终答案。
10
+
11
+ ## 协作机制
12
+
13
+ ```text
14
+ ┌─ AIP task → Algebra Agent ─┐
15
+ Leader → ADP 能力发现 ───┤ ├─ typed products → Socratic Agent
16
+ └─ AIP task → Geometry Agent ┘ │
17
+ └─ 七轮问题链 → Leader fan-in
18
+ ```
19
+
20
+ 1. 三个 Agent 各自运行在独立的 loopback FastAPI/AIP v2 JSON-RPC 服务中,拥有合法 AIC 与 ACS 能力描述。
21
+ 2. Leader 通过 `DiscoveryRequest` 和 `skills.tags` 过滤发现端点,使用 `AipRpcClient.start_task()` 并行派发给代数与几何 Agent。
22
+ 3. 两个 `StructuredDataItem` 解法产品经 Pydantic 校验后,一起进入 Socratic Agent;结论不一致时导师拒绝生成启发,避免把错误路径教给学生。
23
+ 4. 最终报告包含双解、启发记录、task ID、完成状态、耗时和在线 Agent,可审计而非单体函数伪装协作。
24
+
25
+ ## 安装与一键演示
26
+
27
+ 要求 Python 3.10+。在 PowerShell 中:
28
+
29
+ ```powershell
30
+ cd acps-math-multisolver
31
+ python -m venv .venv
32
+ .\.venv\Scripts\python -m pip install -e ".[dev]"
33
+ .\.venv\Scripts\python run_demo.py
34
+ ```
35
+
36
+ 也可使用安装产生的命令:
37
+
38
+ ```powershell
39
+ math-multisolver demo
40
+ math-multisolver demo --json # 完整 typed product,便于接入学习系统
41
+ math-multisolver tutor # 真人逐轮作答;:hint 支架,:quit 退出
42
+ math-multisolver --version # 1.0.0
43
+ ```
44
+
45
+ `run_demo.py` 自动模拟一名学生的七轮回答,但底层三个 Agent、ADP 发现、AIP 请求和结果回传均真实执行;无需 LLM API Key,也不需要外部服务。
46
+
47
+ ### 自定义输入
48
+
49
+ ```powershell
50
+ math-multisolver solve --problem "已知抛物线 y = -x² + 2x + 3 与 x 轴交于 A、B 两点(A 在 B 左侧),与 y 轴交于点 C。点 P 是抛物线弧 BC 上一动点(不与 B、C 重合)。(1) 求 A、B、C 的坐标;(2) 求 △PBC 面积的最大值及此时 P 的坐标。"
51
+ ```
52
+
53
+ v1.0.0 内置经过验证的二次函数动点面积策略,用于可复现演示与协议集成;它不是伪装成通用数学 AI 的提示词包装器。未注册题型会明确报错,不会编造答案。新增题型时可扩展 `engine`,复用现有 ACP 编排与 typed contracts。
54
+
55
+ ## 演示题与预期输出摘要
56
+
57
+ 输入题:抛物线 `y=-x²+2x+3` 与 x 轴交于 A、B,与 y 轴交于 C;P 在弧 BC 上运动,求三个定点坐标以及 `△PBC` 面积最大值和对应 P。
58
+
59
+ ```text
60
+ [acps-math-multisolver] 正在启动二次函数压轴题多解演示 ...
61
+ [acps-math-multisolver] 在线 Agent:Algebra Agent、Geometry Agent、Socratic Agent
62
+ ========================================================================================
63
+ ACPs Math MultiSolver v1.0.0 | session=multisolve-...
64
+ SDK=acps-sdk 2.1.0 | 端到端耗时 ... ms | report=report-...
65
+ ========================================================================================
66
+ [1/4] Algebra Agent · 代数路径:面积函数与配方
67
+ 核心洞察:以动点横坐标为单变量,把面积转化为区间上的二次函数最值。
68
+ 1. ... A(−1,0)、B(3,0);... C(0,3)。
69
+ 2. 设 P(t,−t²+2t+3),其中 0<t<3。直线 BC 为 x+y−3=0。
70
+ 4. S(t)=...=−3/2(t−3/2)²+27/8。
71
+ 结论:最大面积为 27/8,此时 P(3/2,15/4)。
72
+
73
+ [2/4] Geometry Agent · 几何路径:平行线平移与相切
74
+ 核心洞察:固定底边后,面积最大等价于高最大;最远平行线的临界状态是相切。
75
+ 3. 作 l∥BC,设 l:x+y=k。... 临界位置是与抛物线相切,切点即所求 P。
76
+ 4. ... 相切要求 Δ=...=21−4k=0,故 k=21/4。
77
+ 结论:最大面积为 27/8,此时 P(3/2,15/4)。
78
+
79
+ [3/4] Socratic Agent · 连续追问启发
80
+ 导师 1:在 P 移动时,BC 的长度会改变吗?若把 BC 作为底,真正变化的量是什么?
81
+ 学生 1:BC 的长度不变;面积变化来自 P 到 BC 的高。
82
+ 导师 5:如果作一条与 BC 平行的直线并向抛物线外侧平移,何时达到‘仍有公共点’的最后位置?
83
+ 学生 5:平行线向外平移,即将离开抛物线时的临界位置是相切。
84
+ 导师 7:代数面积函数的顶点与几何路径的切点重合,是巧合吗?它们共同刻画了什么事实?
85
+ 学生 7:不是巧合;... 都在刻画同一个‘到 BC 的距离最大’。
86
+
87
+ [4/4] AIP v2 协作审计
88
+ Algebra Agent | algebra-solution | completed | ... ms | task=task-...
89
+ Geometry Agent | geometry-solution | completed | ... ms | task=task-...
90
+ Socratic Agent | socratic-guidance | completed | ... ms | task=task-...
91
+ 调度拓扑:(Algebra Agent ∥ Geometry Agent) → Socratic Agent → Leader
92
+ ```
93
+
94
+ ## 测试
95
+
96
+ ```powershell
97
+ .\.venv\Scripts\python -m pytest
98
+ .\.venv\Scripts\python -m ruff check .
99
+ ```
100
+
101
+ 测试覆盖数学结果、区间条件、七轮启发不泄露最终答案、双路径一致性保护、不支持题型的失败行为,以及三个真实 AIP 任务的端到端往返。
102
+
103
+ ## 构建 wheel 与上传 PyPI
104
+
105
+ ```powershell
106
+ # 在开发虚拟环境中执行;构建 wheel 与 sdist 到 dist/
107
+ .\.venv\Scripts\python -m build
108
+
109
+ # 检查 METADATA、README 渲染与包描述
110
+ .\.venv\Scripts\python -m twine check dist/*
111
+
112
+ # 可选:先上传 TestPyPI 验证发布流程;密码提示中粘贴 TestPyPI API Token
113
+ .\.venv\Scripts\python -m twine upload --repository testpypi -u __token__ dist/*
114
+
115
+ # 正式发布;密码提示中粘贴 PyPI API Token
116
+ .\.venv\Scripts\python -m twine upload -u __token__ dist/*
117
+ ```
118
+
119
+ 不要把 API Token 写入代码、README 或命令历史。PyPI 不允许覆盖同版本文件;再次发布前必须提升 `pyproject.toml` 与 `identity.py` 中的版本号。上传是显式发布操作,本地构建和校验不会自动上传。
120
+
121
+ ## 项目结构
122
+
123
+ ```text
124
+ acps-math-multisolver/
125
+ ├── pyproject.toml # 1.0.0、acps-sdk==2.1.0、CLI、构建与质量工具
126
+ ├── README.md # 安装、交互、演示、测试和 PyPI 发布说明
127
+ ├── run_demo.py # 源码目录一键演示
128
+ ├── src/math_multisolver/
129
+ │ ├── __init__.py # 公共 API 与 __version__
130
+ │ ├── __main__.py # python -m math_multisolver
131
+ │ ├── cli.py # demo / solve / tutor
132
+ │ ├── models.py # AIP typed request/product/report
133
+ │ ├── identity.py # AIC、ACS 与项目版本
134
+ │ ├── registry.py # 基于 ADP 模型的能力注册与过滤发现
135
+ │ ├── runtime.py # AIP v2 服务、任务生命周期与产品编解码
136
+ │ ├── mesh.py # 三个独立 Agent 服务生命周期
137
+ │ ├── orchestrator.py # ADP 发现、并行 AIP 分发与 fan-in
138
+ │ ├── demo.py # 模拟对话、真人 tutor 与一键演示
139
+ │ ├── report.py # 双解、启发记录与审计渲染
140
+ │ ├── py.typed # PEP 561 类型标记
141
+ │ ├── agents/
142
+ │ │ ├── base.py # AIP handler 基类
143
+ │ │ ├── algebra.py # Algebra Agent
144
+ │ │ ├── geometry.py # Geometry Agent
145
+ │ │ └── socratic.py # Socratic Agent
146
+ │ └── engine/
147
+ │ ├── quadratic.py # 已验证双解与苏格拉底问题链
148
+ │ └── __init__.py
149
+ └── tests/test_workflow.py # 单元与真实 AIP 集成测试
150
+ ```
151
+
152
+ ## License
153
+
154
+ MIT
@@ -0,0 +1,73 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77.0.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "acps-math-multisolver"
7
+ version = "1.0.0"
8
+ description = "An acps-sdk 2.1.0 multi-agent workspace for exploring one mathematics problem through complementary paths. Algebra and Geometry agents solve in parallel; a Socratic agent turns both traces into progressive questions rather than premature answers. For Zhongkao/Gaokao finale problems, olympiad exploration and university proof seminars, it builds divergent thinking and auditable solution comparison. Includes a deterministic quadratic-function capstone and a local ACP mesh requiring no LLM API key."
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = "MIT"
12
+ authors = [{ name = "ACPs Math MultiSolver Engineering" }]
13
+ keywords = [
14
+ "acps-sdk",
15
+ "multi-agent",
16
+ "mathematics",
17
+ "multiple-solutions",
18
+ "socratic-tutoring",
19
+ "divergent-thinking",
20
+ "exam-preparation",
21
+ ]
22
+ classifiers = [
23
+ "Development Status :: 5 - Production/Stable",
24
+ "Intended Audience :: Education",
25
+ "Intended Audience :: Science/Research",
26
+ "Operating System :: OS Independent",
27
+ "Programming Language :: Python :: 3",
28
+ "Programming Language :: Python :: 3 :: Only",
29
+ "Programming Language :: Python :: 3.10",
30
+ "Programming Language :: Python :: 3.11",
31
+ "Programming Language :: Python :: 3.12",
32
+ "Programming Language :: Python :: 3.13",
33
+ "Topic :: Education",
34
+ "Topic :: Scientific/Engineering :: Mathematics",
35
+ "Typing :: Typed",
36
+ ]
37
+ dependencies = [
38
+ "acps-sdk==2.1.0",
39
+ "fastapi>=0.100.0",
40
+ "pydantic>=2.0.0",
41
+ "uvicorn>=0.27.0",
42
+ ]
43
+
44
+ [project.optional-dependencies]
45
+ dev = [
46
+ "build>=1.0.0",
47
+ "pytest>=8.0.0",
48
+ "ruff>=0.6.0",
49
+ "twine>=5.0.0",
50
+ ]
51
+
52
+ [project.scripts]
53
+ math-multisolver = "math_multisolver.cli:main"
54
+
55
+ [project.urls]
56
+ Homepage = "https://pypi.org/project/acps-math-multisolver/"
57
+
58
+ [tool.setuptools.packages.find]
59
+ where = ["src"]
60
+
61
+ [tool.setuptools.package-data]
62
+ math_multisolver = ["py.typed"]
63
+
64
+ [tool.pytest.ini_options]
65
+ testpaths = ["tests"]
66
+ pythonpath = ["src"]
67
+ addopts = "-q"
68
+
69
+ [tool.ruff]
70
+ line-length = 100
71
+
72
+ [tool.ruff.lint]
73
+ select = ["E", "F", "I", "UP", "B"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,187 @@
1
+ Metadata-Version: 2.4
2
+ Name: acps-math-multisolver
3
+ Version: 1.0.0
4
+ Summary: An acps-sdk 2.1.0 multi-agent workspace for exploring one mathematics problem through complementary paths. Algebra and Geometry agents solve in parallel; a Socratic agent turns both traces into progressive questions rather than premature answers. For Zhongkao/Gaokao finale problems, olympiad exploration and university proof seminars, it builds divergent thinking and auditable solution comparison. Includes a deterministic quadratic-function capstone and a local ACP mesh requiring no LLM API key.
5
+ Author: ACPs Math MultiSolver Engineering
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://pypi.org/project/acps-math-multisolver/
8
+ Keywords: acps-sdk,multi-agent,mathematics,multiple-solutions,socratic-tutoring,divergent-thinking,exam-preparation
9
+ Classifier: Development Status :: 5 - Production/Stable
10
+ Classifier: Intended Audience :: Education
11
+ Classifier: Intended Audience :: Science/Research
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3 :: Only
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Education
20
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
21
+ Classifier: Typing :: Typed
22
+ Requires-Python: >=3.10
23
+ Description-Content-Type: text/markdown
24
+ Requires-Dist: acps-sdk==2.1.0
25
+ Requires-Dist: fastapi>=0.100.0
26
+ Requires-Dist: pydantic>=2.0.0
27
+ Requires-Dist: uvicorn>=0.27.0
28
+ Provides-Extra: dev
29
+ Requires-Dist: build>=1.0.0; extra == "dev"
30
+ Requires-Dist: pytest>=8.0.0; extra == "dev"
31
+ Requires-Dist: ruff>=0.6.0; extra == "dev"
32
+ Requires-Dist: twine>=5.0.0; extra == "dev"
33
+
34
+ # acps-math-multisolver
35
+
36
+ **数学一题多解启发多智能体协作工具**:基于 `acps-sdk 2.1.0`,让 Algebra Agent 与 Geometry Agent 并行构造独立解法,再由 Socratic Agent 读取双路径产物,生成“共同表征 → 分岔探索 → 双路径贯通”的连续追问。每次求解都保留 ADP 发现、AIP 任务和结构化产物记录。
37
+
38
+ ## 命名与定位
39
+
40
+ **MultiSolver = Multiple + Solver**:不是把同一提示词复制给多个模型,而是用不同数学表征解决同一问题。`acps-` 表示任务分发、能力发现与通信均基于 ACPs SDK;`math` 表明面向数学学习。
41
+
42
+ 面向中高考压轴题、竞赛题研讨与大学证明题课堂,它把“看懂标准答案”改造成“比较多种路径、解释路径为何等价、在追问中自己重建关键一步”。苏格拉底导师只给问题与按需支架,不在问题链中直接报最终答案。
43
+
44
+ ## 协作机制
45
+
46
+ ```text
47
+ ┌─ AIP task → Algebra Agent ─┐
48
+ Leader → ADP 能力发现 ───┤ ├─ typed products → Socratic Agent
49
+ └─ AIP task → Geometry Agent ┘ │
50
+ └─ 七轮问题链 → Leader fan-in
51
+ ```
52
+
53
+ 1. 三个 Agent 各自运行在独立的 loopback FastAPI/AIP v2 JSON-RPC 服务中,拥有合法 AIC 与 ACS 能力描述。
54
+ 2. Leader 通过 `DiscoveryRequest` 和 `skills.tags` 过滤发现端点,使用 `AipRpcClient.start_task()` 并行派发给代数与几何 Agent。
55
+ 3. 两个 `StructuredDataItem` 解法产品经 Pydantic 校验后,一起进入 Socratic Agent;结论不一致时导师拒绝生成启发,避免把错误路径教给学生。
56
+ 4. 最终报告包含双解、启发记录、task ID、完成状态、耗时和在线 Agent,可审计而非单体函数伪装协作。
57
+
58
+ ## 安装与一键演示
59
+
60
+ 要求 Python 3.10+。在 PowerShell 中:
61
+
62
+ ```powershell
63
+ cd acps-math-multisolver
64
+ python -m venv .venv
65
+ .\.venv\Scripts\python -m pip install -e ".[dev]"
66
+ .\.venv\Scripts\python run_demo.py
67
+ ```
68
+
69
+ 也可使用安装产生的命令:
70
+
71
+ ```powershell
72
+ math-multisolver demo
73
+ math-multisolver demo --json # 完整 typed product,便于接入学习系统
74
+ math-multisolver tutor # 真人逐轮作答;:hint 支架,:quit 退出
75
+ math-multisolver --version # 1.0.0
76
+ ```
77
+
78
+ `run_demo.py` 自动模拟一名学生的七轮回答,但底层三个 Agent、ADP 发现、AIP 请求和结果回传均真实执行;无需 LLM API Key,也不需要外部服务。
79
+
80
+ ### 自定义输入
81
+
82
+ ```powershell
83
+ math-multisolver solve --problem "已知抛物线 y = -x² + 2x + 3 与 x 轴交于 A、B 两点(A 在 B 左侧),与 y 轴交于点 C。点 P 是抛物线弧 BC 上一动点(不与 B、C 重合)。(1) 求 A、B、C 的坐标;(2) 求 △PBC 面积的最大值及此时 P 的坐标。"
84
+ ```
85
+
86
+ v1.0.0 内置经过验证的二次函数动点面积策略,用于可复现演示与协议集成;它不是伪装成通用数学 AI 的提示词包装器。未注册题型会明确报错,不会编造答案。新增题型时可扩展 `engine`,复用现有 ACP 编排与 typed contracts。
87
+
88
+ ## 演示题与预期输出摘要
89
+
90
+ 输入题:抛物线 `y=-x²+2x+3` 与 x 轴交于 A、B,与 y 轴交于 C;P 在弧 BC 上运动,求三个定点坐标以及 `△PBC` 面积最大值和对应 P。
91
+
92
+ ```text
93
+ [acps-math-multisolver] 正在启动二次函数压轴题多解演示 ...
94
+ [acps-math-multisolver] 在线 Agent:Algebra Agent、Geometry Agent、Socratic Agent
95
+ ========================================================================================
96
+ ACPs Math MultiSolver v1.0.0 | session=multisolve-...
97
+ SDK=acps-sdk 2.1.0 | 端到端耗时 ... ms | report=report-...
98
+ ========================================================================================
99
+ [1/4] Algebra Agent · 代数路径:面积函数与配方
100
+ 核心洞察:以动点横坐标为单变量,把面积转化为区间上的二次函数最值。
101
+ 1. ... A(−1,0)、B(3,0);... C(0,3)。
102
+ 2. 设 P(t,−t²+2t+3),其中 0<t<3。直线 BC 为 x+y−3=0。
103
+ 4. S(t)=...=−3/2(t−3/2)²+27/8。
104
+ 结论:最大面积为 27/8,此时 P(3/2,15/4)。
105
+
106
+ [2/4] Geometry Agent · 几何路径:平行线平移与相切
107
+ 核心洞察:固定底边后,面积最大等价于高最大;最远平行线的临界状态是相切。
108
+ 3. 作 l∥BC,设 l:x+y=k。... 临界位置是与抛物线相切,切点即所求 P。
109
+ 4. ... 相切要求 Δ=...=21−4k=0,故 k=21/4。
110
+ 结论:最大面积为 27/8,此时 P(3/2,15/4)。
111
+
112
+ [3/4] Socratic Agent · 连续追问启发
113
+ 导师 1:在 P 移动时,BC 的长度会改变吗?若把 BC 作为底,真正变化的量是什么?
114
+ 学生 1:BC 的长度不变;面积变化来自 P 到 BC 的高。
115
+ 导师 5:如果作一条与 BC 平行的直线并向抛物线外侧平移,何时达到‘仍有公共点’的最后位置?
116
+ 学生 5:平行线向外平移,即将离开抛物线时的临界位置是相切。
117
+ 导师 7:代数面积函数的顶点与几何路径的切点重合,是巧合吗?它们共同刻画了什么事实?
118
+ 学生 7:不是巧合;... 都在刻画同一个‘到 BC 的距离最大’。
119
+
120
+ [4/4] AIP v2 协作审计
121
+ Algebra Agent | algebra-solution | completed | ... ms | task=task-...
122
+ Geometry Agent | geometry-solution | completed | ... ms | task=task-...
123
+ Socratic Agent | socratic-guidance | completed | ... ms | task=task-...
124
+ 调度拓扑:(Algebra Agent ∥ Geometry Agent) → Socratic Agent → Leader
125
+ ```
126
+
127
+ ## 测试
128
+
129
+ ```powershell
130
+ .\.venv\Scripts\python -m pytest
131
+ .\.venv\Scripts\python -m ruff check .
132
+ ```
133
+
134
+ 测试覆盖数学结果、区间条件、七轮启发不泄露最终答案、双路径一致性保护、不支持题型的失败行为,以及三个真实 AIP 任务的端到端往返。
135
+
136
+ ## 构建 wheel 与上传 PyPI
137
+
138
+ ```powershell
139
+ # 在开发虚拟环境中执行;构建 wheel 与 sdist 到 dist/
140
+ .\.venv\Scripts\python -m build
141
+
142
+ # 检查 METADATA、README 渲染与包描述
143
+ .\.venv\Scripts\python -m twine check dist/*
144
+
145
+ # 可选:先上传 TestPyPI 验证发布流程;密码提示中粘贴 TestPyPI API Token
146
+ .\.venv\Scripts\python -m twine upload --repository testpypi -u __token__ dist/*
147
+
148
+ # 正式发布;密码提示中粘贴 PyPI API Token
149
+ .\.venv\Scripts\python -m twine upload -u __token__ dist/*
150
+ ```
151
+
152
+ 不要把 API Token 写入代码、README 或命令历史。PyPI 不允许覆盖同版本文件;再次发布前必须提升 `pyproject.toml` 与 `identity.py` 中的版本号。上传是显式发布操作,本地构建和校验不会自动上传。
153
+
154
+ ## 项目结构
155
+
156
+ ```text
157
+ acps-math-multisolver/
158
+ ├── pyproject.toml # 1.0.0、acps-sdk==2.1.0、CLI、构建与质量工具
159
+ ├── README.md # 安装、交互、演示、测试和 PyPI 发布说明
160
+ ├── run_demo.py # 源码目录一键演示
161
+ ├── src/math_multisolver/
162
+ │ ├── __init__.py # 公共 API 与 __version__
163
+ │ ├── __main__.py # python -m math_multisolver
164
+ │ ├── cli.py # demo / solve / tutor
165
+ │ ├── models.py # AIP typed request/product/report
166
+ │ ├── identity.py # AIC、ACS 与项目版本
167
+ │ ├── registry.py # 基于 ADP 模型的能力注册与过滤发现
168
+ │ ├── runtime.py # AIP v2 服务、任务生命周期与产品编解码
169
+ │ ├── mesh.py # 三个独立 Agent 服务生命周期
170
+ │ ├── orchestrator.py # ADP 发现、并行 AIP 分发与 fan-in
171
+ │ ├── demo.py # 模拟对话、真人 tutor 与一键演示
172
+ │ ├── report.py # 双解、启发记录与审计渲染
173
+ │ ├── py.typed # PEP 561 类型标记
174
+ │ ├── agents/
175
+ │ │ ├── base.py # AIP handler 基类
176
+ │ │ ├── algebra.py # Algebra Agent
177
+ │ │ ├── geometry.py # Geometry Agent
178
+ │ │ └── socratic.py # Socratic Agent
179
+ │ └── engine/
180
+ │ ├── quadratic.py # 已验证双解与苏格拉底问题链
181
+ │ └── __init__.py
182
+ └── tests/test_workflow.py # 单元与真实 AIP 集成测试
183
+ ```
184
+
185
+ ## License
186
+
187
+ MIT
@@ -0,0 +1,28 @@
1
+ README.md
2
+ pyproject.toml
3
+ src/acps_math_multisolver.egg-info/PKG-INFO
4
+ src/acps_math_multisolver.egg-info/SOURCES.txt
5
+ src/acps_math_multisolver.egg-info/dependency_links.txt
6
+ src/acps_math_multisolver.egg-info/entry_points.txt
7
+ src/acps_math_multisolver.egg-info/requires.txt
8
+ src/acps_math_multisolver.egg-info/top_level.txt
9
+ src/math_multisolver/__init__.py
10
+ src/math_multisolver/__main__.py
11
+ src/math_multisolver/cli.py
12
+ src/math_multisolver/demo.py
13
+ src/math_multisolver/identity.py
14
+ src/math_multisolver/mesh.py
15
+ src/math_multisolver/models.py
16
+ src/math_multisolver/orchestrator.py
17
+ src/math_multisolver/py.typed
18
+ src/math_multisolver/registry.py
19
+ src/math_multisolver/report.py
20
+ src/math_multisolver/runtime.py
21
+ src/math_multisolver/agents/__init__.py
22
+ src/math_multisolver/agents/algebra.py
23
+ src/math_multisolver/agents/base.py
24
+ src/math_multisolver/agents/geometry.py
25
+ src/math_multisolver/agents/socratic.py
26
+ src/math_multisolver/engine/__init__.py
27
+ src/math_multisolver/engine/quadratic.py
28
+ tests/test_workflow.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ math-multisolver = math_multisolver.cli:main
@@ -0,0 +1,10 @@
1
+ acps-sdk==2.1.0
2
+ fastapi>=0.100.0
3
+ pydantic>=2.0.0
4
+ uvicorn>=0.27.0
5
+
6
+ [dev]
7
+ build>=1.0.0
8
+ pytest>=8.0.0
9
+ ruff>=0.6.0
10
+ twine>=5.0.0
@@ -0,0 +1,6 @@
1
+ """acps-math-multisolver: collaborative multi-solution and Socratic tutoring."""
2
+
3
+ from .identity import PROJECT_VERSION as __version__
4
+ from .models import MultiSolveReport, SolveRequest
5
+
6
+ __all__ = ["MultiSolveReport", "SolveRequest", "__version__"]