v1.1.0Pi v1.1.0 源码分析Analysis of Pi v1.1.0 · 2026-10-07

evalsevals

私有包:行为评测与成对的文档提升对比(Docker 隔离)Private package: behavioural evals and paired documentation-lift comparisons (Docker-isolated)

Infra

← → 翻页 · F 全屏 · O 目录 · T 明暗 · L 语言← → navigate · F fullscreen · O overview · T theme · L language

图解 Pi Agent · Pi v1.1.0Pi Agent, Illustrated · Pi v1.1.001
01 · 运行器、评测定义与镜像:三个目录01 · Runner, eval definitions and image: three directoriesInfra

运行器、评测定义与镜像:三个目录Runner, eval definitions and image: three directories

pi-evals: a private package — a 1,446-line runner, 7 eval files and a multi-stage Docker imagesrc/运行器the runnerevals/评测定义与夹具eval definitions and fixturesdocker/镜像构建image buildpackage.jsonprivate: true · 没有 exportsprivate: true · no exports192cli.tseval:docs 的主程序:解析参数 → 镜像 → 发现 → 计划 → 逐个运行 → 报告eval:docs main: parse args → images → discover → plan → run each → report59plan.ts(case, variant, run) 任务(case, variant, run) tasks483report.ts配对与提升pairing and lift175docker.ts镜像与一次隔离运行images, one isolated run537harness.tsvitest-evals 适配器:在隔离目录里跑一个真实的 AgentSessionthe vitest-evals adapter: runs a real AgentSession in an isolated directorydocumentation-audit.eval.tssmoke.eval.tscustom-providerextensionsmodelsopenai-providertuiacme-server.tsconfigured-runtime.ts44Dockerfile5 个阶段 · 2 个目标5 stages · 2 targets152entrypoint.ts容器内的检查与 vitestin-container checks, vitest70install-runtime.mjs打包并安装工作区pack + install workspacepi-aipi-coding-agentvitest-evals@vitest-evals/coreautoevalsvitestPI_SESSION_SNAPSHOT_ARTIFACTcreatePi*Harnesshost(2)host (2)docs(5)docs (5)夹具fixturesdocs 评测文件名省略了 .docs.eval.tsdocs file names shown without .docs.eval.ts镜像里只有运行时:评测源码对模型用户不可读。The image holds only the runtime: eval sources are unreadable to the model user.Dockerfile.dockerignore 排除 .git、node_modules、dist、.env*。Dockerfile.dockerignore drops .git, node_modules, dist, .env*.testvitest:test/ 里的单元测试vitest: the unit tests in test/eval:hostvitest --project host:在本机跑 host 评测vitest --project host: host evals on this machineeval:docsnode src/cli.ts:容器里的文档提升对比node src/cli.ts: the documentation-lift comparison in containersevaleval:host,然后 eval:docseval:host, then eval:docsclean删除 .eval/ 产物目录delete the .eval/ artifactsdevDependencies工作区内的 pi 包都来自当前仓库(npm overrides)。Internal pi packages come from this repository (npm overrides).评测的对象是 coding-agent 本身:host 评测在本机检验行为;docs 评测在容器里比较“有文档 / 没文档”两种安装,测量文档带来的提升。The subject is coding-agent itself: host evals check behaviour on this machine; docs evals compare a with-docs and a without-docs install in containers to measure documentation lift.标签 = 行数tag = lines运行器runnerharness评测evalsDocker使用uses

*.docs.eval.ts 是文档提升评测,由 eval:docs 在容器里成对运行;其余 *.eval.ts 是普通的 host 评测,由 eval:host 在本机运行。*.docs.eval.ts files are documentation-lift evals, run in pairs in containers by eval:docs; other *.eval.ts files are ordinary host evals run on the machine by eval:host.

图解 Pi Agent · Pi v1.1.0Pi Agent, Illustrated · Pi v1.1.002
02 · 7 个评测:2 个 host,5 个文档提升02 · Seven evals: two host, five documentation-liftInfra

7 个评测:2 个 host,5 个文档提升Seven evals: two host, five documentation-lift

