Making your Agents more Aware with Custom Contexts
Introduction
In BrainSoup, contexts play a pivotal role in enhancing agent interactions by providing them with dynamic data reflective of real-world scenarios. To learn more about contexts in BrainSoup, you can refer to this dedicated article. The current article focuses on Custom Contexts—how to create them, use them, and understand their impact on agent performance.
Possible Uses
Custom Contexts can serve multiple purposes:
- Environmental Awareness: Equip agents with the ability to perceive and interact with both virtual and physical environments through real-time data.
- Core Knowledge Base: Establish a foundational dataset that agents can constantly reference for informed reasoning and decision-making.
How to Create a Custom Context
Creating a Custom Context involves defining a either a a tree of text files or a JSON-formatted file that represents the specific data you wish to inject into an agent's working memory. Here’s a step-by-step guide using JSON formatting:
Step1: Define Your Data
Start by identifying the information critical for your agent's operation. This could be anything from weather conditions for an event planning agent to stock market data for a financial advisor agent.
Step2: Format Your Data
Structure this information in JSON format. The structure is freeform, but it should be clear and concise to ensure efficient processing. For example:
{ "temperature": "22C", "humidity": "78%", "condition": "Sunny" }
To learn more about JSON formatting, you can refer to this guide.
Step3: Save Your File
Place this JSON file in the BrainSoup's C:\Users\<YourUsername>\AppData\Roaming\BrainSoup\Context
directory. The name of the file will be the subject of your context (e.g., WeatherData.json
).
Tips:
- You can quickly access the
Context
folder from the BrainSoup interface by going to Settings > App Folders > Context. - Instead of JSON, you can also define your Custom Context using a tree of text files structured in folders and sub-folders, each file representing a specific data point.
Subscribing to Custom Contexts
Agents or chat rooms can subscribe to these contexts through their settings.
To subscribe an agent:
- Access the agent's settings.
- Navigate to the 'Context subscriptions' section.
- Add the subject of your context (e.g.,
WeatherData
) to the list.
To subscribe a chat room:
- Open the chat room settings.
- Navigate to the 'Context subscriptions' section.
- Add the subject of your context to the list.
This process links the agent or chat room to your Custom Context, enabling it to access and utilize the provided data.
Considerations Regarding Context Size and Agent Working Memory
The size of your context should be managed carefully; larger contexts consume some of the agent's working memory, potentially increasing response times and usage costs. Ensure your context data is concise and non-redundant to maximize efficiency.
Conclusion
Custom Contexts are a powerful feature in BrainSoup that allow for significant customization and flexibility in how agents perceive and interact with their environment. By following these guidelines, you can effectively create and utilize Custom Contexts to enhance your agents' capabilities and responsiveness to dynamic data.