mindloop-gemini
v1.0.1
Published
MindLoop — agent orchestration (tools + structured output)
Downloads
112
Maintainers
Readme
🧠 mindloop-gemini
MindLoop Gemini — a lightweight, type-safe framework for building AI agents with Google's Gemini models.
Core orchestration for Gemini agentic workflows — handling tools, memory, and structured outputs.
✨ Features
- ⚙️ Gemini Native — built specifically for
@google/genai - 🧩 Tool System — define reusable tools using
FunctionDeclarationfrom GenAI SDK - 💾 Memory System — simple
InMemoryorFileMemoryconversation storage - 🧱 Extensible Design — perfect for building your own agent SDKs or frameworks
- 📦 Minimal dependencies
🚀 Installation
npm install mindloop-gemini @google/genai zod
# or
yarn add mindloop-gemini @google/genai zod🧰 Quick Example
import { Agent, InMemory, MindLoopTool } from "mindloop-gemini";
import { Type } from "@google/genai";
const tools: MindLoopTool[] = [
{
handler: async ({ city }) => {
// Your tool logic here
return {
success: true,
data: `It's sunny in ${city}`,
error: undefined,
};
},
declaration: {
name: "getWeather",
description: "Returns a weather summary for a city",
parameters: {
type: Type.OBJECT,
properties: {
city: {
type: Type.STRING,
description: "The city to get weather for",
},
},
required: ["city"],
},
},
},
];
const agent = new Agent({
apiKey: process.env.GEMINI_API_KEY!,
tools,
memory: new InMemory(),
model: "gemini-2.5-flash",
verbose: true,
});
const response = await agent.run("What's the weather in Tokyo?");
console.log(response);🧩 Memory Options
| Type | Description | Example |
| ------------ | --------------------------------------------- | -------------------------------------------- |
| InMemory | Keeps messages in memory (cleared on restart) | new InMemory() |
| FileMemory | Persists messages to a JSONL file | new FileMemory({ filePath: "chat.jsonl" }) |
📜 License
MIT License © 2025 Tanmay Vaij
