Developer Documentation
DAR Open Network
  • Overview
  • DAR ID
    • Introduction
    • Client ID Registration
    • Authentication
      • 1. Request DAR ID Identity
      • 2. Exchange Code for Access Token
      • 3. Refresh Access Token
      • 4. Get Access Token Details
      • 5. Get User DAR ID Information
    • Security Best Practices
  • DeAI
    • Multi-Agent Framework
      • Development Guide
      • Agent Options
      • Endpoints Overview
    • aiNFT Framework
      • Overview
      • Chat with an NFT Agent
      • Generate a Story for an NFT Agent
      • Group Chat Between Multiple NFT Agents
    • Game Asset Generator
Powered by GitBook
On this page
  1. DeAI
  2. Multi-Agent Framework

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();
PreviousMulti-Agent FrameworkNextAgent Options

Last updated 4 months ago