工具总线装配面测试:三路各穿各的缝
守开环 Agent 最容易出事的三条: - 写类工具**过程中不落地**(只登记意向,并如实告诉 Agent 世界还没变)—— 骗它说已执行,它会据此往下推而世界一步没动 - 调人 = 发工单 + 立监听,卡号记进 trace(引擎据此挂起,不重复发第二张) - LLM 五件经模型网关、用活动声明的用途名;提示词归系统 六例全绿;顺带钉住 Mastra 的 tool id 规矩(点号 → 双下划线)。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KeDBx2PHLavbURXB8LJJ7m
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* 反例:dowhile 的循环体「输出形状 ≠ 输入形状」时会怎样(只做类型检查,不运行)。
|
||||
* 用 tsc 单独检查这个文件:npx tsc --noEmit --strict --module esnext --moduleResolution bundler \
|
||||
* --target es2022 --skipLibCheck src/negative/dowhile-shape-mismatch.ts
|
||||
*/
|
||||
import { createStep, createWorkflow } from '@mastra/core/workflows';
|
||||
import { z } from 'zod';
|
||||
|
||||
const In = z.object({ round: z.number(), reopen: z.boolean() });
|
||||
const Out = z.object({ somethingElse: z.string() });
|
||||
|
||||
const body = createStep({
|
||||
id: 'body',
|
||||
inputSchema: In,
|
||||
outputSchema: Out,
|
||||
execute: async () => ({ somethingElse: 'x' }),
|
||||
});
|
||||
|
||||
const start = createStep({
|
||||
id: 'start',
|
||||
inputSchema: z.object({}),
|
||||
outputSchema: In,
|
||||
execute: async () => ({ round: 1, reopen: false }),
|
||||
});
|
||||
|
||||
export const wf = createWorkflow({ id: 'neg', inputSchema: z.object({}), outputSchema: Out })
|
||||
.then(start)
|
||||
// 循环体输出 Out,下一轮却要拿它当 In 用
|
||||
.dowhile(body, async ({ inputData }) => inputData.reopen === true)
|
||||
.commit();
|
||||
Reference in New Issue
Block a user