tinyagent-ts
Version:
Modern TypeScript framework for building AI agents with pluggable tools and ReAct reasoning
23 lines • 835 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.FinalAnswerTool = exports.FinalAnswerSchema = void 0;
// src/final-answer.tool.ts
// Simple “always-run” tool that returns whatever answer it is given.
const zod_1 = require("zod");
exports.FinalAnswerSchema = zod_1.z.object({ answer: zod_1.z.string() });
/**
* Always provide the agent’s final answer verbatim.
*/
class FinalAnswerTool {
constructor() {
this.name = 'final_answer';
this.description = "Provides the definitive answer to the user’s question.";
this.schema = exports.FinalAnswerSchema;
}
forward(answer) {
const parsed = exports.FinalAnswerSchema.parse(answer);
return parsed;
}
}
exports.FinalAnswerTool = FinalAnswerTool;
//# sourceMappingURL=final-answer.tool.js.map