student-heart-study
基于 ACPs-SDK 2.1.0 的学业压力双智能体系统(Python 1.0.0)。 精简、开箱即用,核心依赖智能体互联 SDK 完成 Agent 间通信。
架构
┌──────────────────────────┐ ACPs AIP RPC ┌───────────────────────────┐
│ StudyPressureAgent │ ──────────────────▶ │ AnxietyReliefAgent │
│ (Leader, CLI) │ JSON-RPC over HTTP │ (Partner, FastAPI) │
│ - 与学生文字对话 │ │ - 接收移交摘要 │
│ - 记录完整谈话内容 │ 发现心理问题 │ - 呼吸调节 │
│ - 关键词三维打分(1~5) │ ──────────────────▶ │ - 担忧清单梳理 │
│ - 问题发现 + 持久化 │ │ - 简单建议 → Product │
└──────────────────────────┘ └───────────────────────────┘
- StudyPressureAgent(学业压力 Agent):在命令行与学生文字对话,覆盖考前焦虑 / 拖延 / 学习内耗三个维度,完整记录双方发言到本地;用
analysis.py做轻量关键词打分(1=稳定 … 5=危急)并检测心理问题(含自伤危机信号),触发后通过acps_sdk.aip.AipRpcClient自动把摘要移交给焦虑 Agent。 - AnxietyReliefAgent(焦虑 Agent):一个 FastAPI 服务,用
acps_sdk.aip.aip_rpc_server.add_aip_rpc_router挂载 AIP RPC 端点,收到移交后生成结构化的焦虑舒缓建议(呼吸调节、担忧清单梳理、简单建议)。
问题发现规则(满足任一即移交焦虑 Agent)
- 单次高危:最新一次谈话任一维度达到 5 分;
- 危机信号:任一学生发言命中自伤 / 危机词(如「不想活」「自残」等);
- 持续加重:与上一次相比总分上升且至少 2 个维度加重、无维度改善;或最近连续 3 次总分逐次上升;
- 多问题并存:最新总分 ≥ 7 且至少 2 个维度达到中度(≥3)。
快速开始
# 安装(开发模式,会自动拉取 acps-sdk==2.1.0)
pip install -e .
# 一键启动(后台起焦虑 Agent + 进入学业压力对话)
student-heart run
# 分开跑
student-heart server # 终端 A:启动 AnxietyReliefAgent(默认 8100)
student-heart chat # 终端 B:运行 StudyPressureAgent
# 非交互 demo(一键验证移交链路,内置一个高焦虑学生)
student-heart demo
# 查看本地谈话记录
student-heart history
student-heart history --student-id s001
焦虑 Agent 端点默认 http://127.0.0.1:8100/aip/rpc,可用 student-heart chat --url ... 指向已部署的服务。
打包 wheel 并上传 PyPI
# 生成 dist/student_heart_study-1.0.0-py3-none-any.whl
python -m build
# 上传到 PyPI(需先配置 ~/.pypirc 或使用 token)
twine upload dist/*.whl
上传后他人即可:
pip install student-heart-study
student-heart demo
项目结构
student_heart_study/
├── __init__.py # 版本号
├── models.py # 谈话记录模型 + 本地 JSON 持久化(ConversationStore)
├── analysis.py # 三维关键词评分 + 心理问题发现 + 移交载荷构建
├── anxiety_agent.py # AnxietyReliefAgent —— FastAPI + ACPs AIP RPC Server
├── pressure_agent.py # StudyPressureAgent —— CLI 对话 + AipRpcClient 移交
└── cli.py # 命令行入口(run / server / chat / demo / history)
tests/
└── test_analysis.py # 评分与问题发现逻辑的最小化测试
核心依赖
| 包 | 版本 | 用途 |
|---|---|---|
acps-sdk |
2.1.0 | 智能体互联(AIP 协议 RPC Client / Server),本项目核心依赖 |
fastapi |
≥0.110 | AnxietyReliefAgent 服务端 |
uvicorn |
≥0.27 | ASGI server |
httpx |
≥0.27 | acps-sdk 内部 RPC 传输 |
说明
analysis.py采用纯 Python 关键词匹配,不依赖外部 LLM,保证零额外成本、开箱即用。生产环境可替换为任意 LLM / 模型驱动的分析器,只要保持score_conversation/detect_problems的返回结构不变即可。- 谈话记录默认存放在
~/.student_heart_study/conversations.json(含完整双方发言),可用环境变量STUDENT_HEART_DATA_DIR覆盖存储目录(便于多实例隔离或测试)。 - 本项目严格依赖
acps-sdk 2.1.0,通过它的 AIP(Agent Interaction Protocol)RPC 模式完成学业压力 Agent 与焦虑 Agent 的互联移交。
Metadata
Release files for student-heart-study 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| student_heart_study-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for student_heart_study-1.0.0-py3-none-any.whl |
Release files / student_heart_study-1.0.0-py3-none-any.whl
| Download URL | student_heart_study-1.0.0-py3-none-any.whl |
|---|---|
| Size | 22.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3c9ff2444b7a41853ddb0a439dd75de8d20790da0236c0f12dde6b3dd772d1c0
|
|
BLAKE2b-256 checksum How to use checksums |
d6fd6002abfa241a7effd9efd860d38f625275bc78d0dfe526f61b728e78b3b7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.2
|
Security for student-heart-study 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.