tinyagent-ts
Version:
Modern TypeScript framework for building AI agents with pluggable tools and ReAct reasoning
36 lines • 1.76 kB
JavaScript
;
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.TriageAgent = void 0;
// src/triageAgent.ts
require("reflect-metadata");
const agent_1 = require("./agent");
const decorators_1 = require("./decorators");
/**
* A minimal agent that simply lists available tools and prompts the user
* to choose which one to run. This can be used as an initial triage step
* before invoking a more capable agent.
*/
let TriageAgent = class TriageAgent extends agent_1.Agent {
/**
* Returns a message listing all tools defined on this agent class.
* The user can then pick the best tool for their task.
*/
async run(_input) {
const tools = Reflect.getMetadata(decorators_1.META_KEYS.TOOLS, this.constructor) || [];
const list = tools
.map((t) => `- ${t.name}: ${t.description}`)
.join("\n");
return { answer: `hey here are the tools you have, choose the best one for the task:\n${list}` };
}
};
exports.TriageAgent = TriageAgent;
exports.TriageAgent = TriageAgent = __decorate([
(0, decorators_1.model)("qwen/qwen2-72b-instruct")
], TriageAgent);
//# sourceMappingURL=triageAgent.js.map