Agent tooling
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";The link points at the commit we read, so the line number still holds.
These question sets are lifted from this project's source exactly as written.
from src/commands.ts:93
is_billingtrue/falseIs this message related to a billing issue?
categorychoiceWhich 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' } },
},
});from src/gate.ts:149
gate_passedtrue/falseDoes 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}"?' },
},
});topologychoiceWhat 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_riskytrue/falseIs 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?' },
},
});