Creating an expert agent in BrainSoup

Introduction

An expert agent in BrainSoup is a specialized AI designed to possess an in-depth understanding and knowledge in a specific domain or field. It is not only a repository of knowledge but also a versatile tool that can be applied in various practical scenarios to enhance productivity and decision-making. Here are some use cases where an expert agent can make a significant impact:

  • Writing Assistance: Whether drafting emails or documentation, an expert agent can provide suggestions, correct errors, and even generate content based on its deep understanding of the subject matter.
  • Decision Support: By analyzing available data and applying its specialized knowledge, an expert agent can offer insights and recommendations, aiding in more informed decision-making.
  • Team Collaboration: Integrated within platforms like Slack, expert agents can assist colleagues by answering questions, providing information, or facilitating discussions based on their domain expertise.
  • Customer Service: Expert agents can be deployed to interact with customers, offering accurate answers to inquiries and providing support by drawing from a comprehensive knowledge base.

Unlike generalist agents, expert agents are equipped with both surface and deep knowledge, enabling them to handle queries with a high level of precision and detail. Surface knowledge consists of fundamental concepts that allow the agent to grasp the basics of the domain, facilitating initial understanding and reasoning. Deep knowledge, on the other hand, encompasses comprehensive, detailed information, including technical specifications, reference documents, and more advanced materials that the agent can recall when necessary. This dual-layered approach to knowledge ensures that expert agents can provide insightful, accurate responses across a wide range of inquiries within their area of expertise.

Creating an expert agent involves curating a knowledge base, configuring the agent's settings, and integrating real-time data when necessary. This tutorial will guide you through each step, ensuring your agent becomes a valuable asset in its domain of expertise.

1. Curating the Knowledge Base

The foundation of an expert agent lies in its knowledge base. Here's how to start building it:

1.1. Surface Knowledge

1.1.1. Definition

Surface knowledge encompasses the foundational concepts and basic knowledge necessary for the agent to understand queries and perform reasoning within its domain of expertise. This layer of knowledge should always be readily accessible in the agent's working memory. It includes:

  • Basic definitions and concepts.
  • Fundamental principles and methodologies.
  • Essential data that supports quick comprehension and decision-making.

This information is crucial for the agent to effectively parse and respond to user interactions without needing to delve into more detailed documents unless necessary.

1.1.2. Implementation

To implement surface knowledge in BrainSoup:

  1. Create a Custom Context: Craft a JSON file that encapsulates the essential knowledge your agent needs. This file will reside in the Context folder within BrainSoup's directory structure. You can name it for instance MyExpertDomain.json .
  2. Structure Your Data: Use JSON's hierarchical organization to logically group related information. This approach helps in minimizing redundancy and ensures that your data is concise yet comprehensive. Remember, the more optimized your context file is, the less it impacts operating costs due to its influence on prompt size.
  3. Be Concise but Comprehensive: Given that custom contexts directly affect operational costs by increasing prompt sizes, it's imperative to be concise and minimalist. Remember that detailed information will be available in the deep Knowledge.

Tip: The Context folder is located in %AppData%\BrainSoup\Context . You can access it directly from the BrainSoup interface by clicking on the Open Context Folder button Settings screen.

1.2. Deep Knowledge

1.2.1 Definition

Deep knowledge constitutes the extensive, detailed information that your agent can draw upon when needed. This knowledge is not always at the forefront of the agent's "mind" but is retrieved based on context and necessity. It can include technical specifications, reference documents, user guides, etc. Here's how to effectively compile and organize this deep knowledge within BrainSoup.

1.2.2. Implementation

  1. Organizing Your Knowledge Base: Break down the domain into key topics or categories. This helps in organizing the documents logically. Gather your materials in various formats such as PDF, Word documents, text files, Markdown files, images, and audio recordings. Remember, non-text files will be transcribed into text to be indexed. Create a main folder under BrainSoup's Documents directory for your domain. For instance, BrainSoup\Documents\MyExpertDomain . Within this main folder, create subfolders for each key topic identified earlier.
  2. Preparing Your Documents: For text documents, use clear headings and subheadings to structure the content. Markdown files are slightly favored due to their formatting being easily understood by LLMs. Ensure the information is accurate, up-to-date, and as comprehensive as possible. It's okay if there's some overlap with surface knowledge; redundancy can reinforce learning. Name your files clearly and logically. Place them in the respective subfolders created in Step 1. A good file structure aids the agent in understanding the hierarchy and importance of information.
  3. Adding to BrainSoup: Move your prepared documents into the designated folders within BrainSoup's Documents directory. Once added, BrainSoup will automatically index these documents, making them searchable and retrievable by your agent based on context.

Tip: The Documents folder is located in %AppData%\BrainSoup\Documents . You can access it directly from the BrainSoup interface by clicking on the Open Documents Folder button in the Settings screen.

1.3. Optional: Sample Questions/Answers

1.3.1. Purpose

The purpose of including sample questions and answers is to guide the agent in understanding the expected depth and breadth of responses within its domain of expertise. This component helps in calibrating the agent's responses to align with user expectations, ensuring that it can provide not just accurate, but contextually rich answers.

1.3.2 Implementation

To implement this feature, create a structured JSON file named MyExpertDomain.QA.json and place it in the Context folder. This file should contain between 1 to 5 pairs of sample questions and their corresponding detailed answers. Each pair should be unique and non-redundant, covering different aspects or subtopics within the domain to provide a broad representation of the knowledge base. For instance, you can structure the file as follows:

