Development Guide

Step 1: Initialize the Framework

Initialize the DeAI framework with the following code:

const deAI = new deAIMultiAgent({ config: { ... } });

Step 2: Add Agents

Define and add agents to the framework:

deAI.addAgent(
  new BedrockLLMAgent({
    name: "Trading Agent",
    description: "Executes trades based on recommendations."
  })
);

deAI.addAgent(
  new BedrockLLMAgent({
    name: "Market Agent",
    description: "Focuses on trends and opportunities in Web3 and crypto."
  })
);

Step 3: Handle Requests

Route user queries to the appropriate agent:

async function main() {
  try {
const response = await deAI.routeRequest(query, userId, sessionId);	console.log("\\n** RESPONSE DETAILS **\\n");
console.log("Agent Information:");
console.log(`  > Agent ID        : ${response.metadata.agentId}`);
console.log(`  > Agent Name      : ${response.metadata.agentName}`);

console.log("\\nUser Information:");
console.log(`  > User Input      : ${response.metadata.userInput}`);
console.log(`  > User ID         : ${response.metadata.userId}`);
console.log(`  > Session ID      : ${response.metadata.sessionId}`);

console.log("\\nAdditional Parameters:");
console.log(`  > ${JSON.stringify(response.metadata.additionalParams, null, 2)}`);

console.log("\\nResponse Output:");
console.log(`  > ${response.output}\\n`);
} catch (error) {
    console.error("An error occurred:", error);
  }
}

main();

Last updated