模块 1 · 路由地图

v0.1 路由:
customers / products / advisors / compliance

代销平台 API 是「读 Core 模拟库」的 REST 门面。路由按业务域切分,不用 /api/platform/* 前缀。 和 Agent 对话线(/api/chat)是两条平行轨道——指挥 AI 加「查持仓」时,先确认走哪条。

四块 canonical 域(以本文为准)

/api/customers/*

客户 L0 档案、持仓、流水。平台客户 REST 薄路由(customers.py) → platform/customer_service → core_ro。

/api/products/*

产品列表、净值曲线。理财师/客户看产品详情都走这里,不另开 Agent Tool HTTP。

/api/advisors/*

理财师名下客户归属。advisor 只能查本人 roster,风控/分析员可全量只读。

/api/compliance/*

适当性判定等合规读接口。canonical:Agent 合并期改调同一 Service,不保留第二套路径。

重复能力以谁为准? 以本平台 API 为准。Agent 侧已有同能力 Tool 时,合并期改调 app/service/platform/,旧路径仅过渡。

三层分工(别让 AI 在路由里写 SQL)

🌐api/*.py
🔑deps 鉴权
📦platform Service
🗄core_ro

点击「下一步」看一层层往下走

平台客户 REST 薄路由(customers.py)
"""代销平台 · 客户 L0 与资产读 API(canonical · 不要求 X-Agent-Type)。"""
@router.get("/{customer_id}/holdings")
def list_holdings(
    customer_id: str,
    auth: AuthContext = Depends(get_platform_auth_context),
):
    assert_platform_customer_access(auth, customer_id, ...)
    return ok(platform_service.list_holdings(customer_id))
白话

文件头就写明:这是平台 canonical 读接口,不要 X-Agent-Type。

URL 用复数 customers + 嵌套 holdings,参数名和域 ID 一致。

鉴权用平台专用函数,不是 chat 那条 get_auth_context。

先断言「你有没有权看这个 customer_id」,再调 Service,路由里不出现 SQL。

理财师 Agent 也要查客户持仓,应该新建 /api/agent/holdings 吗?