{
  "samples": [
    {
      "question": "What is the purpose of X?",
      "answer": "The purpose of X is to..."
    },
    {
      "question": "How does Y work?",
      "answer": "Y works by..."
    },
    {
      "question": "What are the benefits of Z?",
      "answer": "The benefits of Z include..."
    }
  ]
}

1.4. Optional: Real-Time Data

1.4.1 Purpose

Real-time data integration enables BrainSoup agents to access and utilize up-to-date information, making them incredibly versatile for tasks that require current data. This capability is crucial for agents operating in dynamic environments where information changes frequently. Use cases include making your agent aware of business KPIs, infrastructure status, home automation systems, and more. By incorporating real-time data, expert agents can provide timely insights, enhancing their utility in operational decision-making and situational awareness.

1.4.2. Implementation

Create structured JSON files containing the real-time data your agent needs to access. These files should be placed in the Context folder. Develop scripts in any programming language supported by your system that can fetch or generate real-time data and update the JSON files in the Context folder accordingly. This ensures that your agent always has access to the latest information.

2. Agent Configuration

Configuring your agent is a critical step in tailoring its expertise to a specific domain. This involves selecting the right Large Language Model (LLM), defining the agent's identity, and configuring its access to knowledge and tools. Follow these steps to ensure your agent is well-equipped to act as an expert in its field.

2.1. Selecting the LLM

Opt for an LLM with superior reasoning capabilities that align with the complexity of the tasks you expect the agent to perform. GPT-4, Mistral-Medium, or Mistral-Large are recommended for their advanced reasoning skills. Each has its unique strengths, so choose based on the specific needs of your domain.

2.2. Defining the Agent's Identity

  1. Name: Give your agent a name that reflects its expertise area.
  2. Role: Define its role clearly – for example, "BrainSoup Expert" or "Customer Support Specialist". Defining a clear role also helps agents to collaborate effectively in multi-agent workflows.
  3. Persona: The persona should be tailored to how you want the agent to interact; whether it’s formal, friendly, or something in between. If your agent must follow a step-by-step process in its reasoning or responses, specify this here.

2.3. Knowledge Access Configuration

  • Allowed Documents: Grant access to deep knowledge by specifying which documents or subfolders in the BrainSoup Documents folder your agent can refer to. This forms the basis of the agent's detailed understanding of its domain.
  • Context Subscriptions: Subscribe your agent to essential surface knowledge stored in Custom Contexts within the BrainSoup Context folder. Include subscriptions to any sample questions/answers and real-time data contexts if applicable. This ensures your agent has immediate access to foundational knowledge and dynamic information relevant to its tasks.

2.4. Tool Access Configuration

  • Allowed Tools: If your agent requires specific tools to perform tasks or fetch additional information (e.g., WebBrowser tool for online research), list these in "Allowed Tools". This enables your agent to utilize external resources effectively.

2.5. Advanced Settings

Consider enabling features like a sense of time, memory of previous conversations, and personalized knowledge about the user only if they add significant value given their impact on operating costs. Each enabled feature increases data processing requirements.

  • Sense of Time: Useful for agents needing awareness of current dates or times for scheduling or time-sensitive information.
  • Memory of Previous Conversations: Enables continuity in interactions but at a higher data processing cost.
  • Knowledge of You: Personalizes interactions by allowing the agent to remember specific user preferences or details.

Remember, each configuration choice impacts not only how effectively your agent performs but also operating costs associated with data processing and LLM usage. Tailor these settings thoughtfully to create a balanced and efficient expert agent.

3. Taking Inspiration from Doc-E

When creating an expert BrainSoup agent, understanding how existing agents like Doc-E are configured can provide invaluable insights. Let's delve into where and how Doc-E's knowledge and settings are structured:

3.1. Doc-E's Knowledge

  • Deep Knowledge: Doc-E's extensive knowledge base is stored within the Documents subfolder of the BrainSoup Assets directory. This repository contains a wide array of documents, including technical manuals, FAQs, tutorials, and more. These documents are meticulously organized into subfolders by topic, making it easier for Doc-E to retrieve relevant information when needed.
  • Surface Knowledge and Contexts: The essence of what makes Doc-E proficient in guiding users through BrainSoup lies in its surface knowledge. This information is stored in built-in contexts. Some of them, like BrainSoup.Basics , are static and stored in JSON files within the Context subfolder of the BrainSoup Assets directory. Others, like BrainSoup.Tools , are dynamic and generated on-the-fly by BrainSoup. These context files encapsulate fundamental concepts about BrainSoup software, its architecture, and functionalities.

Tip: You can access the Assets directory from the BrainSoup interface by clicking on the Open Built-in app ressources button in the Settings screen.

3.2. Doc-E's Configuration

To replicate the efficiency and expertise of Doc-E in your own expert agent, you can see how Doc-E's settings are configured by double-clicking on its name in the right panel of BrainSoup, which opens the Agent Configuration window. Here, you can explore the LLM selection, identity definition, knowledge access, tool access, and advanced settings that have been fine-tuned to make Doc-E an expert in BrainSoup.

Conclusion

This tutorial outlines the foundational steps to create an expert BrainSoup agent tailored to any specific domain. By carefully curating both surface and deep knowledge bases and fine-tuning your agent's configuration settings, you can maximize its effectiveness and efficiency.