What is evaluated: 2 host suites (including a 40-page documentation audit) and 5 documentation-lift suiteshost 评测 · eval:hostHost evals · eval:host本机运行on this machine文档提升评测 · eval:docsDocumentation-lift evals · eval:docs每个用例 × 两种镜像each case × both imagesreadgrepfindlssubmit_documentation_auditStructuredOutputJudgeStructuredOutputJudge + ToolCallJudgeStructuredOutputJudgeStructuredOutputJudgecreateJudgedocumentation-audit.eval.ts“Audit documentation against implementation”> $path matches the implementationsmoke.eval.ts“Answer a basic prompt”> returns the expected answersmoke:没有工具;答案必须正好是 "Paris",smoke: no tools; the answer must be exactly "Paris",且 usage 的 provider / model 与环境变量一致。and usage must match PI_PROVIDER / PI_MODEL.documentation-audit:it.for 遍历 coding-agent/docsdocumentation-audit: it.for over the 40 pages下的 40 页;只读工具 + 一个提交工具,in coding-agent/docs; read-only tools plus a submitverdict 必须是 "match"(mismatch / inconclusivetool; the verdict must be "match" (mismatch /都让用例失败)。inconclusive fail the case).Add custom streaming provider> implements a provider from an API fixturecustom-provider.docs.eval.tsCreate and use a tool extension> creates, reloads, and invokes the extensionextensions.docs.eval.tsAdd model to existing provider> adds the model without replacing existing modelsmodels.docs.eval.tsAdd OpenAI-compatible provider> configures a provider that works through Piopenai-provider.docs.eval.tsCustomize the interactive context footer> replaces numeric context usage with a progress bartui.docs.eval.ts每个都是 [prompt, reload]:先让 Pi 改配置或写扩展,重载后再检查结果。Each is [prompt, reload]: Pi changes its config or writes an extension, then reloads and is checked.judgeThreshold: null:低分是数据,不是失败;分数参与配对比较。judgeThreshold: null: a low score is data, not a failure; scores feed the paired comparison.acme-server.ts 提供假的 OpenAI 兼容 / NDJSON 流式 API 供 provider 用例调用。acme-server.ts serves fake OpenAI-compatible / NDJSON streaming APIs for the provider cases.vitest.evals.config.ts · projects: docs = evals/**/*.docs.eval.ts · host = evals/**/*.eval.ts minus docs · testTimeout 300_000 · pool forks · maxWorkers 1 · fileParallelism falsecreatePiDocumentationEvalHarness() 在容器沙箱外直接抛错,所以 docs 评测只能经 eval:docs 运行。createPiDocumentationEvalHarness() throws outside the container sandbox, so docs evals only run through eval:docs.host 评测host evalsdocs 评测(标签 = 评分器)docs evals (tag = judge)

每个 docs 用例的输入都是 [prompt, reload] 两步:模型改完配置后,harness 调 session.reload(),评分器再从运行时里读出真实状态。Every docs case takes two steps, [prompt, reload]: after the model edits config the harness calls session.reload(), and the judge reads the real state back from the runtime.

图解 Pi Agent · Pi v1.1.0Pi Agent, Illustrated · Pi v1.1.003
03 · eval:docs:先写下实验计划,再逐个运行03 · eval:docs: write the plan down first, then run each armInfra

eval:docs:先写下实验计划,再逐个运行eval:docs: write the plan down first, then run each arm

