A modular LLM Agent framework based on @ai-zen/agents-core.
This project uses pnpm workspace with the following sub-packages:
| Package | Description |
|---|---|
@ai-zen/agents-core |
Core framework — Agent, Messages, Tools, Models, Endpoints, RAG, Vector Database |
@ai-zen/agents-sdk |
SDK — Shared business logic (capabilities, permissions, MCP, plugins) |
These projects were previously part of this monorepo and have been migrated to their own repositories:
| Package | Repository | Description |
|---|---|---|
@ai-zen/cli |
git@github.com:ai-zen/cli.git |
CLI — Interactive conversation terminal with file tools, MCP support, and draft recovery (formerly @ai-zen/agents-cli) |
| Web UI | — | 已停止维护 |
- Node.js 18+
- pnpm 8.0.0+ (or run
corepack enable)
git clone <your-repo-url>
cd agents
pnpm installpnpm build-coreTypeScript core library for Node.js and browser environments.
Core Classes:
| Class | Description |
|---|---|
| Agent | Conversation lifecycle management with streaming, tool calls, events, onInnerLoopStart/onInnerLoopEnd hooks |
| AgentContext | Base context class holding model, messages, tools, rag configuration |
| Message | Message model supporting text/image multimodal content |
| Tool | Abstract base class for tools |
| CallbackTool | Quick tool definition via callback function |
| CodeTool | Tool logic defined as string code (via new Function) |
| AgentTool | Expose a sub-Agent as a tool |
| IndexedSearchTool | Keyword-based local search tool |
| Endpoint | API endpoint abstraction (OpenAI / Azure OpenAI / ZhipuAI / Generic) |
| ChatCompletionModel | Chat completion model abstraction |
| EmbeddingModel | Embedding model abstraction |
| ImageGenerationModel | Image generation model abstraction |
| Rag | Retrieval-Augmented Generation base class |
| VectorDatabase | In-memory vector database with cosine similarity |
| KnowledgeBase | Knowledge base (embedding model + vector database) |
| FunctionCallContext | Function call parameter parsing with preventDefault() |
Built-in Implementations:
- Models:
ChatGPT(OpenAI-compatible),TextEmbeddingAda002_2,ZhipuImage - Endpoints:
OpenAI,AzureOpenAI,Zhipu(deprecated),CommonEndpoint - RAG:
EmbeddingSearch
SDK layer built on top of @ai-zen/agents-core, providing shared business logic for CLI and Desktop applications:
- Capabilities — Three-phase tool assembly (discovery, filtering, instantiation) with permission model
- Built-in Tools — All tools are classes (
SdkCallbackTool), instantiated per-Provider withToolEnv(cwd+ config) injection; relative paths resolve againstProvider.cwd, no globalprocess.cwd()dependency - MCP — Full connection lifecycle management (connect, reconnect, OAuth, idle timeout)
- Skill — Discovery, frontmatter parsing, lazy loading
- Plugins — autoMigrate, autoRefreshTools
- Provider — Global context with config, paths (incl. per-workspace
cwd), and model factory
| Command | Description |
|---|---|
pnpm build-core |
Build @ai-zen/agents-core |
pnpm build-sdk |
Build @ai-zen/agents-sdk |
pnpm test |
Run all tests (core + sdk) |
pnpm --filter @ai-zen/agents-core test |
Run core tests only |
pnpm --filter @ai-zen/agents-sdk test |
Run SDK tests only |
MIT. See LICENSE.