| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
A lightweight AI agent framework inspired by openclaw & nanobot, implemented with TypeScript + Node.js
# Using pnpm
pnpm add microbot
# Using npm
npm install microbot
# Using yarn
yarn add microbotTo use the microbot CLI command globally:
npm install -g .
# or
pnpm link --global# Start MicroBot
microbot start
# Check status
microbot status
# Help
microbot --helpCopy the default configuration:
cp .env.example .envMicroBot supports multiple AI model providers through a unified interface:
# Model Type: ollama, minimax, or openai
MODEL_TYPE=ollama
# For Ollama (Local Models)
OLLAMA_HOST=localhost
OLLAMA_PORT=11434
OLLAMA_PROTOCOL=http
OLLAMA_MODEL=qwen3-vl:8b
# For MiniMax (Cloud Models)
MODEL_NAME=MiniMax-M2.1
MODEL_API_KEY=your_minimax_api_key
MODEL_BASE_URL=https://api.minimaxi.com/v1
# For OpenAI-Compatible APIs
MODEL_NAME=gpt-4
MODEL_API_KEY=your_openai_api_key
MODEL_BASE_URL=https://api.openai.com/v1| Model Type | Description | Required Config |
|---|---|---|
| ollama | Local models via Ollama | OLLAMA_HOST, OLLAMA_PORT, OLLAMA_MODEL |
| minimax | MiniMax cloud models | MODEL_NAME, MODEL_API_KEY, MODEL_BASE_URL |
| openai | OpenAI-compatible APIs | MODEL_NAME, MODEL_API_KEY, MODEL_BASE_URL |
Create Feishu App
Configure App Features
Update Environment Variables
FEISHU_APP_ID=your_app_id
FEISHU_APP_SECRET=your_app_secretStart MicroBot
microbot startTest the Integration
import { MicroBot } from 'microbot';
// Create a bot instance
const bot = new MicroBot({
name: 'MyBot',
version: '1.0.0'
});
// Register custom tools
bot.registerTool('greet', {
description: 'Greet the user',
execute: (args) => {
return `Hello, ${args.name}!`;
}
});
// Start the bot
await bot.start();import { ModelFactory } from 'microbot';
// Create an Ollama client
const ollamaClient = ModelFactory.createClient({
type: 'ollama',
host: 'localhost',
port: 11434,
model: 'qwen3-vl:8b'
});
// Create a MiniMax client
const minimaxClient = ModelFactory.createClient({
type: 'minimax',
model: 'abab6.5-chat',
apiKey: 'your_api_key',
baseUrl: 'https://api.minimaxi.com/v1'
});
// Create an OpenAI-compatible client
const openaiClient = ModelFactory.createClient({
type: 'openai',
model: 'gpt-4',
apiKey: 'your_api_key',
baseUrl: 'https://api.openai.com/v1'
});
// Use the client
const response = await ollamaClient.chat({
messages: [{ role: 'user', content: 'Hello!' }]
});microbot/ ├── src/ # Source code │ ├── agent/ # AI agent core │ │ ├── tools/ # Tool registry │ │ ├── context.ts # Execution context │ │ ├── loop.ts # Agent loop with model integration │ │ ├── memory.ts # Memory management │ │ └── skills.ts # Agent skills │ ├── api/ # API clients │ │ ├── model.ts # Model interface definition │ │ ├── model-factory.ts # Model factory for creating clients │ │ ├── ollama-adapter.ts # Ollama client adapter │ │ ├── minimax.ts # MiniMax API client │ │ ├── openai-compatible.ts # OpenAI-compatible API client │ │ ├── feishu.ts # Feishu (Lark) integration with SDK │ │ └── websocket.ts # WebSocket server │ ├── session/ # Session management │ │ └── manager.ts # Session manager │ ├── utils/ # Utilities │ │ └── logger.ts # Logger │ └── index.ts # Main entry ├── dist/ # Build output ├── sessions/ # Session storage ├── .env # Environment configuration ├── microbot.mjs # CLI entry ├── package.json # Project config ├── tsconfig.json # TypeScript config └── README.md # This file
# Clone the repository
git clone <repository-url>
cd microbot
# Install dependencies
pnpm install# Development mode
pnpm dev
# Build for production
pnpm build
# Start production build
pnpm start
# Run linting
pnpm lint
# Format code
pnpm format
# Run tests
pnpm testclass MicroBot {
constructor(options: MicroBotOptions);
registerTool(name: string, tool: Tool);
start(): Promise<void>;
stop(): Promise<void>;
}interface Tool {
description: string;
execute: (args: Record<string, any>) => Promise<any> | any;
}interface ModelClient {
chat(request: ModelRequest): Promise<ModelResponse>;
stream(request: ModelRequest): AsyncIterable<StreamChunk>;
}interface ModelRequest {
messages: Message[];
model?: string;
stream?: boolean;
options?: {
temperature?: number;
max_tokens?: number;
};
}interface ModelResponse {
content: string;
model: string;
usage?: {
prompt_tokens: number;
completion_tokens: number;
total_tokens: number;
};
}The framework provides a unified interface for multiple AI providers:
All model clients implement the same ModelClient interface, making it easy to switch between providers.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
Happy Bot Building! 🤖
| Back | FazBrowse Home | New Git URL |