agentis
Version:
A TypeScript framework for building sophisticated multi-agent systems
20 lines (19 loc) • 814 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.AgentFactory = void 0;
const Agent_1 = require("./Agent");
class AgentFactory {
static async createAgent(config) {
// Create the agent with the provided tools or an empty array
const tools = config.tools || [];
const agent = new Agent_1.Agent(config.id, config.name, config.lore, config.role, config.goals, tools); // Explicitly cast to IAgent to ensure interface compliance
// Initialize the agent's memory
await agent.initializeMemory();
// Verify that the agent implements all required properties
if (!agent.tools) {
agent.tools = tools; // Ensure tools are set if not already
}
return agent;
}
}
exports.AgentFactory = AgentFactory;