Sharing a new OSS project I’ve started called AgentM…
AgentM is a library of “Micro Agents” that make it easy to add reliable intelligence to any application. The philosophy behind AgentM is that “Agents” should be mostly comprised of deterministic code with a sprinkle of LLM powered intelligence mixed in. Many of the existing Agent frameworks place the LLM at the center of the application as an orchestrator that calls a collection of tools. In an AgentM application, your code is the orchestrator and you only call a micro agent when you need to perform a task that requires intelligence. To make adding this intelligence to your code easy, the JavaScript version of AgentM surfaces these micro agents as a simple library of functions. While the initial version is in JavaScript, if there’s enough interest I’ll create a Python version of AgentM as well.
To give you a small taste of what working with AgentM is like, here’s a small app that takes a randomized list of all the studio albums for the band Rush and first filters the list to only include albums from the 1980’s, then sorts the list to be in chronological order, and then maps the titles into a list of JSON objects contain the title plus a detailed description of each album:
import { openai, filterList, sortList, mapList } from "agentm";
import * as dotenv from "dotenv";
// Load environment variables from .env file
dotenv.config();
// Initialize OpenAI
const apiKey = process.env.apiKey!;
const model = 'gpt-4o-mini';
const completePrompt = openai({ apiKey, model });
// Create cancellation token
const shouldContinue = () => true;
// Create randomized list of rushes studio albums
const rushAlbums = [
"Grace Under Pressure",
"Hemispheres",
"Permanent Waves",
"Presto",
"Clockwork Angels",
"Roll the Bones",
"Signals",
"Rush",
"Power Windows",
"Fly by Night",
"A Farewell to Kings",
"2112",
"Snakes & Arrows",
"Test for Echo",
"Caress of Steel",
"Moving Pictures",
"Counterparts",
"Vapor Trails",
"Hold Your Fire"
];
// Define output shape
interface AlbumDetails {
title: string;
details: string;
}
const outputShape = { title: '<album title>', details: '<detailed summary of album including its release date>' };
// Filter and then sort list of albums chronologically
async function filterAndSortList() {
// Filter list to only include albums from the 80's
const parallelCompletions = 3;
const filterGoal = `Filter the list to only include rush albums released in the 1980's.`;
const filtered = await filterList({goal: filterGoal, list: rushAlbums, parallelCompletions, completePrompt, shouldContinue });
// Sort filtered list chronologically
const sortGoal = `Sort the list of rush studio albums chronologically from oldest to newest.`;
const sorted = await sortList({goal: sortGoal, list: filtered.value!, parallelCompletions, completePrompt, shouldContinue });
// Add in world knowledge
const detailsGoal = `Map the item to the output shape.`;
const details = await mapList<AlbumDetails>({goal: detailsGoal, list: sorted.value!, outputShape, parallelCompletions, completePrompt, shouldContinue });
// Print sorted list
details.value!.forEach((item) => console.log(`Title: ${item.title}\nDetails: ${item.details}\n`));
}
filterAndSortList();
The output of this app is:
Title: Permanent Waves
Details: Permanent Waves is the seventh studio album by the Canadian rock band Rush, released on January 1, 1980. The album features a blend of progressive rock and new wave influences, showcasing the band's evolving sound with tracks like 'Spirit of Radio' and 'Freewill'.
Title: Moving Pictures
Details: 'Moving Pictures' is the eighth studio album by the Canadian rock band Rush, released on February 12, 1981. The album features some of the band's most popular songs, including 'Tom Sawyer' and 'Limelight', and is known for its blend of progressive rock and mainstream appeal.
Title: Signals
Details: 'Signals' is the thirteenth studio album by the Canadian rock band Rush, released on September 9, 1982. The album features a blend of progressive rock and new wave influences, showcasing the band's evolution in sound during the early 1980s.
Title: Grace Under Pressure
Details: 'Grace Under Pressure' is the tenth studio album by the Canadian rock band Rush, released on April 12, 1984. The album features a blend of progressive rock and new wave influences, showcasing the band's evolution in sound during the 1980s. It includes notable tracks such as 'Distant Early Warning' and 'The Body Electric.'
Title: Power Windows
Details: Power Windows is the eleventh studio album by Canadian rock band Rush, released on October 29, 1985. The album features a blend of progressive rock and synthesizer-driven sound, showcasing the band's evolution in the 1980s.
Title: Hold Your Fire
Details: 'Hold Your Fire' is the twelfth studio album by the Canadian rock band Rush, released on September 21, 1987. The album features a blend of progressive rock and synthesizer-driven sound, showcasing the band's evolution in style during the late 1980s.
Title: Presto
Details: Presto is the thirteenth studio album by the Canadian rock band Rush, released on November 21, 1989. The album features a blend of progressive rock and more accessible pop elements, showcasing the band's evolution in sound during the late 1980s.
While this is definitely a toy example, hopefully you can see the power of what’s possible and the simplicity with which you cane leverage AgentM to perform complex tasks.
UPDATE:
You can install and try out Pulse, AgentM’s self modifying UI by following the instructions here: