Improve README: clearer intro, fewer code walls, contributing section

This commit is contained in:
JackChen 2026-04-01 13:04:40 +08:00
parent 6cbc5582fe
commit 3b24b99056
1 changed files with 34 additions and 32 deletions

View File

@ -1,25 +1,19 @@
# Open Multi-Agent # Open Multi-Agent
Open Multi-Agent is an open-source multi-agent orchestration framework. Build autonomous AI agent teams that can collaborate, communicate, schedule tasks with dependencies, and execute complex multi-step workflows — all model-agnostic. Build AI agent teams that work together. One agent plans, another implements, a third reviews — the framework handles task scheduling, dependencies, and communication automatically.
Unlike single-agent SDKs like `@anthropic-ai/claude-agent-sdk` which run one agent per process, Open Multi-Agent orchestrates **multiple specialized agents** working together in-process — deploy anywhere: cloud servers, serverless functions, Docker containers, CI/CD pipelines.
[![npm version](https://img.shields.io/npm/v/open-multi-agent)](https://www.npmjs.com/package/open-multi-agent) [![npm version](https://img.shields.io/npm/v/open-multi-agent)](https://www.npmjs.com/package/open-multi-agent)
[![npm downloads](https://img.shields.io/npm/dm/open-multi-agent)](https://www.npmjs.com/package/open-multi-agent)
[![GitHub stars](https://img.shields.io/github/stars/JackChen-me/open-multi-agent)](https://github.com/JackChen-me/open-multi-agent/stargazers)
[![license](https://img.shields.io/npm/l/open-multi-agent)](./LICENSE) [![license](https://img.shields.io/npm/l/open-multi-agent)](./LICENSE)
[![TypeScript](https://img.shields.io/badge/TypeScript-5.6-blue)](https://www.typescriptlang.org/) [![TypeScript](https://img.shields.io/badge/TypeScript-5.6-blue)](https://www.typescriptlang.org/)
## Features ## Why Open Multi-Agent?
- **Multi-Agent Teams** — Create teams of specialized agents that collaborate toward a shared goal - **Multi-Agent Teams** — Define agents with different roles, tools, and even different models. They collaborate through a message bus and shared memory.
- **Automatic Orchestration** — Describe a goal in plain English; the framework decomposes it into tasks and assigns them - **Task DAG Scheduling** — Tasks have dependencies. The framework resolves them topologically — dependent tasks wait, independent tasks run in parallel.
- **Task Dependencies** — Define tasks with `dependsOn` chains; the `TaskQueue` resolves them topologically - **Model Agnostic** — Claude and GPT in the same team. Swap models per agent. Bring your own adapter for any LLM.
- **Inter-Agent Communication** — Agents message each other via `MessageBus` and share knowledge through `SharedMemory` - **In-Process Execution** — No subprocess overhead. Everything runs in one Node.js process. Deploy to serverless, Docker, CI/CD.
- **Model Agnostic** — Works with Anthropic Claude, OpenAI GPT, or any custom `LLMAdapter`
- **Tool Framework** — Define custom tools with Zod schemas, or use 5 built-in tools (bash, file_read, file_write, file_edit, grep)
- **Parallel Execution** — Independent tasks run concurrently with configurable `maxConcurrency`
- **4 Scheduling Strategies** — Round-robin, least-busy, capability-match, dependency-first
- **Streaming** — Stream incremental text deltas from any agent via `AsyncGenerator<StreamEvent>`
- **Full Type Safety** — Strict TypeScript with Zod validation throughout
## Quick Start ## Quick Start
@ -27,6 +21,8 @@ Unlike single-agent SDKs like `@anthropic-ai/claude-agent-sdk` which run one age
npm install open-multi-agent npm install open-multi-agent
``` ```
Set `ANTHROPIC_API_KEY` (and optionally `OPENAI_API_KEY`) in your environment.
```typescript ```typescript
import { OpenMultiAgent } from 'open-multi-agent' import { OpenMultiAgent } from 'open-multi-agent'
@ -45,11 +41,9 @@ const result = await orchestrator.runAgent(
console.log(result.output) console.log(result.output)
``` ```
Set `ANTHROPIC_API_KEY` (and optionally `OPENAI_API_KEY`) in your environment before running. ## Multi-Agent Team
## Usage This is where it gets interesting. Three agents, one goal:
### Multi-Agent Team
```typescript ```typescript
import { OpenMultiAgent } from 'open-multi-agent' import { OpenMultiAgent } from 'open-multi-agent'
@ -94,9 +88,10 @@ console.log(`Success: ${result.success}`)
console.log(`Tokens: ${result.totalTokenUsage.output_tokens} output tokens`) console.log(`Tokens: ${result.totalTokenUsage.output_tokens} output tokens`)
``` ```
### Task Pipeline ## More Examples
Use `runTasks()` when you want explicit control over the task graph and assignments: <details>
<summary><b>Task Pipeline</b> — explicit control over task graph and assignments</summary>
```typescript ```typescript
const result = await orchestrator.runTasks(team, [ const result = await orchestrator.runTasks(team, [
@ -126,7 +121,10 @@ const result = await orchestrator.runTasks(team, [
]) ])
``` ```
### Custom Tools </details>
<details>
<summary><b>Custom Tools</b> — define tools with Zod schemas</summary>
```typescript ```typescript
import { z } from 'zod' import { z } from 'zod'
@ -159,7 +157,10 @@ const agent = new Agent(
const result = await agent.run('Find the three most recent TypeScript releases.') const result = await agent.run('Find the three most recent TypeScript releases.')
``` ```
### Multi-Model Teams </details>
<details>
<summary><b>Multi-Model Teams</b> — mix Claude and GPT in one workflow</summary>
```typescript ```typescript
const claudeAgent: AgentConfig = { const claudeAgent: AgentConfig = {
@ -187,7 +188,10 @@ const team = orchestrator.createTeam('mixed-team', {
const result = await orchestrator.runTeam(team, 'Build a CLI tool that converts JSON to CSV.') const result = await orchestrator.runTeam(team, 'Build a CLI tool that converts JSON to CSV.')
``` ```
### Streaming Output </details>
<details>
<summary><b>Streaming Output</b></summary>
```typescript ```typescript
import { Agent, ToolRegistry, ToolExecutor, registerBuiltInTools } from 'open-multi-agent' import { Agent, ToolRegistry, ToolExecutor, registerBuiltInTools } from 'open-multi-agent'
@ -209,6 +213,8 @@ for await (const event of agent.stream('Explain monads in two sentences.')) {
} }
``` ```
</details>
## Architecture ## Architecture
``` ```
@ -259,17 +265,13 @@ for await (const event of agent.stream('Explain monads in two sentences.')) {
| `file_edit` | Edit a file by replacing an exact string match. | | `file_edit` | Edit a file by replacing an exact string match. |
| `grep` | Search file contents with regex. Uses ripgrep when available, falls back to Node.js. | | `grep` | Search file contents with regex. Uses ripgrep when available, falls back to Node.js. |
## Design Inspiration ## Contributing
The architecture draws from common multi-agent orchestration patterns seen in modern AI coding tools. Issues, feature requests, and PRs are welcome. Some areas where contributions would be especially valuable:
| Pattern | open-multi-agent | What it does | - **LLM Adapters** — Ollama, llama.cpp, vLLM, Gemini. The `LLMAdapter` interface requires just two methods: `chat()` and `stream()`.
|---------|-----------------|--------------| - **Examples** — Real-world workflows and use cases.
| Conversation loop | `AgentRunner` | Drives the model → tool → model turn loop | - **Documentation** — Guides, tutorials, and API docs.
| Tool definition | `defineTool()` | Typed tool definition with Zod validation |
| Coordinator | `OpenMultiAgent` | Decomposes goals, assigns tasks, manages concurrency |
| Team / sub-agent | `Team` + `MessageBus` | Inter-agent communication and shared state |
| Task scheduling | `TaskQueue` | Topological task scheduling with dependency resolution |
## Star History ## Star History