Initialize the DeAI framework with the following code:
constdeAI=newdeAIMultiAgent({ config: { ... } });
Step 2: Add Agents
Define and add agents to the framework:
deAI.addAgent(newBedrockLLMAgent({ name:"Trading Agent", description:"Executes trades based on recommendations." }));deAI.addAgent(newBedrockLLMAgent({ name:"Market Agent", description:"Focuses on trends and opportunities in Web3 and crypto." }));
Step 3: Handle Requests
Route user queries to the appropriate agent:
asyncfunctionmain() {try {constresponse=awaitdeAI.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();