One eval:docs run: write down the whole experiment first, then run each arm in a fresh container第 7 步,对每个任务Step 7, for each task.eval/<时间戳>_<uuid>/(0700).eval/<timestamp>_<uuid>/ (0700)parseEvalCli--provider --model · -t · 文件--provider --model · -t · filesrequireEvalAuthFileauth.json 里必须有该 providerauth.json must hold the providerbuildImageswithout_docs / with_docs,id 必须不同without_docs / with_docs, ids must differdiscoverCases × 2两种镜像里发现的用例必须完全相同both images must discover identical casescreateTaskPlan(case, variant, model, run) 全部任务every (case, variant, model, run) taskprotocol.json+ sha256 协议摘要 · expected-runs.json+ sha256 protocol digest · expected-runs.jsonfor task: runTaskdocker run 一个全新容器 → vitest.jsondocker run a fresh container → vitest.jsonsummarize + formatreport.json / report.txt;有阻塞对 → 退出码 1report.json / report.txt; blocked pairs → exit 1protocol.jsonexpected-runs.jsondiscovery/<variant>/tasks/<sha256>/vitest.jsonobservations.jsonl<variant>/sessions/<sha256>/session.jsonlreport.jsonreport.txtrunTask(docker, task)--project docs 文件 --testNamePattern ^<集> <用例>$--project docs file --testNamePattern ^<set> <case>$有 vitest.json?vitest.json?有 → readTaskObservation;没有 → erroredObservationyes → readTaskObservation; no → erroredObservationobservations.jsonl每个任务之后整体重写:中途崩溃也留下已完成的观测rewritten after every task: a crash keeps what finished失败不中断Failures don't stop it失败或缺失的一侧被记下,计划内的其余任务照常继续a failed or missing arm is recorded; the rest of the plan continues产物可能包含提示词、回答、生成的代码与工具输出;目录被 .gitignore 忽略。重复次数按运行序号交替顺序,减少顺序偏差。Artifacts may contain prompts, responses, generated code and tool output; the directory is git-ignored. Repetitions alternate order by run number to reduce order bias.123456781步骤step顺序order容器里执行runs in a container

实验设计在运行前就固定:报告按 expected-runs.json 检查每一对,而不是只看实际跑出了什么。The design is fixed before anything runs: the report checks each pair against expected-runs.json, not just against what happened to run.

图解 Pi Agent · Pi v1.1.0Pi Agent, Illustrated · Pi v1.1.004
04 · 任务计划:用例 × 运行序号 × 两种变体04 · The task plan: case × run number × both variantsExtensions

任务计划:用例 × 运行序号 × 两种变体The task plan: case × run number × both variants

createTaskPlan: case × run number × both variants; odd runs start with without_docs, even runs flip身份与校验Identity and checksplan.ts例子:2 个用例,--runs-per-variant 3 → 12 个任务(按执行顺序)Example: 2 cases, --runs-per-variant 3 → 12 tasks (in execution order)#1 · without_docs#2 · with_docs#3 · with_docs#4 · without_docs#5 · without_docs#6 · with_docs#7 · without_docs#8 · with_docs#9 · with_docs#10 · without_docs#11 · without_docs#12 · with_docsparseDiscoveredCasesvitest list 的 JSON → 用例vitest list JSON → cases"<eval set> > <case>"全名必须恰好两段,否则报错the full name must have exactly two parts身份不能重复No duplicate identitiesJSON.stringify([evalSet, caseId])模型身份Model identity"provider/model":必须含 "/",且不在两端"provider/model": must contain "/", not at either endrunsPerVariant正整数;默认 1 · --runs-per-variant · PI_EVAL_RUNS_PER_VARIANTpositive integer; default 1 · --runs-per-variant · PI_EVAL_RUNS_PER_VARIANT任务目录Task directorysha256([set, case, variant, model, run])Add model to existing provider> adds the model …run 1run 2run 3Create and use a tool extension> creates, reloads …run 1run 2run 3每个 (用例, 模型, 运行序号) 组成一对:without_docs 是对照组,with_docs 是实验组。所有任务在运行前就写进 expected-runs.json。Each (case, model, run number) forms a pair: without_docs is the control and with_docs the treatment. Every task is written to expected-runs.json before anything runs.加粗 = 这一轮先跑的一侧bold = the arm that runs first in its roundwithout_docs(对照)without_docs (control)with_docs(实验)with_docs (treatment)

用例来自 vitest list --json:parseDiscoveredCases() 拒绝不是恰好两段的名字和重复身份。Cases come from vitest list --json: parseDiscoveredCases() rejects names that are not exactly two parts and duplicate identities.

图解 Pi Agent · Pi v1.1.0Pi Agent, Illustrated · Pi v1.1.005
05 · 一个 Dockerfile,两个只差文档的目标05 · One Dockerfile, two targets that differ only in docsExtensions

