Agent 工具
基于 TypeSafe Jev,为 Pi 编码 agent 提供语义工具路由和类型化的 System One 决策。
Semantic tool routing and typed System One decisions for the Pi coding agent using TypeSafe Jev
import { TypeSafeClient, choice, noul, score } from "@typesafe-ai/sdk";链接指向我们抓取当天的那个 commit,行号是准的。
下面是从这个项目源码里原样取出来的 question 组合。
is_billing是/否Is this message related to a billing issue?
category选项Which category does this issue fall into?
billing — Billing, invoices, card issuesbug — Software bug or crashother — General questionsimport { experimental_evaluate as evaluate } from 'ai';
const { answers } = await evaluate({
model: 'typesafe-ai/jev',
state,
questions: {
is_billing: { type: 'boolean', instructions: 'Is this message related to a billing issue?' },
category: { type: 'choice', instructions: 'Which category does this issue fall into?',
criteria: { billing: 'Billing, invoices, card issues', bug: 'Software bug or crash', other: 'General questions' } },
},
});gate_passed是/否Does the provided code/output satisfy this acceptance criteria: "${options.criteria}"?
import { experimental_evaluate as evaluate } from 'ai';
const { answers } = await evaluate({
model: 'typesafe-ai/jev',
state,
questions: {
gate_passed: { type: 'boolean', instructions: 'Does the provided code/output satisfy this acceptance criteria: "${options.criteria}"?' },
},
});topology选项What type of workflow is best suited for this task?
implementation — Code change, bugfix, refactoring, feature implementation, or file modificationsresearch — Investigating codebase, external research, architectural analysis, or explorationreview — Code review, security audit, checking compliance or reviewing a pull requestgeneral — General question or task not requiring multi-stage implementationimport { experimental_evaluate as evaluate } from 'ai';
const { answers } = await evaluate({
model: 'typesafe-ai/jev',
state,
questions: {
topology: { type: 'choice', instructions: 'What type of workflow is best suited for this task?',
criteria: { implementation: 'Code change, bugfix, refactoring, feature implementation, or file modifications', research: 'Investigating codebase, external research, architectural analysis, or exploration', review: 'Code review, security audit, checking compliance or reviewing a pull request', general: 'General question or task not requiring multi-stage implementation' } },
},
});is_risky是/否Is this risky?
import { experimental_evaluate as evaluate } from 'ai';
const { answers } = await evaluate({
model: 'typesafe-ai/jev',
state,
questions: {
is_risky: { type: 'boolean', instructions: 'Is this risky?' },
},
});