easynet.run · 全部问题场景

AI 找到了几张表,却不知道该信哪张。

你问本月收入为什么下降,助手很快查出一个金额。可它用的是订单创建时间,财务按入账时间统计;一张表含退款,另一张不含。查询没有报错,答案甚至附了 SQL,看起来很可信,却根本没有回答同一个业务问题。

这不是缺一个更聪明的查库工具。先使用团队已经确认的报表、数据目录或指标定义,通常比让模型在所有表中自由选择更可靠。如果每周只看几个固定指标,已有报表能完成的工作,也无需重新搭建查询层。

EasyNet 可以接入的是带明确用途的查询能力。比如“查询已关账月份的净收入”,只接收月份和获准的业务范围,返回金额,同时给出口径、数据截止时间和来源说明。先用同一口径比较两个月,确认下降幅度;要解释原因,还需继续核对订单量、退款等具体变化,不能凭一个金额就得出结论。

这个入口应由熟悉数据的人维护。查询底层仍可使用已有语义层或批准的查询模板,相关说明通过 Context 关联起来。EasyNet 的材料目录不能凭空变成完整 Data Catalog;可信来源、质量状态、负责人和更新关系,需要沿用现有系统或另行接入。

遇到本月尚未关账,也应该把这一事实返回,而不是悄悄切换到另一张表凑出金额。用户无权看部门明细时,限制要在查询端执行。业务条件和访问范围不能只藏在工具描述里,因为模型可能漏读或传入不符合预期的参数。

先挑一个有认证报表可对照的月份,检查相同口径下结果是否一致;再问一个口径不明确的问题,看助手会不会先确认。值得实现的体验是,AI 不只找到“能查的东西”,还知道这次结果说明什么、不能说明什么,以及有疑问该找谁。

  1. 01

    澄清收入定义

    订单额还是财务确认的净收入?

  2. 02

    查询已结月份

    带上授权范围、口径与截止时间。

  3. 03

    对照后再解释

    单个金额不能证明下降原因。

先选指标含义,再查询数字,最后解释变化。

订单额 11 万,为什么这里返回净收入 9.2 万?

下方完整函数使用两类合成记录:订单创建金额与财务月结净收入。查询 2026-02 时只读已关账来源,并返回口径、范围和截止时间;2026-03 未关账就拒绝,不拿订单额填空。保存为 revenue.py 可在本地运行,不连接真实财务系统。

本地示例 · python
"""Synthetic monthly records: a rule demonstration, not a finance integration."""

import json
import re

# Order creation and accounting recognition answer different questions.
ORDER_VALUE_CENTS = {"2026-01": 10_500_000, "2026-02": 11_000_000}
MONTH_CLOSE = {
    "2026-01": {"closed": True, "net_cents": 10_000_000, "cutoff": "2026-02-03T18:00:00Z"},
    "2026-02": {"closed": True, "net_cents": 9_200_000, "cutoff": "2026-03-03T18:00:00Z"},
    "2026-03": {"closed": False, "net_cents": None, "cutoff": None},
}


def closed_month_net_revenue(month: str) -> dict:
    if not isinstance(month, str) or not re.fullmatch(r"[0-9]{4}-(0[1-9]|1[0-2])", month):
        raise ValueError("month must be YYYY-MM")
    record = MONTH_CLOSE.get(month)
    if record is None:
        raise ValueError("month is not available in the approved source")
    if not record["closed"]:
        raise ValueError("month is not closed; do not substitute order value")
    return {
        "month": month,
        "amount_cents": record["net_cents"],
        "currency": "USD",
        "definition": "recognized revenue minus recognized refunds; excludes sales tax",
        "scope": "fictional company total",
        "cutoff": record["cutoff"],
        "source": f"synthetic-month-close/{month}",
        "status": "closed",
    }


if __name__ == "__main__":
    print(json.dumps(closed_month_net_revenue("2026-02"), indent=2))

预期结果:amount_cents 为 9200000,status 为 closed,source 为 synthetic-month-close/2026-02。这说明选了哪份合成数据,不证明真实账目已认证,也不解释收入下降的原因。

让 Agent 先验口径,再接数据源

下载代码与测试,或复制英文 AGENTS.md。任务要求核对正确来源、未关账、缺失月份和非法参数;真实身份权限与数据源接入单独处理,不冒充现成 Data Catalog。

阅读完整交接任务
# Query the right metric before explaining a change

Use the fictional data in revenue.py to show why order value and closed-month
net revenue are not interchangeable. Do not connect to real financial systems
or publish these records without approval. This exercise does not implement
tenant authorization, a data catalog, or accounting certification.

Ask for the case-page URL if files were not supplied. Resolve
`/examples/closed-revenue/` against that user-provided origin and obtain
revenue.py and test_revenue.py. Read both and local repository instructions.
Use an approved new directory; do not overwrite existing files. A localhost URL
on another device is not the author's server. Obtain approved reachable files
instead of guessing a production domain.

Run these local checks in that directory:

```bash
PYTHONDONTWRITEBYTECODE=1 python3 -m unittest test_revenue.py
PYTHONDONTWRITEBYTECODE=1 python3 revenue.py
```

February order value is 11,000,000 cents, but closed net revenue is 9,200,000
cents (USD 92,000.00). The function must select the month-close record and return
its definition, scope, cutoff and source. March is unclosed; April is absent.
Neither becomes zero or a substitute order-table amount. Dates and figures are
synthetic fixtures, not current financial information or certified results.

Have the receiving assistant name the definition, month, scope and cutoff
before explaining the number. Comparing January's 10,000,000 cents with February's
9,200,000 cents gives an 8% decline under this one definition. It does not tell
you why revenue changed. Do not invent an explanation about refunds, customers
or order volume from these two aggregate figures.

For a real integration, identify the data owner's approved metric and source
first. Replace the fixture read with that approved query; preserve closed-period
checks and return source metadata from the actual result. Do not invent SQL,
credentials or a department scope that the underlying system does not enforce.
If the user requests department-level access, stop until their authenticated
identity and permitted departments are bound and enforced at the provider.
Never take a department or staff ID in a model argument as permission.

Only after that boundary is defined, register the approved query through the
version-matched EasyRemote function guide linked from the case. Exposing a
callable function does not certify the numbers or authorize every caller. Verify
an authorized result, denied access, an unclosed period and unavailable source
separately; keep existing certified reports as a comparison.

Report fixture execution separately from source integration, authorization and
actual Runtime invocation. A passing local test is not proof that a real finance
system was queried. Do not install packages, start services or call paid models
merely because these instructions were copied.
接入时的检查项
  • 助手能说明为什么选择该来源而排除其他表。
  • 计算结果与既有认证报表在同一口径下匹配。
  • 缺少口径或来源过期时不伪装成完整答案。
源码与接入资料