一个 Dockerfile,两个只差文档的目标One Dockerfile, two targets that differ only in docs

The Dockerfile: one build, two targets that differ only in docs; docker run is read-only, one task eachdocker/Dockerfile5 个阶段 · 2 个构建目标5 stages · 2 build targetsbuildImages()docker.tsbuilderFROM node:24-slim · 挂载仓库 · npm ci --ignore-scriptsFROM node:24-slim · repo bind mount · npm ci --ignore-scriptsbuild:offline → install-runtime.mjs /opt/evaluatorwithout-docs-installFROM builder删掉 coding-agent 的 README.md CHANGELOG.md docs/ examples/rm coding-agent README.md CHANGELOG.md docs/ examples/evaluatorFROM node:24-slim · COPY builder 的 root → /repoFROM node:24-slim · COPY builder root → /repochmod go-rwx src evals docker · ENTRYPOINT entrypoint.tswith_docs+ builder 的 node_modules · PI_EVAL_VARIANT=with_docs+ builder node_modules · PI_EVAL_VARIANT=with_docswithout_docs+ 去掉文档的 node_modules · PI_EVAL_VARIANT=without_docs+ docs-free node_modules · PI_EVAL_VARIANT=without_docsFROMCOPY rootFROMFROMnode_modules镜像名Image namepi-evals-<hash>-<variant>:localhashsha256(repoRoot)[:12]构建Builddocker build --target <variant>然后Thendocker image inspect → Idcli.ts两个 Id 相同 → 报错equal Ids → error上下文排除Context ignores.git .eval node_modulesdist coverage .env .env.*install-runtime.mjs 只把运行器需要的文件拷进 root/install-runtime.mjs copies only runner files into root/docker.ts · 每个任务一次docker.ts · once per taskdocker run --rm --read-only --tmpfs /tmp:rw,exec,mode=1777 --tmpfs /repo/node_modules/.vite-temp:rw,exec,mode=1777--mount type=bind,source=<.eval/…/tasks/<sha256>>,target=/artifacts --env PI_EVAL_ARTIFACT_DIR=/artifacts --env PI_EVAL_RUNS_PER_VARIANT=<n>--env PI_EVAL_SANDBOX_UID=65532 --env PI_EVAL_SANDBOX_GID=65532 --env PI_PROVIDER --env PI_MODEL [--env PI_EVAL_ARTIFACT_UID/GID = host user]--mount type=bind,source=<auth.json>,target=/run/pi-eval-secrets/auth.json,readonly <image> <entrypoint args>FROM / COPY 阶段FROM / COPY stageCOPY node_modules带文档with docs无文档 / 评测器no docs / evaluator

两个变体用同一份安装结果:对照组只是在其上删除文档,所以差异只有文档本身。Both variants share one installation: the control merely deletes docs from it, so the only difference is the documentation.

图解 Pi Agent · Pi v1.1.0Pi Agent, Illustrated · Pi v1.1.006
06 · 三层防护:模型读不到评分器06 · Three guards: the model cannot read its judgespi-coding-agent

三层防护:模型读不到评分器Three guards: the model cannot read its judges

