zizi ce491314c8 feat(tier2): P4 服务化核心——Agent Service(create_app)+ 第二装载真落库(MySQL+MinIO)
【U1 Agent Service】service/{app,infra_config,bootstrap}.py + config/infra.yaml:
经 agentscope 2.0.2 官方 create_app 把 tier2 引擎接成 Agent Service 壳——复用 studio 的 agent 装配零件
(roles/九工具/四熔断+trace/BYPASS/历史压缩)接到 create_app 扩展点(extra_agent_tools/extra_agent_middlewares),
不重写生成逻辑。Redis(mini-infra)做 storage(db0)+MessageBus(db1)。session 三路(新建/续接/加载工程迭代)经 REST(bootstrap.py)。
诚实差距:有界resume/工作室多agent/L2-L3/落库=循环外编排,服务态由控制面承接(已标 followup)。

【U2 真落库】store.py BackendStore 真实现(替 P3 NotImplementedError)+ schema SQL:
manifest→MySQL(幂等键 game_id+source_hash)+源文件全文→MinIO(bucket tier2-src);fetch 回填重建。
pymysql+minio 惰性 import;TIER2_STORE=backend 切换。

全 tier2/ 内、零碰 Tier0/1、py_compile+惰性import实证+forbidden-import 通过。真部署(连基建+uvicorn+smoke)待 mini-desktop。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-24 06:37:37 +00:00

16 lines
1.1 KiB
Python

"""tier2/gen-worker/service —— tier2 富游戏自治线 · Agent Service 服务壳(U1)。
把现在的「本地 CLI runner 直驱裸 Agent」(run_engine.py / agent_loop.studio.run_studio)升级成经
AgentScope 2.0.2 官方 Agent Service(`agentscope.app.create_app`)接入的服务:多租户 / 多会话 /
REST 触发 + SSE 事件流,session 状态 + 跨会话 MessageBus 走 Redis(mini-infra)。
模块:
- infra_config.py:基建数据面配置加载器(运行时读 tier2/config/infra.yaml,不 import 重依赖)。
- app.py:create_app 服务壳 —— 复用 studio 的 agent 装配件(roles 系统提示词 + 九工具 Toolkit +
四熔断 / trace 中间件 + BYPASS 权限 + 历史压缩),Redis 连接从 infra_config 取。重依赖惰性 import。
- bootstrap.py:session 三路初始化(新建 / 续接 / 加载已有工程迭代)经 REST API 的客户端编排 + 口径说明。
重依赖(agentscope[full] 的 app、redis 客户端)只在函数内惰性 import,保证 6c6g(未装重依赖)能
py_compile + import 本包;真跑 / 部署在 mini-desktop(见 app.py 文件头 deploySteps)。
"""