-
-
Unstoppable Autonomous Agents
-
Multiple Agent Orchestration
-
Easy to integrate with existing apps. Potlock Agent example
-
MRKL Agent Execution with Actions, Thoughts, Observations and Final Answer parsing.
-
Settings. Can set continuous mode, letting the agent run autonomously without human input.
-
Run against local models with LM Studio or Ollama. Configurable in settings.
-
Extend agents with your tools
I've been very fascinated with the orchestration of AI autonomous agents, particularly agents that can be distributed and operated by anyone, anywhere without limits. µnstoppable Autonomous Agents is a project that was born out of these two interests.
The focus was on creating agents that are not just versatile and agile—capable of operating across a variety of models—but also extendable with open-source accessibility. The blockchain are the perfect platform for this vision. Enhanced by the Blockchain Operating System (BOS), which provides a native virtual machine (VM) environment, these agents are enabled for seamless blockchain interactions and operations.
I've initiated a similar project called micro-agi and a NEAR Autonomous Wallet. In this hackathon project I tried to bring some of their functionality into the BOS.
MRKL Agents
MRKL (Modular Reasoning, Knowledge, and Language) agents, or "miracle" agents, are built on the foundation of Large Language Models (LLMs) as their core controllers. These agents excel in understanding requests, organizing agendas, making complex decisions, and accelerating research. The LLM serves as the brain of the agent, augmented by components for planning, memory, and tool use, crucial for breaking down tasks into subgoals and self-improvement through reflection.
MRKL agents like AutoGPT, BabyAGI, and smol dev demonstrate the potential of these intelligent systems. Planning allows for the decomposition of complex tasks into simpler, manageable steps, while memory facilitates the storing and retrieving of information vital for task execution. The accuracy and reliability of natural language generation by LLMs are critical for optimizing agent performance.
Unstoppable Autonomous Agents: What They Do
Designed as lightweight, MRKL agents, these entities can perpetually fulfill user-defined objectives, demonstrating flexibility by running against local and cloud-based models alike. By leveraging blockchain technology and specifically the BOS VM, these agents interact with blockchain data and execute transactions, making them ideal for a broad spectrum of applications. They are also stored and distributed via the BOS contract.
Building Agents
The agents were conceived as MRKL agents, with a development focus on seamless integration with the BOS VM. A significant component of this development was the construction of prompts that provided the agents with context and goals.
This is the method that creates the main prompt based on a set of tools, role, goal and agent's backstory:
const buildPrompt = (tools, role, goal, backstory) => `
You are ${role}.
${backstory}
Your personal goal is: ${goal}
${
tools.length > 0 &&
tools.map((tool) => {
return `
TOOLS:
------
You have access to the following tools:
${tool.name} - ${tool.description} - for this tool input MUST be ${tool.inputDescription ?? "null"}\n`;
})
}
Use the following format in your response:
${THOUGHT_PREFIX} Do I need to use a tool? Yes
${ACTION_PREFIX} the action to take, should be one of [${tools.map((tool) => tool.name).join(",")}]
${ACTION_INPUT_PREFIX} the input to the action
${OBSERVATION_PREFIX} the result of the action
... (this Thought/Action/Action Input/Observation can repeat N times)
When you have a response for your task, or if you DO NOT need to use a tool, you MUST use the format:
${THOUGHT_PREFIX} Do I need to use a tool? No
${FINAL_ANSWER_PREFIX} the final answer to the original input question
Begin! Solve the following tasks as best you can. This is VERY important to you, your job depends on it!
`;
Tools were devised to interact neatly with the VM API, enabling data storage and retrieval, among other functionalities. Following this format pretty much any tool can be developed.
return [
{
name: "storeSet",
description: "Stores data",
inputDescription: "takes data to store as input",
callback: (data) => {
Storage.set("storage-manager", data);
return "Stored data in Local Storage";
},
},
{
name: "storeGet",
description: "Retrieves data",
callback: () => {
const data = Storage.get("storage-manager");
return "Data retrieved. Value: " + data;
},
},
];
Integration with other components was facilitated through widgets, allowing for an intuitive and efficient user experience.
const tools = VM.require("microchipgnu.near/widget/Tool")
return (
<Widget
src="microchipgnu.near/widget/Agent"
props={{
role: "Article Writer",
backstory: "Passionate about nature and wildlife, this agent leverages its vast database of animal facts and sophisticated language models to create engaging and informative articles about animals.",
goal: "To educate and inspire readers about the diversity and beauty of the animal kingdom through well-researched and captivating articles.",
tools: tools
}}
/>
)
Challenges
I am not 100% happy with the results. I think more work needs to be done on tools execution and finding a balance of when the agent should stop operating (when achieving a goal for example).
Also I believe certain models work better with the main prompt than others. More work could've been done here.
Other issues I had were the regex parsing of the LLM response, managing the performance discrepancies across different models, handling async/await in the BOS component, and the lack of access to libraries like Langchain.
Accomplishments
The creation of a MRKL agent from scratch. This project has not only allowed me to push the boundaries of what's possible with web3 native autonomous agents but has also provided us with invaluable learning experiences.
Next Steps
- Integrating with the new BOS web engine,
- Enabling cross-agent communication,
- Exploring asynchronous tool execution,
- Improving the issues mentioned the Challenges section above.
These developments promise to enhance the capabilities of our agents further and open up new avenues for autonomous operation and interaction.
Built With
- autonomous-agents
- blockchain
- bos
- javascript
- llama
- llm
- near-protocol
- ollama
- openai
Log in or sign up for Devpost to join the conversation.