Three guards: a read-only container → the entrypoint self-checks as root → the harness drops to UID 65532 before the model gets toolsdocker run宿主 → 容器host → containerentrypoint.ts以 root 运行runs as rootrunPiCodingAgentharness.ts · 每个用例harness.ts · each case模型的工具以 UID 65532 运行The model's tools run as UID 65532read · write · edit · grep · find · ls;没有 shell、没有联网搜索read · write · edit · grep · find · ls; no shell, no web searchworkspace/ (rw)isolated home/pi-coding-agent distREADME · docs/ · examples/ (with_docs)src/evals/ (judges, fixtures)docker/vitest configsauth.jsoncredential env varother packages' docs只读根文件系统Read-only root filesystem--read-only;可写的只有两个 tmpfs--read-only; only two tmpfs mounts are writable每个任务一个新容器A fresh container per task--rm:上一个任务的痕迹不会留下--rm: nothing carries over between tasks/artifacts绑定到 .eval/…/tasks/<sha256>bound to .eval/…/tasks/<sha256>/run/pi-eval-secrets/auth.json只读挂载;目录在镜像里是 0700read-only mount; the directory is 0700 in the image源码 root 专属Root-only sources镜像构建时 chmod go-rwx src evals dockerchmod go-rwx src evals docker at build timePI_EVAL_SANDBOX_UID/GID= 65532,交给后面两层= 65532, handed to the next two layers/repo 内容完全符合清单/repo matches an exact allowlistnode_modules · package.json · packages · vitest.base.ts内部依赖不带文档Internal deps carry no docs无 docs/ examples/ src/ test/ README CHANGELOGno docs/ examples/ src/ test/ README CHANGELOG变体与文档一致Variant matches its docswithout_docs 必须没有;with_docs 必须有 docs/models.mdwithout_docs: none; with_docs: docs/models.md exists评测源码:root 专属 + 探测Eval sources: root-only + probe以 65532 身份尝试读取,必须失败a read attempted as 65532 must failcoding-agent 来自 distcoding-agent resolves from dist…/pi-coding-agent/dist/index.js凭据交给沙箱用户Credentials handed overauth.json → /tmp/pi-eval-host-agent,chown 65532auth.json → /tmp/pi-eval-host-agent, chown 65532只跑指定的评测文件Only an explicit eval filePI_EVAL_CONTAINER=1 · vitest run / listmkdtemp pi-eval-*workspace/ · home/ · sessions/applyIsolatedEnvironmentHOME / PI_CODING_AGENT_DIR 指向临时目录;清掉 PI_EVAL_*HOME / PI_CODING_AGENT_DIR → temp dir; PI_EVAL_* removedInMemoryCredentialStore凭据只在内存里;随后删除 auth.jsoncredential in memory only; auth.json is then deleted隐藏凭据环境变量Credential env var hidden运行期间 delete,结束后恢复deleted for the run, restored afterwards不许有意外扩展No unexpected extensions只允许 <inline:…> 的隐藏扩展only hidden <inline:…> extensionsenterToolSandbox转换后的模块 0600;setgroups([]) → setgid → setuidtransformed modules 0600; setgroups([]) → setgid → setuid确认读不到Confirm it cannot read读到任何受保护模块 → 报错any readable protected module → error看得到can see看不到cannot seeREADME 坦白说明:调用 provider 仍需要容器联网,所以单靠 Docker 不能证明模型写的代码从不联网。The README is explicit: provider traffic still needs container network access, so Docker alone cannot prove agent-written code never uses the network.下一层next layer容器container入口(root)entrypoint (root)测试框架harness

docs 评测只给 read、write、edit、grep、find、ls 六个工具:没有 shell,也没有联网搜索。Docs evals get only six tools — read, write, edit, grep, find, ls: no shell and no web search.

图解 Pi Agent · Pi v1.1.0Pi Agent, Illustrated · Pi v1.1.007
07 · 一次运行:真实的 AgentSession,跑完即拆07 · One run: a real AgentSession, torn down afterwardspi-coding-agent

一次运行:真实的 AgentSession,跑完即拆One run: a real AgentSession, torn down afterwards

