[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-82747":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":15,"forks30d":15,"starsTrendScore":19,"compositeScore":20,"rankGlobal":9,"rankLanguage":9,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":24,"hasPages":22,"topics":25,"createdAt":9,"pushedAt":9,"updatedAt":26,"readmeContent":27,"aiSummary":28,"trendingCount":15,"starSnapshotCount":15,"syncStatus":14,"lastSyncTime":29,"discoverSource":30},82747,"Pi-Multi-Agent","jwangkun\u002FPi-Multi-Agent","jwangkun","Production-Grade Multi-Agent Orchestration Framework",null,"TypeScript",97,19,51,2,0,1,22,42,7,61.1,"MIT License",false,"main",true,[],"2026-06-12 04:01:38","# π Multi-Agent\n\n**Production-Grade Multi-Agent Orchestration Framework**\n\n[![MIT License](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLicense-MIT-blue.svg)](LICENSE)\n[![TypeScript](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FTypeScript-5.3+-3178C6.svg)](https:\u002F\u002Fwww.typescriptlang.org\u002F)\n[![Node.js](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FNode.js-18+-339933.svg)](https:\u002F\u002Fnodejs.org\u002F)\n[![npm](https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fv\u002Fpi-multi-agent.svg)](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Fpi-multi-agent)\n[![GitHub stars](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002Fpi-multi-agent\u002Fpi-multi-agent?style=flat)](https:\u002F\u002Fgithub.com\u002Fpi-multi-agent\u002Fpi-multi-agent\u002Fstargazers)\n[![Contributions welcome](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fcontributions-welcome-brightgreen.svg)](CONTRIBUTING.md)\n\n[Features](#features) · [Quick Start](#quick-start) · [Architecture](#architecture) · [Collaboration Patterns](#6-collaboration-patterns) · [API Reference](#api-reference) · [Web Dashboard](#web-dashboard) · [Contributing](#contributing)\n\n---\n\n## Overview\n\nπ Multi-Agent is a TypeScript framework for building production-grade multi-agent systems. It provides **6 collaboration patterns**, **6 communication structures**, **LLM-powered deep planning**, **agent cluster execution with real tool calling**, and a **real-time web dashboard**.\n\nUnlike simple prompt-chaining libraries, π Multi-Agent implements the full agent lifecycle: **Goal → Plan → Execute → Evaluate → Replan → Output**, with real LLM function calling, inter-agent memory sharing, and iterative quality improvement.\n\n## Screenshots\n\n\u003Ctable align=\"center\">\n  \u003Ctr>\n    \u003Ctd>\u003Cimg src=\"demo.png\" alt=\"Pi Multi-Agent Dashboard\" width=\"400\" \u002F>\u003C\u002Ftd>\n    \u003Ctd>\u003Cimg src=\"demo1.png\" alt=\"Pi Multi-Agent Deep Research\" width=\"400\" \u002F>\u003C\u002Ftd>\n  \u003C\u002Ftr>\n\u003C\u002Ftable>\n\n## Features\n\n- **6 Collaboration Patterns** — Sequential, Parallel, Debate & Consensus, Expert Team, Critic-Reviewer, Hierarchical\n- **6 Communication Structures** — Single Agent, Network, Supervisor, Supervisor as Tool, Hierarchical, Custom\n- **LLM-Powered Deep Planning** — Intelligent task decomposition with dependency graphs and quality thresholds\n- **Agent Cluster Execution** — 10+ sub-agents with real tool calling (web search, data analysis, code execution)\n- **Iterative Quality Loop** — Multi-dimensional evaluation → replan → retry until quality threshold met\n- **Enhanced Shared Memory** — Inter-agent data passing, session context, output sharing\n- **Real-Time Dashboard** — WebSocket-powered UI with agent status, tool calls, progress tracking\n- **Type-Safe** — Full TypeScript with strict mode, zero `any` escapes in public API\n\n## Architecture\n\n```\n┌─────────────────────────────────────────────────────────────────────┐\n│                         π Multi-Agent                               │\n├─────────────────────────────────────────────────────────────────────┤\n│                                                                     │\n│  ┌──────────────┐  ┌──────────────┐  ┌──────────────────────────┐  │\n│  │ Deep Planner │  │   Agent      │  │    Deep Evaluator        │  │\n│  │ LLM-Driven   │  │  Cluster     │  │  4-Dimension Assessment  │  │\n│  │ Task Decomp. │  │  Execution   │  │  + Reflection + Replan   │  │\n│  └──────────────┘  └──────────────┘  └──────────────────────────┘  │\n│                                                                     │\n│  ┌──────────────────────────────────────────────────────────────┐   │\n│  │                  Enhanced Shared Memory                      │   │\n│  │  ┌────────────┐  ┌────────────┐  ┌──────────────────────┐   │   │\n│  │  │  Agent      │  │  Session   │  │   Inter-Agent        │   │   │\n│  │  │  Outputs    │  │  Context   │  │   Messaging          │   │   │\n│  │  └────────────┘  └────────────┘  └──────────────────────┘   │   │\n│  └──────────────────────────────────────────────────────────────┘   │\n│                                                                     │\n│  ┌──────────────────────────────────────────────────────────────┐   │\n│  │                   6 Collaboration Patterns                   │   │\n│  │  Sequential │ Parallel │ Debate │ Expert │ Critic │ Hier.   │   │\n│  └──────────────────────────────────────────────────────────────┘   │\n│                                                                     │\n│  ┌──────────────────────────────────────────────────────────────┐   │\n│  │                   Tool System (Function Calling)              │   │\n│  │  web_search │ data_analyzer │ web_scraper │ code_executor    │   │\n│  │  report_writer │ knowledge_base │ calculator │ agent_delegate│   │\n│  └──────────────────────────────────────────────────────────────┘   │\n│                                                                     │\n│  ┌──────────────────────────────────────────────────────────────┐   │\n│  │                   6 Communication Structures                  │   │\n│  │  Single │ Network │ Supervisor │ AsTool │ Hier. │ Custom     │   │\n│  └──────────────────────────────────────────────────────────────┘   │\n│                                                                     │\n└─────────────────────────────────────────────────────────────────────┘\n```\n\n## 8-Step Execution Lifecycle\n\n```\n[User Goal] → 1. Goal Definition\n             → 2. Deep Planner (LLM-driven task decomposition)\n             → 3. Agent Cluster (spawn 10+ specialized agents)\n             → 4. Tool Calling (web search, data analysis, etc.)\n             → 5. Shared Memory (inter-agent data passing)\n             → 6. Deep Evaluator (4-dimension quality assessment)\n             → 7. Replan\u002FRetry (if quality \u003C threshold)\n             → 8. Final Output (synthesized report)\n```\n\n## Quick Start\n\n### Installation\n\n```bash\nnpm install pi-multi-agent\n```\n\n### Prerequisites\n\n- Node.js 18+\n- A DeepSeek API key (or OpenAI-compatible endpoint)\n\n### 1. Deep Research (Agent Cluster)\n\n```typescript\nimport { DeepPlanner, AgentCluster } from 'pi-multi-agent';\n\nconst planner = new DeepPlanner(process.env.DEEPSEEK_API_KEY);\nconst plan = await planner.createDeepPlan(\n  'Complete a comprehensive AI Agent market research report',\n  { targetWordCount: 30000, maxAgents: 8 }\n);\n\nconst cluster = new AgentCluster(process.env.DEEPSEEK_API_KEY, 'session-1');\n\ncluster.onEvent((event) => {\n  console.log(`[${event.type}] ${event.agentName}:`, event.data);\n});\n\nconst result = await cluster.executePlan(plan, 3);\nconsole.log(`Report: ${result.finalOutput.length} chars, Score: ${result.evaluationScore}`);\n```\n\n### 2. Collaboration Modes\n\n```typescript\nimport { LLMAgentCollaboration } from 'pi-multi-agent';\n\nconst collab = new LLMAgentCollaboration(process.env.DEEPSEEK_API_KEY);\n\nconst agents = [\n  { id: 'researcher', name: 'Researcher', type: 'researcher',\n    systemPrompt: 'You are a market research expert.' },\n  { id: 'analyst', name: 'Analyst', type: 'analyst',\n    systemPrompt: 'You are a data analysis expert.' },\n  { id: 'writer', name: 'Writer', type: 'writer',\n    systemPrompt: 'You are a professional report writer.' },\n];\n\n\u002F\u002F Sequential: Researcher → Analyst → Writer\nconst seqResult = await collab.executeSequential(agents, 'Analyze AI market trends');\n\n\u002F\u002F Parallel: All agents work simultaneously\nconst parResult = await collab.executeParallel(agents, 'Multi-perspective analysis');\n\n\u002F\u002F Expert Team: Domain specialists + integrator\nconst expResult = await collab.executeExpertTeam(\n  agents.map(a => ({ ...a, specialty: a.type })),\n  'Comprehensive report'\n);\n\n\u002F\u002F Debate: Multi-round discussion for consensus\nconst debResult = await collab.executeDebate(agents, 'Investment strategy', 3);\n\n\u002F\u002F Hierarchical: Supervisor → Subordinates → Synthesize\nconst hierResult = await collab.executeHierarchical(agents[0], agents.slice(1), task);\n\n\u002F\u002F Critic-Reviewer: Create → Review → Iterate\nconst critResult = await collab.executeCriticReviewer(agents[0], agents[1], task, 2);\n```\n\n### 3. Core Agent API\n\n```typescript\nimport { Agent, SequentialHandoffs, AgentContext } from 'pi-multi-agent';\n\nconst researcher = new Agent({\n  name: 'Researcher',\n  systemPrompt: 'You are a research expert.',\n  model: { provider: 'openai', model: 'gpt-4' },\n}, myExecutor);\n\nconst analyst = new Agent({\n  name: 'Analyst',\n  systemPrompt: 'You are a data analyst.',\n  model: { provider: 'openai', model: 'gpt-4' },\n}, myExecutor);\n\nconst workflow = new SequentialHandoffs([researcher, analyst], context);\nconst result = await workflow.execute('Research AI trends and analyze findings');\n```\n\n## 6 Collaboration Patterns\n\n| Pattern | Description | Best For |\n|---------|-------------|----------|\n| **Sequential Handoffs** | Pipeline: Agent A → B → C | Structured workflows with clear stages |\n| **Parallel Processing** | All agents work simultaneously | Independent multi-perspective tasks |\n| **Debate & Consensus** | Multi-round discussion + moderator | Decision-making, strategy, consensus |\n| **Expert Team** | Domain specialists + integrator | Complex multi-domain tasks |\n| **Critic-Reviewer** | Create → Review → Iterate | Quality-critical content generation |\n| **Hierarchical** | Supervisor → Subordinates → Synthesize | Large-scale task decomposition |\n\n## 6 Communication Structures\n\n| Structure | Description |\n|-----------|-------------|\n| **Single Agent** | Standalone execution, no inter-agent communication |\n| **Network** | Decentralized peer-to-peer topology |\n| **Supervisor** | Centralized management with task distribution |\n| **Supervisor as Tool** | Advisory pattern, agents consult supervisor |\n| **Hierarchical** | Multi-level management tree |\n| **Custom** | User-defined topology and routing |\n\n## Tool System\n\nAgents can call real tools via LLM function calling:\n\n| Tool | Description |\n|------|-------------|\n| `web_search` | Search the internet for information (DuckDuckGo API) |\n| `data_analyzer` | Analyze data and generate statistical insights |\n| `web_scraper` | Extract content from web pages |\n| `code_executor` | Execute code snippets and return results |\n| `report_writer` | Structure and format report content |\n| `knowledge_base` | Query and retrieve from knowledge base |\n| `calculator` | Perform mathematical calculations |\n| `agent_delegate` | Delegate subtasks to other agents (Agent-as-Tool) |\n\nTools are automatically assigned based on agent type:\n\n```typescript\n\u002F\u002F Researcher agents get: web_search, web_scraper, knowledge_base\n\u002F\u002F Analyst agents get: data_analyzer, calculator, knowledge_base\n\u002F\u002F Writer agents get: report_writer\n\u002F\u002F Coder agents get: code_executor, web_scraper\n```\n\n## Deep Evaluator\n\nThe evaluator assesses output across 4 dimensions:\n\n1. **Accuracy** — Factual correctness and data validity\n2. **Completeness** — Coverage of required topics and depth\n3. **Consistency** — Logical coherence and internal consistency\n4. **Format** — Structure, readability, and professional formatting\n\nIf the evaluation score falls below the threshold, the system automatically replans and retries.\n\n## Web Dashboard\n\nThe included Next.js dashboard provides real-time visualization:\n\n```bash\n# Terminal 1: Start the backend server\nDEEPSEEK_API_KEY=your-key npm run server\n\n# Terminal 2: Start the web dashboard\ncd web && npm run dev\n```\n\nFeatures:\n\n- **Agent Cluster Panel** — View all agents, their status, and progress\n- **Real-Time Chat** — Submit tasks and see agent responses live\n- **Plan Visualization** — Inspect the deep plan and subtask breakdown\n- **Tool Call Tracking** — See every tool call with input\u002Foutput\u002Fduration\n- **Evaluation Dashboard** — Quality scores with dimension breakdown\n- **Report Viewer** — Read and download the final output (Markdown \u002F HTML \u002F TXT)\n\n## Project Structure\n\n```\npi-multi-agent\u002F\n├── src\u002F\n│   ├── core\u002F                    # Agent base, types, errors\n│   │   ├── agent.ts             # Agent lifecycle & execution\n│   │   ├── types.ts             # TypeScript type definitions\n│   │   ├── errors.ts            # Custom error hierarchy\n│   │   └── message.ts           # Message types\n│   ├── orchestration\u002F           # Planning, execution, evaluation\n│   │   ├── deep-planner.ts      # LLM-driven task decomposition\n│   │   ├── agent-cluster.ts     # Cluster execution engine\n│   │   ├── deep-evaluator.ts    # 4-dimension quality assessment\n│   │   ├── orchestrator.ts      # Task scheduling\n│   │   ├── planner.ts           # Basic planning\n│   │   └── evaluator.ts         # Basic evaluation\n│   ├── collaboration\u002F           # 6 collaboration patterns\n│   │   ├── patterns.ts          # Core pattern implementations\n│   │   └── llm-collaboration.ts # LLM-powered collaboration\n│   ├── communication\u002F           # 6 communication structures\n│   │   └── structures.ts        # Topology implementations\n│   ├── memory\u002F                  # Memory management\n│   │   ├── memory.ts            # Short-term + long-term memory\n│   │   └── enhanced-shared-memory.ts  # Inter-agent shared memory\n│   └── tools\u002F                   # Tool system\n│       ├── index.ts             # 7 core tools + agent-as-tool\n│       └── agent-as-tool.ts     # Agent delegation tool\n├── server\u002F                      # Backend API server\n│   └── index.ts                 # Express + WebSocket server\n├── web\u002F                         # Next.js dashboard\n│   └── src\u002Fapp\u002Fpage.tsx         # Real-time dashboard UI\n├── examples\u002F                    # Usage examples\n│   ├── deep-research.ts         # Deep research example\n│   └── collaboration-modes.ts   # All 6 collaboration modes\n└── package.json\n```\n\n## API Reference\n\n### DeepPlanner\n\n```typescript\nconst planner = new DeepPlanner(apiKey, baseURL?);\nconst plan = await planner.createDeepPlan(goal, options?);\n\u002F\u002F options: { targetWordCount?: number, maxAgents?: number, depth?: number }\n```\n\n### AgentCluster\n\n```typescript\nconst cluster = new AgentCluster(apiKey, sessionId, baseURL?);\ncluster.onEvent(callback);  \u002F\u002F Subscribe to events\nconst result = await cluster.executePlan(plan, maxIterations?);\n```\n\n### LLMAgentCollaboration\n\n```typescript\nconst collab = new LLMAgentCollaboration(apiKey, baseURL?);\nawait collab.executeSequential(agents, task);\nawait collab.executeParallel(agents, task);\nawait collab.executeDebate(agents, topic, maxRounds?);\nawait collab.executeHierarchical(supervisor, subordinates, task);\nawait collab.executeExpertTeam(experts, task);\nawait collab.executeCriticReviewer(creator, critic, task, maxRounds?);\n```\n\n### EnhancedSharedMemory\n\n```typescript\nconst memory = new EnhancedSharedMemory(sessionId);\nmemory.setGoal(goal);\nmemory.registerAgent(agentId, name, type);\nmemory.storeAgentOutput(taskId, output);\nmemory.sendMessage({ fromAgentId, toAgentId, type, content });\nconst context = memory.buildContextForAgent(agentId);\n```\n\n## Environment Variables\n\n| Variable | Required | Description |\n|----------|----------|-------------|\n| `DEEPSEEK_API_KEY` | Yes | DeepSeek API key for LLM calls |\n| `PORT` | No | Server port (default: 3001) |\n\n## Development\n\n```bash\n# Install dependencies\nnpm install\n\n# Build the framework\nnpm run build\n\n# Run type checking\nnpm run typecheck\n\n# Run tests\nnpm run test\n\n# Start development watch mode\nnpm run dev\n```\n\n## Contributing\n\nWe welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details on:\n- Development setup\n- Pull request process\n- Coding standards\n- Testing guidelines\n\n## Community\n\nJoin our community and stay connected:\n\n- **B 站 (Bilibili)** — AI 技术深度解析与实战教程\n- **视频号 (WeChat Video)** — AI 前沿动态与产品评测\n- **公众号 (WeChat Official Account)** — AI 技术文章与行业洞察\n- **YouTube** — AI tutorials and open-source project walkthroughs\n\n## Code of Conduct\n\nThis project adheres to a [Code of Conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code.\n\n## Acknowledgments\n\n- Built with [TypeScript](https:\u002F\u002Fwww.typescriptlang.org\u002F)\n- Powered by [DeepSeek](https:\u002F\u002Fwww.deepseek.com\u002F) and OpenAI-compatible LLMs\n- Dashboard built with [Next.js](https:\u002F\u002Fnextjs.org\u002F)\n- Community support from 鲲鹏 Talk\n\n---\n\n**π Multi-Agent** is an open-source project by **鲲鹏 Talk**.\n\n鲲鹏 Talk is a tech community focused on AI, sharing cutting-edge insights, tutorials, and open-source projects across multiple platforms.\n\n## License\n\n[MIT](LICENSE) © Pi Multi-Agent Contributors\n","π Multi-Agent 是一个用于构建生产级多代理系统的TypeScript框架。它提供了6种协作模式、6种通信结构、基于LLM的深度规划、具有真实工具调用功能的代理集群执行以及实时Web仪表板等核心功能。项目支持从目标设定到计划执行再到评估重规划的完整代理生命周期，通过智能任务分解与依赖图来实现高效的任务处理，并允许代理间共享记忆以提高迭代质量。适用于需要复杂协调和自动化决策过程的应用场景，如大规模数据分析、智能客服系统开发或自动化的软件测试环境搭建等。","2026-06-11 04:09:07","CREATED_QUERY"]