Getting Started
Prerequisites
Before you begin, ensure you have the following installed:
- Bun (opens in a new tab)
- Basic understanding of JSX
Installation
To get started with micro-agi
, you need to install the package in your project.
bun add micro-agi
micro-agi works seamlessly with AI.JSX (opens in a new tab), a framework for building AI applications using JavaScript and JSX. To take full advantage of micro-agi, make sure you have AI.JSX (opens in a new tab) installed in your project.
Creating an AI Agent Team
With micro-agi
, you can create a team of AI agents, each with specific roles and tasks.
The following example is taken from micro-agi-starter (opens in a new tab) repo. Feel free to clone it and run it against Ollama locally.
Here's a simple example to get you started:
/** @jsxImportSource ai-jsx */
import * as AI from "ai-jsx";
import Agent from "micro-agi/core/components/agent";
import Task from "micro-agi/core/components/task";
import Team from "micro-agi/core/components/team";
const App = async ({ topic }: { topic: string }) => {
return (
<Team process="sequential">
<Agent
agentType="mrkl"
role="Writer"
goal="Write articles about a topic"
backstory="You are a very experienced writer. You've written thousands of article in your career."
model="mistral"
provider="ollama"
>
<Task
onStart={async () => {
console.log("Started writing article about", topic);
}}
onDone={async () => {
console.log("Done writing article about", topic);
}}
>
Write an article about {topic}. Your result in markdown format.
</Task>
</Agent>
</Team>
);
};
const renderContext = AI.createRenderContext();
const result = await renderContext.render(<App topic="Apple" />);
await Bun.write(`./result.json`, result);