One run of one case: a real AgentSession, torn down afterwards; the two variants differ only in the <docs> of the system promptrunPiCodingAgent(input, signal, setArtifact, options)promptAgent每个 prompt 步骤each prompt stepcreatePiDocumentationEvalHarness失败时On failureresolveModelSelection · mkdtempprovider/model;root/ 下 workspace、home、sessions(见 ev_sandbox)provider/model; workspace, home, sessions under root/ (see ev_sandbox)ModelRuntime.create({ credentials })getModel → getAuth;没有认证就直接报错getModel → getAuth; no auth → errorcreateAgentSessionServicescwd = workspace · extensionFactories(隐藏的提示词变换)cwd = workspace · extensionFactories (hidden prompt transform)createAgentSessionFromServicesthinkingLevel "off" · tools / noTools / customToolsenterToolSandbox → for step of inputprompt → promptAgent;reload → session.reload()prompt → promptAgent; reload → session.reload()诊断数据Diagnostics转录事件 · systemPromptSha256 · tokens / toolCalls · 有定价才算 costtranscript events · systemPromptSha256 · tokens / toolCalls · cost only if pricedverifySystemPrompt → output()有 output 选项就交给它(评分器用),否则就是回答文本an output option shapes the result for judges; otherwise the response textfinallysession.jsonl → PI_SESSION_SNAPSHOT_ARTIFACT · dispose · rm root · 还原环境session.jsonl → PI_SESSION_SNAPSHOT_ARTIFACT · dispose · rm root · restore envpreamble<tools><rules><docs> Pi documentation (read only ……<cwd>preamble<tools><rules>…<cwd>stopReason ∈ { stop, toolUse }否则抛出 errorMessage 或 "unexpected stop reason"otherwise throw errorMessage or "unexpected stop reason"stop && !text → error"Agent run produced no assistant text."getLastAssistantText() ?? ""最后一个 prompt 的回答就是 responsethe last prompt's answer becomes the response须 PI_EVAL_CONTAINER=1 且有沙箱 UID/GID,否则直接报错needs PI_EVAL_CONTAINER=1 and a sandbox UID/GID, or it throwswithout_docswith_docsnamewithout_docswith_docstoolsread…ls (6)read…ls (6)transformexcludePiDocumentation—expect <docs>falsetrue两种变体共用同一个用例定义和同一个评分器。Both variants share one case definition and one judge.已有诊断 → attachHarnessRunToError:带 errors 与耗时的部分结果diagnostics exist → attachHarnessRunToError: a partial run with errors + timings运行与清理都失败 → AggregateErrorrun and cleanup both fail → AggregateError报告据此把这一侧记为 erroredthe report then records that arm as errored系统提示词的分段(coding-agent 的 system-prompt.ts)System prompt sections (coding-agent system-prompt.ts)with_docswithout_docsexcludePiDocumentation 剪掉 <docs>…</docs>;verifySystemPrompt 要求 <rules> 还在、<docs> 有无与变体一致excludePiDocumentation cuts <docs>…</docs>; verifySystemPrompt requires <rules> and a <docs> matching the variant123456781步骤step顺序order只在 with_docswith_docs only

两种变体的唯一区别:without_docs 注册一个隐藏的 before_agent_start 扩展,用 excludePiDocumentation 剪掉系统提示词里的 <docs>…</docs>。The only difference between variants: without_docs registers a hidden before_agent_start extension that cuts <docs>…</docs> out of the system prompt with excludePiDocumentation.

图解 Pi Agent · Pi v1.1.0Pi Agent, Illustrated · Pi v1.1.008
08 · 报告:结果 → 配对 → 比较08 · The report: outcomes → pairs → comparisonInfra

报告:结果 → 配对 → 比较The report: outcomes → pairs → comparison

The report: classify each arm, then compare in pairs; if any pair is incomplete, no pass rate is publishedreadTaskObservation每个任务一个结果one outcome per taskresolvePair(集, 用例, 模型, 运行序号)(set, case, model, run)每个评测集的比较Comparison per eval setsummarize…formatEvalComparisonReport → report.txt示例数据:2 个评测集 × 3 次运行,第二个集里有一侧出错illustrative data: 2 eval sets × 3 runs, one arm errored in the second seterrorederroredskipped / pendingerrorederroredunscoredscoredvitest.json 读不了vitest.json unreadable断言不是恰好 1 条 / 名字不符not exactly 1 assertion / name mismatchskipped · todo · disabled · pending没有 harness 运行 / 模型不符no harness run / wrong modelfailed 或运行里有错误failed, or run has errors没有分数no score有分数(0 也算)a score (0 counts)每一侧在计划里恰好 1 次each arm planned exactly oncedesign expected 1 run, found N观测数 = 计划数observations = plannedexpected 1 observation, found N结果是 scoredoutcome is scored<variant>: <outcome>全部满足 → Pair { control, treatment }all hold → Pair { control, treatment }否则 → BlockedPair,带上面的原因(红色)otherwise → BlockedPair with the reasons above (red)without_docs = 对照 · with_docs = 实验without_docs = control · with_docs = treatment通过Passscore ≥ 1通过率Pass ratepasses / eligible pairs提升Lifttreatment − control (toPrecision 15)不公布Withheld任何一对被阻塞时if any pair is blockedno-lift两组通过率相同equal pass ratesnegative-delta实验组更低treatment is lowercontrol-saturated对照组 100%control at 100%treatment-saturated实验组 100%treatment at 100%flaky同一用例同一侧跨运行结果不同same case + arm passes in some runs only另有 tokens / tools / latency / cost 的配对均值差plus paired mean deltas for tokens / tools / latency / costDocumentation Eval Comparisons  Add model to existing provider         Pairs  3/3 eligible     Pass rate  +33.3 pp (with 100.0%, without 66.7%)         Flags  treatment-saturated, flaky        Tokens  -3750.0 (with 15373.3, without 19123.3, 3 pairs)         Tools  -4.3 (with 5.3, without 9.7, 3 pairs)       Latency  -13533.3ms (with 31100.0ms, without 44633.3ms, 3 pairs)     Est. cost  -$0.0076 (with $0.0353, without $0.0429, 3 pairs)  Create and use a tool extension         Pairs  2/3 eligible     Pass rate  withheld because pairs are blocked         Flags  flaky        Tokens  -6400.0 (with 23800.0, without 30200.0, 2 pairs)         Tools  -6.0 (with 8.5, without 14.5, 2 pairs)       Latency  -14850.0ms (with 54600.0ms, without 69450.0ms, 2 pairs)     Est. cost  -$0.0143 (with $0.0537, without $0.0681, 2 pairs)  Operational totals    without_docs: 6 runs, 146570 tokens, 71 tools, 339.10s, $0.3301 cost    with_docs: 6 runs, 120120 tokens, 44 tools, 263.50s, $0.2725 cost  Blocked pairs    Create and use a tool extension/creates, reloads, and invokes the extension/      provider/model/run-2: with_docs: errored通过率、提升与标记按 report.ts 的规则从示例数据算出(构建时计算)。有阻塞对时 eval:docs 退出码为 1;report.json 是 schemaVersion 3。Pass rates, lift and flags are computed from the example data with the report.ts rules at build time. With blocked pairs eval:docs exits 1; report.json is schemaVersion 3.数据流data flowscored阻塞 / 出错blocked / errored

0 分也是 scored:它是数据。只有没有分数才是 unscored。A score of 0 is still scored — it is data. Only a missing score is unscored.

图解 Pi Agent · Pi v1.1.0Pi Agent, Illustrated · Pi v1.1.009
扩展点Extension pointspi-coding-agent

evals 的扩展点Where to plug into evals

1
evals/<name>.docs.eval.tsevals/<name>.docs.eval.ts

新增一个文档提升评测:自动在两个变体里成对运行并进入报告。Add a documentation-lift eval: it runs in pairs in both variants and lands in the report automatically.

2
evals/<name>.eval.tsevals/<name>.eval.ts

新增一个 host 评测:普通的 vitest-evals 套件,由 eval:host 在本机运行。Add a host eval: an ordinary vitest-evals suite run on the machine by eval:host.

3
createPiDocumentationEvalHarness({ output })createPiDocumentationEvalHarness({ output })

把运行后的状态整理成评分器可比较的 JSON。Shape the post-run state into JSON a judge can compare.

4
judges: StructuredOutputJudge / ToolCallJudge / createJudgejudges: StructuredOutputJudge / ToolCallJudge / createJudge

选择或编写评分器;judgeThreshold: null 让分数成为数据。Pick or write judges; judgeThreshold: null makes the score data.

5
--runs-per-variant · -t · PI_PROVIDER / PI_MODEL--runs-per-variant · -t · PI_PROVIDER / PI_MODEL

控制重复次数、选择用例和被测模型。Control repetitions, select cases and choose the model under test.

图解 Pi Agent · Pi v1.1.0Pi Agent, Illustrated · Pi v1.1.010
←
1 / 10