foliko
v1.0.7
Published
简约的插件化 Agent 框架
Readme
Foliko
简约的插件化 Agent 框架
特性
- 插件化架构 - 核心简单,通过插件扩展功能
- 流式输出 - 支持实时流式输出
- 多 AI 支持 - 支持 Anthropic、DeepSeek、MiniMax 等
- 内置工具 - Shell、Python、MCP、文件系统等
- 技能系统 - 可扩展的 Skill 管理
- 会话管理 - 支持多会话切换
- 规则引擎 - 可配置的行为规则
快速开始
# 安装
npm install
# 启动聊天
npm run chat项目结构
vb-agent/
├── cli/ # 命令行入口
│ └── bin/foliko.js # CLI 入口
├── src/ # 核心框架
│ ├── core/ # 核心组件
│ ├── capabilities/ # 能力插件
│ └── executors/ # 执行器
├── plugins/ # 内置插件
├── skills/ # 技能目录
└── examples/ # 示例配置
在项目根目录创建 .agent 目录:
.agent/
├── config # 配置文件
├── ai.json # AI 配置
├── mcp_config.json # MCP 服务器配置
├── plugins/ # 用户插件目录
├── skills/ # 用户技能目录
└── data/ # 数据目录config 文件格式
ai_key: your-api-key
ai_model: MiniMax-M2.7
ai_provider: minimaxai.json 格式
{
"provider": "minimax",
"model": "MiniMax-M2.7",
"apiKey": "your-api-key",
"baseURL": "https://api.minimaxi.com/v1"
}mcp_config.json 格式
{
"mcpServers": {
"fetch": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-fetch"]
}
}
}开发插件
用户插件(.agent/plugins/)
// .agent/plugins/my-plugin.js
module.exports = function(Plugin) {
return class MyPlugin extends Plugin {
constructor(config = {}) {
super()
this.name = 'my-plugin'
this.version = '1.0.0'
this.description = '我的工具插件'
this.priority = 10
}
install(framework) {
const { z } = require('zod')
framework.registerTool({
name: 'my_tool',
description: '我的工具',
inputSchema: z.object({
param: z.string().describe('参数描述')
}),
execute: async (args, framework) => {
return { success: true, result: args.param }
}
})
return this
}
}
}注意:如果插件需要第三方库(如 zod),需要先安装:
- 创建插件文件
- 调用
install工具安装依赖 - 热重载插件
技能开发
在 .agent/skills/ 下创建技能:
.agent/skills/my-skill/
└── SKILL.mdSKILL.md 格式:
---
name: my-skill
description: 技能描述
allowed-tools: tool1,tool2
---
技能内容...CLI 命令
# 聊天模式
foliko chat
# 指定模型
foliko chat --model gpt-4
# 指定 API
foliko chat --api-key xxx内置工具
| 工具 | 说明 |
|------|------|
| loadSkill | 加载技能 |
| mcp_execute | 执行 MCP 工具 |
| shell_execute | 执行 Shell 命令 |
| python_execute | 执行 Python 代码 |
| install | 安装 npm 包 |
| mcp_reload | 重载 MCP 服务器 |
| audit_query | 查询审计日志 |
工作目录
CLI 工作目录默认使用执行命令的目录。
许可证
MIT
