network-ai 3.3.0 → 3.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,783 +1,783 @@
1
- # Network-AI: Multi-Agent Orchestration Framework
2
-
3
- **The plug-and-play AI agent orchestrator for TypeScript/Node.js -- connect 12 agent frameworks with zero glue code**
4
-
5
- [![CI](https://github.com/jovanSAPFIONEER/Network-AI/actions/workflows/ci.yml/badge.svg)](https://github.com/jovanSAPFIONEER/Network-AI/actions/workflows/ci.yml)
6
- [![CodeQL](https://github.com/jovanSAPFIONEER/Network-AI/actions/workflows/codeql.yml/badge.svg)](https://github.com/jovanSAPFIONEER/Network-AI/actions/workflows/codeql.yml)
7
- [![Release](https://img.shields.io/badge/release-v3.2.11-blue.svg)](https://github.com/jovanSAPFIONEER/Network-AI/releases)
8
- [![npm](https://img.shields.io/npm/dw/network-ai.svg?label=npm%20downloads)](https://www.npmjs.com/package/network-ai)
9
- [![ClawHub](https://img.shields.io/badge/ClawHub-network--ai-orange.svg)](https://clawhub.ai/skills/network-ai)
10
- [![Node.js](https://img.shields.io/badge/node-%3E%3D18.0.0-brightgreen.svg)](https://nodejs.org)
11
- [![TypeScript](https://img.shields.io/badge/TypeScript-5.x-3178C6.svg)](https://typescriptlang.org)
12
- [![Python](https://img.shields.io/badge/python-3.9+-green.svg)](https://python.org)
13
- [![License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](LICENSE)
14
- [![Socket](https://socket.dev/api/badge/npm/package/network-ai)](https://socket.dev/npm/package/network-ai/overview)
15
- [![AgentSkills](https://img.shields.io/badge/AgentSkills-compatible-orange.svg)](https://agentskills.io)
16
- [![Tests](https://img.shields.io/badge/tests-315%20passing-brightgreen.svg)](#testing)
17
- [![Adapters](https://img.shields.io/badge/frameworks-12%20supported-blueviolet.svg)](#adapter-system)
18
- [![RSS Feed](https://img.shields.io/badge/RSS-releases-orange?logo=rss)](https://github.com/jovanSAPFIONEER/Network-AI/releases.atom)
19
-
20
- > **Legacy Users:** This skill works with **Clawdbot** and **Moltbot** (now OpenClaw). If you're searching for *Moltbot Security*, *Clawdbot Swarm*, or *Moltbot multi-agent* -- you're in the right place!
21
-
22
- Network-AI is a framework-agnostic multi-agent orchestrator and **behavioral control plane** that connects LLM agents across **12 frameworks** -- LangChain, AutoGen, CrewAI, OpenAI Assistants, LlamaIndex, Semantic Kernel, Haystack, DSPy, Agno, MCP, OpenClaw, and custom adapters. It provides shared blackboard coordination with atomic commits, built-in security (AES-256, HMAC tokens, rate limiting), content quality gates with hallucination detection, compliance enforcement, and agentic workflow patterns (parallel fan-out/fan-in, voting, chaining). Zero dependencies per adapter -- bring your own framework SDK and start building governed multi-agent systems in minutes.
23
-
24
- **Why Network-AI?**
25
- - **Framework-agnostic** -- Not locked to one LLM provider or agent SDK
26
- - **Governance layer** -- Permission gating, audit trails, budget ceilings, and compliance enforcement across all agents
27
- - **Shared state** -- Atomic blackboard with conflict resolution for safe parallel agent coordination (fan-out/fan-in)
28
- - **Production security** -- AES-256 encryption, HMAC audit logs, rate limiting, input sanitization
29
- - **Zero config** -- Works out of the box with `createSwarmOrchestrator()`
30
-
31
- ## Hello World -- Get Running in 60 Seconds
32
-
33
- ```typescript
34
- import { createSwarmOrchestrator, CustomAdapter } from 'network-ai';
35
-
36
- // 1. Create an adapter and register your agent
37
- const adapter = new CustomAdapter();
38
- adapter.registerHandler('greeter', async (payload) => {
39
- return { result: `Hello, ${payload.params.name}! Your task: ${payload.action}` };
40
- });
41
-
42
- // 2. Create the orchestrator
43
- const orchestrator = createSwarmOrchestrator({
44
- adapters: [{ adapter }],
45
- });
46
-
47
- // 3. Use the blackboard to coordinate
48
- orchestrator.blackboard.write('status', { ready: true }, 'greeter');
49
-
50
- // 4. Execute your agent through the adapter
51
- const result = await adapter.executeAgent('greeter', {
52
- action: 'welcome',
53
- params: { name: 'World' },
54
- }, { agentId: 'greeter' });
55
-
56
- console.log(result.data); // "Hello, World! Your task: welcome"
57
- ```
58
-
59
- That's it. No config files, no setup wizards. Add more agents, swap frameworks, layer on security -- all optional.
60
-
61
- ## Why This Exists -- The Multi-Agent Race Condition Problem
62
-
63
- Most agent frameworks let you run multiple AI agents in parallel. None of them protect you when those agents write to the same resource at the same time.
64
-
65
- **The "Bank Run" scenario:**
66
-
67
- ```
68
- Agent A reads balance: $10,000
69
- Agent B reads balance: $10,000 (same moment)
70
- Agent A writes balance: $10,000 - $7,000 = $3,000
71
- Agent B writes balance: $10,000 - $6,000 = $4,000 <-- Agent A's write is gone
72
- ```
73
-
74
- Both agents thought they had $10,000. Both spent from it. You just lost $3,000 to a race condition. This isn't theoretical -- it happens any time two LLM agents hit a shared database, file, or API concurrently.
75
-
76
- **This is a split-brain problem.** Without concurrency control, your agents will:
77
- - **Corrupt shared state** -- Two agents overwrite each other's blackboard entries
78
- - **Double-spend budgets** -- Token costs exceed limits because agents don't see each other's spending
79
- - **Produce contradictory outputs** -- Agent A says "approved", Agent B says "denied", both write to the same key
80
-
81
- **How Network-AI prevents this:**
82
-
83
- ```typescript
84
- // Atomic commit -- no other agent can read or write "account:balance" during this operation
85
- const blackboard = new LockedBlackboard('.');
86
- const changeId = blackboard.proposeChange('account:balance', { amount: 7000, type: 'debit' }, 'agent-a');
87
- blackboard.validateChange(changeId); // Checks for conflicts
88
- blackboard.commitChange(changeId); // Atomic write with file-system mutex
89
-
90
- // Budget tracking -- hard ceiling on token spend
91
- // Even if 5 agents run in parallel, total spend cannot exceed the budget
92
- python scripts/swarm_guard.py budget-init --task-id "task_001" --budget 10000
93
- ```
94
-
95
- Network-AI wraps your agent swarm with **file-system mutexes**, **atomic commits**, and **token budget ceilings** so race conditions, double-spends, and split-brain writes simply cannot happen. This works with any framework -- LangChain, CrewAI, AutoGen, or anything else connected through the adapter system.
96
-
97
- ## Features
98
-
99
- ### Core Orchestration (Multi-Agent Coordination)
100
- - **Agent-to-Agent Handoffs** -- Delegate tasks between sessions using OpenClaw's `sessions_send`
101
- - **Permission Wall (AuthGuardian)** -- Gate access to sensitive APIs with justification-based approval
102
- - **Shared Blackboard** -- Markdown-based coordination state for agent communication
103
- - **Parallel Execution Patterns** -- Merge, vote, chain, and first-success synthesis strategies
104
- - **Task Decomposition** -- Automatic breaking of complex tasks into parallel subtasks
105
-
106
- ### Plug-and-Play Adapter System (v3.0) -- 12 AI Agent Frameworks
107
- - **AdapterRegistry** -- Route agents to the right framework automatically
108
- - **OpenClaw Adapter** -- Native OpenClaw skill execution via `callSkill`
109
- - **LangChain Adapter** -- Supports Runnables (`.invoke()`) and plain functions
110
- - **AutoGen Adapter** -- Supports `.run()` and `.generateReply()` agents
111
- - **CrewAI Adapter** -- Individual agents and full crew orchestration
112
- - **MCP Adapter** -- Model Context Protocol tool handlers
113
- - **LlamaIndex Adapter** -- Query engines, chat engines, and agent runners
114
- - **Semantic Kernel Adapter** -- Microsoft SK kernels, functions, and planners
115
- - **OpenAI Assistants Adapter** -- Assistants API with thread management
116
- - **Haystack Adapter** -- Pipelines, agents, and components
117
- - **DSPy Adapter** -- Modules, programs, and predictors
118
- - **Agno Adapter** -- Agents, teams, and functions (formerly Phidata)
119
- - **Custom Adapter** -- Register any function or HTTP endpoint as an agent
120
- - **BaseAdapter** -- Extend to write your own adapter in minutes
121
-
122
- ### Content Quality Gate (AI Safety)
123
- - **BlackboardValidator (Layer 1)** -- Rule-based validation at ~159K-1M ops/sec
124
- - **QualityGateAgent (Layer 2)** -- AI-assisted review with quarantine system
125
- - **Hallucination Detection** -- Catches vague, unsupported, or fabricated content
126
- - **Dangerous Code Detection** -- Blocks `eval()`, `exec()`, `rm -rf`, and other risky patterns
127
- - **Placeholder Rejection** -- Rejects TODO/FIXME/stub content from entering the blackboard
128
-
129
- ### Security Module (Defense-in-Depth)
130
- - **HMAC-Signed Tokens** -- Cryptographic token generation with expiration
131
- - **Input Sanitization** -- XSS, injection, path traversal, and prototype pollution prevention
132
- - **Blackboard Path Safety** -- Change ID sanitization prevents directory traversal in atomic commits
133
- - **Rate Limiting** -- Per-agent request throttling with lockout on failed auth
134
- - **AES-256-GCM Encryption** -- Encrypt sensitive blackboard entries at rest
135
- - **Privilege Escalation Prevention** -- Trust-ceiling enforcement
136
- - **Cryptographic Audit Logs** -- Tamper-evident signed audit trail with chain continuation
137
- - **Secure Gateway** -- Integrated security layer wrapping all operations
138
-
139
- ### Operational Safety & Governance
140
- - **Swarm Guard** -- Prevents "Handoff Tax" (wasted tokens) and detects silent agent failures
141
- - **Atomic Commits** -- File-system mutexes prevent split-brain in concurrent writes
142
- - **Priority-Based Preemption** -- Higher-priority agents preempt lower-priority writes on same-key conflicts (`priority-wins` strategy)
143
- - **Cost Awareness** -- Token budget tracking with automatic SafetyShutdown
144
- - **Budget-Aware Handoffs** -- `intercept-handoff` command wraps `sessions_send` with budget checks
145
- - **`--active-grants` Observability** -- Real-time view of which agents hold access to which APIs, with TTL countdown
146
- - **`--audit-summary` Observability** -- Per-agent and per-resource breakdown of permission requests, grants, and denials
147
- - **Justification Hardening** -- 16-pattern prompt-injection detector, keyword-stuffing defense, structural coherence scoring
148
-
149
- ## Project Structure
150
-
151
- ```
152
- Network-AI/
153
- |-- index.ts # Core orchestrator (SwarmOrchestrator, SharedBlackboard, AuthGuardian, TaskDecomposer)
154
- |-- security.ts # Security module (tokens, encryption, rate limiting, audit)
155
- |-- setup.ts # Developer setup & installation checker
156
- |-- package.json # NPM manifest & scripts
157
- |-- tsconfig.json # TypeScript configuration
158
- |-- skill.json # OpenClaw skill metadata
159
- |-- SKILL.md # OpenClaw skill definition (frontmatter + instructions)
160
- |-- QUICKSTART.md # 5-minute getting-started guide
161
- |-- requirements.txt # Python dependencies
162
- |-- swarm-blackboard.md # Runtime blackboard state (auto-generated)
163
- |-- adapters/ # Plug-and-play agent framework adapters (12 frameworks)
164
- | |-- index.ts # Barrel exports for all adapters
165
- | |-- base-adapter.ts # Abstract base class for adapters
166
- | |-- adapter-registry.ts # Multi-adapter routing & discovery
167
- | |-- openclaw-adapter.ts # OpenClaw skill adapter
168
- | |-- langchain-adapter.ts # LangChain adapter (Runnables & functions)
169
- | |-- autogen-adapter.ts # AutoGen adapter (.run() & .generateReply())
170
- | |-- crewai-adapter.ts # CrewAI adapter (agents & crews)
171
- | |-- mcp-adapter.ts # MCP tool handler adapter
172
- | |-- custom-adapter.ts # Custom function/HTTP agent adapter
173
- | |-- llamaindex-adapter.ts # LlamaIndex adapter (query/chat engines, agent runners)
174
- | |-- semantic-kernel-adapter.ts # Microsoft Semantic Kernel adapter
175
- | |-- openai-assistants-adapter.ts # OpenAI Assistants API adapter
176
- | |-- haystack-adapter.ts # deepset Haystack adapter (pipelines, agents)
177
- | |-- dspy-adapter.ts # Stanford DSPy adapter (modules, programs)
178
- | |-- agno-adapter.ts # Agno adapter (agents, teams -- formerly Phidata)
179
- |-- types/ # TypeScript type definitions
180
- | |-- agent-adapter.d.ts # Universal adapter interfaces (IAgentAdapter, AgentPayload, etc.)
181
- | |-- openclaw-core.d.ts # OpenClaw-specific type stubs
182
- |-- lib/ # TypeScript utilities
183
- | |-- swarm-utils.ts # Node.js helper functions
184
- | |-- locked-blackboard.ts # Atomic commits with file-system mutexes
185
- | |-- blackboard-validator.ts # Content quality gate (BlackboardValidator + QualityGateAgent)
186
- |-- scripts/ # Python helper scripts
187
- | |-- check_permission.py # AuthGuardian permission checker
188
- | |-- validate_token.py # Token validation
189
- | |-- revoke_token.py # Token revocation
190
- | |-- blackboard.py # Shared state management (with atomic commits)
191
- | |-- swarm_guard.py # Handoff tax, failure prevention, & budget tracking
192
- |-- references/ # Detailed documentation
193
- | |-- adapter-system.md # Adapter architecture & writing custom adapters
194
- | |-- auth-guardian.md # Permission system details
195
- | |-- blackboard-schema.md # Data structures
196
- | |-- trust-levels.md # Agent trust configuration
197
- | |-- mcp-roadmap.md # MCP networking implementation plan
198
- |-- test-standalone.ts # Core orchestrator tests (79 tests)
199
- |-- test-security.ts # Security module tests (33 tests)
200
- |-- test-adapters.ts # Adapter system tests (139 tests)
201
- |-- test-priority.ts # Priority & preemption tests (64 tests)
202
- |-- test-ai-quality.ts # AI quality gate demo
203
- |-- test.ts # Full integration test suite
204
- ```
205
-
206
- ## Quick Start
207
-
208
- See [QUICKSTART.md](QUICKSTART.md) for a 5-minute getting-started guide.
209
-
210
- ## Installation
211
-
212
- ### As a Dependency (recommended)
213
-
214
- ```bash
215
- npm install network-ai
216
- ```
217
-
218
- That's it. No native dependencies, no build step.
219
-
220
- ### For Development (contributing / running tests)
221
-
222
- ```bash
223
- git clone https://github.com/jovanSAPFIONEER/Network-AI
224
- cd Network-AI
225
- npm install # TypeScript dev dependencies
226
- pip install -r requirements.txt # Optional: mypy, pytest, filelock for Python script development
227
- ```
228
-
229
- ### Verify Development Setup
230
-
231
- ```bash
232
- npm run setup:check # Check all files and dependencies
233
- npm run setup -- --list # List all 12 available adapters
234
- npm run setup:example # Generate a starter example.ts
235
- ```
236
-
237
- ### For OpenClaw Users
238
-
239
- Copy this skill into your OpenClaw workspace:
240
-
241
- ```bash
242
- cp -r Network-AI ~/.openclaw/workspace/skills/swarm-orchestrator
243
- ```
244
-
245
- Or install via ClawHub:
246
-
247
- ```bash
248
- clawhub install network-ai
249
- ```
250
-
251
- ## Usage
252
-
253
- ### TypeScript / Node.js API
254
-
255
- #### Basic Setup
256
-
257
- ```typescript
258
- import {
259
- SwarmOrchestrator,
260
- SharedBlackboard,
261
- AuthGuardian,
262
- createSwarmOrchestrator,
263
- } from 'network-ai';
264
-
265
- // Quick start with defaults
266
- const orchestrator = createSwarmOrchestrator();
267
- ```
268
-
269
- #### Using Adapters (Plug-and-Play)
270
-
271
- ```typescript
272
- import {
273
- createSwarmOrchestrator,
274
- AdapterRegistry,
275
- CustomAdapter,
276
- LangChainAdapter,
277
- } from 'network-ai';
278
-
279
- // Create adapters
280
- const custom = new CustomAdapter();
281
- custom.registerHandler('my-agent', async (payload) => {
282
- return { result: 'done' };
283
- });
284
-
285
- const langchain = new LangChainAdapter();
286
- langchain.registerRunnable('researcher', myLangChainRunnable);
287
-
288
- // Create orchestrator with adapters
289
- const orchestrator = createSwarmOrchestrator({
290
- adapters: [
291
- { adapter: custom },
292
- { adapter: langchain },
293
- ],
294
- });
295
- ```
296
-
297
- #### Blackboard & Permissions
298
-
299
- ```typescript
300
- const blackboard = new SharedBlackboard('.');
301
- blackboard.write('task:analysis', { status: 'running' }, 'orchestrator');
302
- const data = blackboard.read('task:analysis');
303
-
304
- const auth = new AuthGuardian();
305
- const grant = auth.requestPermission('data_analyst', 'DATABASE', 'read',
306
- 'Need customer order history for sales report');
307
- ```
308
-
309
- ### Python Scripts
310
-
311
- #### 1. Initialize Budget (First!)
312
-
313
- ```bash
314
- python scripts/swarm_guard.py budget-init --task-id "task_001" --budget 10000
315
- ```
316
-
317
- #### 2. Budget-Aware Handoffs
318
-
319
- ```bash
320
- python scripts/swarm_guard.py intercept-handoff \
321
- --task-id "task_001" \
322
- --from orchestrator \
323
- --to data_analyst \
324
- --message "Analyze Q4 revenue data"
325
- ```
326
-
327
- Output (if allowed):
328
- ```
329
- HANDOFF ALLOWED: orchestrator -> data_analyst
330
- Tokens spent: 156
331
- Budget remaining: 9,844
332
- Handoff #1 (remaining: 2)
333
- -> Proceed with sessions_send
334
- ```
335
-
336
- #### 3. Check Permissions
337
-
338
- ```bash
339
- python scripts/check_permission.py \
340
- --agent data_analyst \
341
- --resource DATABASE \
342
- --justification "Need customer order history for sales report"
343
- ```
344
-
345
- Output:
346
- ```
347
- GRANTED
348
- Token: grant_85364b44d987...
349
- Expires: 2026-02-04T15:30:00Z
350
- Restrictions: read_only, max_records:100
351
- ```
352
-
353
- #### 3a. View Active Grants
354
-
355
- See which agents currently hold access to which APIs:
356
-
357
- ```bash
358
- # Human-readable
359
- python scripts/check_permission.py --active-grants
360
-
361
- # Filter by agent
362
- python scripts/check_permission.py --active-grants --agent data_analyst
363
-
364
- # Machine-readable JSON
365
- python scripts/check_permission.py --active-grants --json
366
- ```
367
-
368
- Output:
369
- ```
370
- Active Grants:
371
- ======================================================================
372
- Agent: data_analyst
373
- Resource: DATABASE
374
- Scope: read:orders
375
- Token: grant_c1ea828897...
376
- Remaining: 4.4 min
377
- Restrictions: read_only, max_records:100
378
- ------------------------------------------------------------------
379
-
380
- Total: 1 active, 0 expired
381
- ```
382
-
383
- #### 3b. Audit Summary
384
-
385
- Summarize permission activity across all agents:
386
-
387
- ```bash
388
- # Human-readable
389
- python scripts/check_permission.py --audit-summary
390
-
391
- # Last 50 entries, JSON output
392
- python scripts/check_permission.py --audit-summary --last 50 --json
393
- ```
394
-
395
- Output:
396
- ```
397
- Audit Summary
398
- ======================================================================
399
- Requests: 12
400
- Grants: 9
401
- Denials: 3
402
- Grant Rate: 75%
403
-
404
- By Agent:
405
- --------------------------------------------------
406
- Agent Requests Grants Denials
407
- data_analyst 4 3 1
408
- orchestrator 5 4 1
409
- strategy_advisor 3 2 1
410
- ```
411
-
412
- #### 4. Use the Blackboard
413
-
414
- ```bash
415
- # Write
416
- python scripts/blackboard.py write "task:analysis" '{"status": "running"}'
417
-
418
- # Read
419
- python scripts/blackboard.py read "task:analysis"
420
-
421
- # Atomic commit workflow (for multi-agent safety)
422
- python scripts/blackboard.py propose "chg_001" "key" '{"value": 1}'
423
- python scripts/blackboard.py validate "chg_001"
424
- python scripts/blackboard.py commit "chg_001"
425
-
426
- # List all keys
427
- python scripts/blackboard.py list
428
- ```
429
-
430
- #### 5. Fan-Out / Fan-In with Shared Blackboard
431
-
432
- Coordinate multiple specialized agents working on independent subtasks, then merge results:
433
-
434
- ```typescript
435
- import { LockedBlackboard } from 'network-ai';
436
- import { Logger } from 'network-ai';
437
-
438
- const logger = Logger.create('fan-out');
439
- const board = new LockedBlackboard('.', logger, { conflictResolution: 'first-commit-wins' });
440
-
441
- // Fan-out: each agent writes to its own section
442
- const agents = ['reliability', 'security', 'cost', 'operations', 'performance'];
443
-
444
- for (const pillar of agents) {
445
- // Each agent evaluates independently, writes to its own key
446
- const id = board.propose(`eval:${pillar}`, { score: Math.random(), findings: [] }, pillar);
447
- board.validate(id, 'orchestrator');
448
- board.commit(id);
449
- }
450
-
451
- // Fan-in: orchestrator reads all results and merges
452
- const results = agents.map(pillar => ({
453
- pillar,
454
- ...board.read(`eval:${pillar}`)
455
- }));
456
-
457
- const summary = board.propose('eval:summary', {
458
- overall: results.reduce((sum, r) => sum + r.score, 0) / results.length,
459
- pillars: results
460
- }, 'orchestrator');
461
- board.validate(summary, 'orchestrator');
462
- board.commit(summary);
463
- ```
464
-
465
- This pattern works with any framework adapter -- LangChain agents, AutoGen agents, CrewAI crews, or any mix. The blackboard ensures no agent overwrites another's results.
466
-
467
- #### 6. Priority-Based Conflict Resolution (Phase 3)
468
-
469
- ```typescript
470
- import { LockedBlackboard } from 'network-ai';
471
-
472
- // Enable priority-wins strategy
473
- const board = new LockedBlackboard('.', { conflictResolution: 'priority-wins' });
474
-
475
- // Low-priority worker proposes a change
476
- const lowId = board.propose('shared:config', { mode: 'draft' }, 'worker', undefined, 1);
477
-
478
- // High-priority supervisor proposes to same key
479
- const highId = board.propose('shared:config', { mode: 'final' }, 'supervisor', undefined, 3);
480
-
481
- // Worker commits first
482
- board.validate(lowId, 'orchestrator');
483
- board.commit(lowId);
484
-
485
- // Supervisor validates -- higher priority wins despite stale hash
486
- board.validate(highId, 'orchestrator'); // true (preempts worker's value)
487
- board.commit(highId); // success
488
-
489
- board.read('shared:config'); // { mode: 'final' } -- supervisor wins
490
- ```
491
-
492
- #### 7. Check Budget Status
493
-
494
- ```bash
495
- python scripts/swarm_guard.py budget-check --task-id "task_001"
496
- python scripts/swarm_guard.py budget-report --task-id "task_001"
497
- ```
498
-
499
- ## Adapter System
500
-
501
- The adapter system lets you plug any agent framework into the orchestrator. Each adapter implements the `IAgentAdapter` interface.
502
-
503
- | Adapter | Framework | Agent Registration | Dependencies |
504
- |---------|-----------|-------------------|-------------|
505
- | `OpenClawAdapter` | OpenClaw | `registerSkill(name, skillRef)` | openclaw-core |
506
- | `LangChainAdapter` | LangChain | `registerRunnable(name, runnable)` or `registerFunction(name, fn)` | None (BYOC) |
507
- | `AutoGenAdapter` | AutoGen | `registerAgent(name, agent)` -- supports `.run()` and `.generateReply()` | None (BYOC) |
508
- | `CrewAIAdapter` | CrewAI | `registerAgent(name, agent)` or `registerCrew(name, crew)` | None (BYOC) |
509
- | `MCPAdapter` | MCP | `registerTool(name, handler)` | None (BYOC) |
510
- | `LlamaIndexAdapter` | LlamaIndex | `registerQueryEngine()`, `registerChatEngine()`, `registerAgentRunner()` | None (BYOC) |
511
- | `SemanticKernelAdapter` | Semantic Kernel | `registerKernel()`, `registerFunction()` | None (BYOC) |
512
- | `OpenAIAssistantsAdapter` | OpenAI Assistants | `registerAssistant(name, config)` | None (BYOC) |
513
- | `HaystackAdapter` | Haystack | `registerPipeline()`, `registerAgent()`, `registerComponent()` | None (BYOC) |
514
- | `DSPyAdapter` | DSPy | `registerModule()`, `registerProgram()`, `registerPredictor()` | None (BYOC) |
515
- | `AgnoAdapter` | Agno | `registerAgent()`, `registerTeam()`, `registerFunction()` | None (BYOC) |
516
- | `CustomAdapter` | Any | `registerHandler(name, fn)` or `registerHttpAgent(name, config)` | None |
517
-
518
- > **BYOC** = Bring Your Own Client. All adapters (except OpenClaw) are self-contained with zero npm dependencies. You provide your framework's SDK objects and the adapter wraps them.
519
-
520
- ### Writing a Custom Adapter
521
-
522
- Extend `BaseAdapter`:
523
-
524
- ```typescript
525
- import { BaseAdapter } from 'network-ai';
526
- import type { AgentPayload, AgentResult } from 'network-ai';
527
-
528
- class MyAdapter extends BaseAdapter {
529
- readonly name = 'my-framework';
530
-
531
- async executeAgent(agentId: string, payload: AgentPayload): Promise<AgentResult> {
532
- // Your framework-specific logic here
533
- return { success: true, output: 'result', metadata: { adapter: this.name } };
534
- }
535
-
536
- async listAgents() { return []; }
537
- async isAgentAvailable(id: string) { return true; }
538
- }
539
- ```
540
-
541
- See [references/adapter-system.md](references/adapter-system.md) for the full adapter architecture guide.
542
-
543
- ## Permission System
544
-
545
- The AuthGuardian evaluates requests using:
546
-
547
- | Factor | Weight | Description |
548
- |--------|--------|-------------|
549
- | Justification | 40% | Quality of business reason (hardened against prompt injection) |
550
- | Trust Level | 30% | Agent's established trust |
551
- | Risk Assessment | 30% | Resource sensitivity + scope |
552
-
553
- **Approval threshold: 0.5**
554
-
555
- ### Resource Types
556
-
557
- | Resource | Base Risk | Default Restrictions |
558
- |----------|-----------|---------------------|
559
- | `DATABASE` | 0.5 | `read_only`, `max_records:100` |
560
- | `PAYMENTS` | 0.7 | `read_only`, `no_pii_fields`, `audit_required` |
561
- | `EMAIL` | 0.4 | `rate_limit:10_per_minute` |
562
- | `FILE_EXPORT` | 0.6 | `anonymize_pii`, `local_only` |
563
-
564
- ## Security Module
565
-
566
- The security module ([security.ts](security.ts)) provides defense-in-depth protections:
567
-
568
- | Component | Class | Purpose |
569
- |-----------|-------|---------|
570
- | Token Manager | `SecureTokenManager` | HMAC-signed tokens with expiration |
571
- | Input Sanitizer | `InputSanitizer` | XSS, injection, traversal prevention |
572
- | Rate Limiter | `RateLimiter` | Per-agent request throttling + lockout |
573
- | Encryptor | `DataEncryptor` | AES-256-GCM encryption for sensitive data |
574
- | Permission Hardener | `PermissionHardener` | Trust-ceiling & privilege escalation prevention |
575
- | Audit Logger | `SecureAuditLogger` | Cryptographically signed audit entries |
576
- | Gateway | `SecureSwarmGateway` | Integrated security layer wrapping all ops |
577
-
578
- ## Agent Trust Levels
579
-
580
- | Agent | Trust | Role |
581
- |-------|-------|------|
582
- | `orchestrator` | 0.9 | Primary coordinator |
583
- | `risk_assessor` | 0.85 | Compliance specialist |
584
- | `data_analyst` | 0.8 | Data processing |
585
- | `strategy_advisor` | 0.7 | Business strategy |
586
- | Unknown | 0.5 | Default |
587
-
588
- ## Handoff Protocol
589
-
590
- Format messages for delegation:
591
-
592
- ```
593
- [HANDOFF]
594
- Instruction: Analyze monthly sales by product category
595
- Context: Using database export from ./data/sales_export.csv
596
- Constraints: Focus on top 5 categories only
597
- Expected Output: JSON summary with category, revenue, growth_pct
598
- [/HANDOFF]
599
- ```
600
-
601
- ## Testing
602
-
603
- Run all test suites:
604
-
605
- ```bash
606
- # All tests at once
607
- npm run test:all
608
-
609
- # Core orchestrator tests (79 tests)
610
- npm test
611
-
612
- # Security module tests (33 tests)
613
- npm run test:security
614
-
615
- # Adapter system tests (139 tests)
616
- npm run test:adapters
617
-
618
- # Full integration tests
619
- npx ts-node test.ts
620
- ```
621
-
622
- Test Python scripts:
623
-
624
- ```bash
625
- # Test permission system
626
- python scripts/check_permission.py --agent orchestrator --resource PAYMENTS \
627
- --justification "Generating monthly revenue report for management" --json
628
-
629
- # Test blackboard
630
- python scripts/blackboard.py write "test:key" '{"value": 123}' --ttl 60
631
- python scripts/blackboard.py read "test:key"
632
-
633
- # Test TTL cleanup
634
- python scripts/revoke_token.py --list-expired
635
- python scripts/revoke_token.py --cleanup
636
- ```
637
-
638
- **Test results (315 total):**
639
- - `test-standalone.ts` -- 79 passed (blackboard, auth, integration, persistence, parallelization, coding domain, quality gate)
640
- - `test-security.ts` -- 33 passed (tokens, sanitization, rate limiting, encryption, permissions, audit)
641
- - `test-adapters.ts` -- 139 passed (12 adapters: Custom, LangChain, AutoGen, CrewAI, MCP, LlamaIndex, Semantic Kernel, OpenAI Assistants, Haystack, DSPy, Agno + registry routing, integration, edge cases)
642
- - `test-priority.ts` -- 64 passed (priority-based preemption, conflict resolution, constructor overloads, backward compatibility)
643
-
644
- ## Audit Trail
645
-
646
- Logged events: `permission_granted`, `permission_denied`, `permission_revoked`, `ttl_cleanup`, `result_validated`
647
-
648
- The security module's `SecureAuditLogger` produces cryptographically signed entries that can be verified for tamper detection.
649
-
650
- ## Documentation
651
-
652
- - [QUICKSTART.md](QUICKSTART.md) -- 5-minute getting-started guide
653
- - [SKILL.md](SKILL.md) -- Main skill instructions (includes Orchestrator protocol)
654
- - [references/adapter-system.md](references/adapter-system.md) -- Adapter architecture & writing custom adapters
655
- - [references/auth-guardian.md](references/auth-guardian.md) -- Permission system details
656
- - [references/blackboard-schema.md](references/blackboard-schema.md) -- Data structures
657
- - [references/trust-levels.md](references/trust-levels.md) -- Trust configuration
658
- - [references/mcp-roadmap.md](references/mcp-roadmap.md) -- MCP networking implementation plan
659
-
660
- ## Configuration
661
-
662
- ### Modify Trust Levels
663
-
664
- Edit `scripts/check_permission.py`:
665
-
666
- ```python
667
- DEFAULT_TRUST_LEVELS = {
668
- "orchestrator": 0.9,
669
- "my_new_agent": 0.75, # Add your agent
670
- }
671
- ```
672
-
673
- ### Adjust Token TTL
674
-
675
- ```python
676
- GRANT_TOKEN_TTL_MINUTES = 5 # Change as needed
677
- ```
678
-
679
- ## Exports
680
-
681
- The module exports everything needed for programmatic use:
682
-
683
- ```typescript
684
- // Core classes
685
- import SwarmOrchestrator, { SharedBlackboard, AuthGuardian, TaskDecomposer } from 'network-ai';
686
- import { BlackboardValidator, QualityGateAgent } from 'network-ai';
687
-
688
- // Factory
689
- import { createSwarmOrchestrator } from 'network-ai';
690
-
691
- // Adapters (all 12)
692
- import {
693
- AdapterRegistry, BaseAdapter,
694
- OpenClawAdapter, LangChainAdapter, AutoGenAdapter,
695
- CrewAIAdapter, MCPAdapter, CustomAdapter,
696
- LlamaIndexAdapter, SemanticKernelAdapter, OpenAIAssistantsAdapter,
697
- HaystackAdapter, DSPyAdapter, AgnoAdapter,
698
- } from 'network-ai';
699
-
700
- // Types
701
- import type {
702
- IAgentAdapter, AgentPayload, AgentContext, AgentResult, AgentInfo,
703
- AdapterConfig, AdapterCapabilities,
704
- TaskPayload, HandoffMessage, PermissionGrant, SwarmState,
705
- AgentStatus, ParallelTask, ParallelExecutionResult, SynthesisStrategy,
706
- } from 'network-ai';
707
- ```
708
-
709
- ## License
710
-
711
- MIT License -- See [LICENSE](LICENSE)
712
-
713
- ## Contributing
714
-
715
- If you find Network-AI useful, **give it a star** -- it helps others discover the project and motivates development:
716
-
717
- [![Star on GitHub](https://img.shields.io/github/stars/jovanSAPFIONEER/Network-AI?style=social)](https://github.com/jovanSAPFIONEER/Network-AI)
718
-
719
- **Want to contribute code?**
720
-
721
- 1. Fork the repository
722
- 2. Create a feature branch
723
- 3. Make your changes
724
- 4. Run all tests (`npm run test:all`)
725
- 5. Submit a pull request
726
-
727
- **Other ways to help:**
728
- - Report bugs or suggest features via [Issues](https://github.com/jovanSAPFIONEER/Network-AI/issues)
729
- - Share Network-AI with your team or on social media
730
- - Write about your experience using it
731
-
732
- ---
733
-
734
- **Compatible with 12 agent frameworks: OpenClaw, LangChain, AutoGen, CrewAI, MCP, LlamaIndex, Semantic Kernel, OpenAI Assistants, Haystack, DSPy, Agno, and any custom adapter**
735
-
736
- ## Competitive Comparison
737
-
738
- How Network-AI compares to other multi-agent frameworks:
739
-
740
- | Capability | Network-AI | LangChain/LangGraph | AutoGen/AG2 | CrewAI | Claude SDK |
741
- |---|---|---|---|---|---|
742
- | **Multi-framework support** | 12 adapters | LangChain only | AutoGen only | CrewAI only | Claude only |
743
- | **Shared state (blackboard)** | Atomic commits, TTL, priority | LangGraph state | Shared context | Shared memory | Project memory |
744
- | **Conflict resolution** | Priority preemption, last-write-wins | None | None | None | None |
745
- | **Fan-out / fan-in** | Native (parallel + merge) | LangGraph branches | Group chat | Parallel tasks | Subagents |
746
- | **Permission gating** | AuthGuardian (weighted scoring) | None | None | None | None |
747
- | **Budget tracking** | Token ceiling + per-task budgets | Callbacks only | None | None | None |
748
- | **Audit trail** | HMAC-signed, tamper-evident | None | None | None | None |
749
- | **Encryption at rest** | AES-256-GCM | None | None | None | None |
750
- | **Observability** | `--active-grants`, `--audit-summary` | LangSmith (SaaS) | None | None | None |
751
- | **Rate limiting** | Per-agent with lockout | None | None | None | None |
752
- | **Justification hardening** | 16-pattern injection defense | None | None | None | None |
753
- | **Language** | TypeScript/Node.js | Python | Python | Python | Python |
754
- | **Dependencies** | Zero (per adapter) | Heavy | Heavy | Heavy | Moderate |
755
- | **License** | MIT | MIT | CC-BY-4.0 | MIT | MIT |
756
-
757
- **Key differentiator:** Network-AI is the only framework that combines multi-framework orchestration with a governance layer (permissions, audit, encryption, budget enforcement). Other frameworks focus on one LLM provider; Network-AI wraps all of them.
758
-
759
- ## Related Concepts
760
-
761
- Network-AI fits into the broader AI agent ecosystem:
762
-
763
- - **Multi-Agent Systems** -- Coordinate multiple AI agents working together on complex tasks
764
- - **Agentic AI** -- Build autonomous agents that reason, plan, and execute using LLMs
765
- - **Behavioral Control Plane** -- Govern agent behavior with permission gating, compliance enforcement, and audit trails
766
- - **Swarm Intelligence** -- Parallel fan-out/fan-in patterns with voting, merging, and chain strategies
767
- - **Model Context Protocol (MCP)** -- Standard protocol support for LLM tool integration
768
- - **Agent-to-Agent (A2A)** -- Inter-agent communication via shared blackboard and handoff protocol
769
- - **Context Engineering** -- Manage and share context across agent boundaries
770
- - **Agentic Workflows** -- Task decomposition, parallel processing, and synthesis pipelines
771
- - **LLM Orchestration** -- Route tasks to the right agent framework automatically
772
- - **Agent Governance** -- Permission gating, budget enforcement, audit logging, and compliance monitoring
773
-
774
- If you're using LangGraph, Dify, Flowise, PraisonAI, AutoGen/AG2, CrewAI, or any other agent framework, Network-AI can integrate with it through the adapter system.
775
-
776
- ---
777
-
778
- <details>
779
- <summary>Keywords (for search)</summary>
780
-
781
- ai-agents, agentic-ai, multi-agent, multi-agent-systems, multi-agent-system, agent-framework, ai-agent-framework, agentic-framework, agentic-workflow, llm, llm-agents, llm-agent, large-language-models, generative-ai, genai, orchestration, ai-orchestration, swarm, swarm-intelligence, autonomous-agents, agents, ai, typescript, nodejs, mcp, model-context-protocol, a2a, agent-to-agent, function-calling, tool-integration, context-engineering, rag, ai-safety, multi-agents-collaboration, multi-agents, aiagents, aiagentframework, plug-and-play, adapter-registry, blackboard-pattern, agent-coordination, agent-handoffs, token-permissions, budget-tracking, cost-awareness, atomic-commits, hallucination-detection, content-quality-gate, behavioral-control-plane, governance-layer, compliance-enforcement, fan-out-fan-in, agent-observability, permission-gating, audit-trail, OpenClaw, Clawdbot, Moltbot, Clawdbot Swarm, Moltbot Security, Moltbot multi-agent, OpenClaw skills, AgentSkills, LangChain adapter, LangGraph, AutoGen adapter, AG2, CrewAI adapter, MCP adapter, LlamaIndex adapter, Semantic Kernel adapter, OpenAI Assistants adapter, Haystack adapter, DSPy adapter, Agno adapter, Phidata adapter, Dify, Flowise, PraisonAI, custom-adapter, AES-256 encryption, HMAC tokens, rate limiting, input sanitization, privilege escalation prevention, ClawHub, clawhub, agentic-rag, deep-research, workflow-orchestration, ai-assistant, ai-tools, developer-tools, open-source
782
-
783
- </details>
1
+ # Network-AI: Multi-Agent Orchestration Framework
2
+
3
+ **The plug-and-play AI agent orchestrator for TypeScript/Node.js -- connect 12 agent frameworks with zero glue code**
4
+
5
+ [![CI](https://github.com/jovanSAPFIONEER/Network-AI/actions/workflows/ci.yml/badge.svg)](https://github.com/jovanSAPFIONEER/Network-AI/actions/workflows/ci.yml)
6
+ [![CodeQL](https://github.com/jovanSAPFIONEER/Network-AI/actions/workflows/codeql.yml/badge.svg)](https://github.com/jovanSAPFIONEER/Network-AI/actions/workflows/codeql.yml)
7
+ [![Release](https://img.shields.io/badge/release-v3.3.2-blue.svg)](https://github.com/jovanSAPFIONEER/Network-AI/releases)
8
+ [![npm](https://img.shields.io/npm/dw/network-ai.svg?label=npm%20downloads)](https://www.npmjs.com/package/network-ai)
9
+ [![ClawHub](https://img.shields.io/badge/ClawHub-network--ai-orange.svg)](https://clawhub.ai/skills/network-ai)
10
+ [![Node.js](https://img.shields.io/badge/node-%3E%3D18.0.0-brightgreen.svg)](https://nodejs.org)
11
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.x-3178C6.svg)](https://typescriptlang.org)
12
+ [![Python](https://img.shields.io/badge/python-3.9+-green.svg)](https://python.org)
13
+ [![License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](LICENSE)
14
+ [![Socket](https://socket.dev/api/badge/npm/package/network-ai)](https://socket.dev/npm/package/network-ai/overview)
15
+ [![AgentSkills](https://img.shields.io/badge/AgentSkills-compatible-orange.svg)](https://agentskills.io)
16
+ [![Tests](https://img.shields.io/badge/tests-462%20passing-brightgreen.svg)](#testing)
17
+ [![Adapters](https://img.shields.io/badge/frameworks-12%20supported-blueviolet.svg)](#adapter-system)
18
+ [![RSS Feed](https://img.shields.io/badge/RSS-releases-orange?logo=rss)](https://github.com/jovanSAPFIONEER/Network-AI/releases.atom)
19
+
20
+ > **Legacy Users:** This skill works with **Clawdbot** and **Moltbot** (now OpenClaw). If you're searching for *Moltbot Security*, *Clawdbot Swarm*, or *Moltbot multi-agent* -- you're in the right place!
21
+
22
+ Network-AI is a framework-agnostic multi-agent orchestrator and **behavioral control plane** that connects LLM agents across **12 frameworks** -- LangChain, AutoGen, CrewAI, OpenAI Assistants, LlamaIndex, Semantic Kernel, Haystack, DSPy, Agno, MCP, OpenClaw, and custom adapters. It provides shared blackboard coordination with atomic commits, built-in security (AES-256, HMAC tokens, rate limiting), content quality gates with hallucination detection, compliance enforcement, and agentic workflow patterns (parallel fan-out/fan-in, voting, chaining). Zero dependencies per adapter -- bring your own framework SDK and start building governed multi-agent systems in minutes.
23
+
24
+ **Why Network-AI?**
25
+ - **Framework-agnostic** -- Not locked to one LLM provider or agent SDK
26
+ - **Governance layer** -- Permission gating, audit trails, budget ceilings, and compliance enforcement across all agents
27
+ - **Shared state** -- Atomic blackboard with conflict resolution for safe parallel agent coordination (fan-out/fan-in)
28
+ - **Production security** -- AES-256 encryption, HMAC audit logs, rate limiting, input sanitization
29
+ - **Zero config** -- Works out of the box with `createSwarmOrchestrator()`
30
+
31
+ ## Hello World -- Get Running in 60 Seconds
32
+
33
+ ```typescript
34
+ import { createSwarmOrchestrator, CustomAdapter } from 'network-ai';
35
+
36
+ // 1. Create an adapter and register your agent
37
+ const adapter = new CustomAdapter();
38
+ adapter.registerHandler('greeter', async (payload) => {
39
+ return { result: `Hello, ${payload.params.name}! Your task: ${payload.action}` };
40
+ });
41
+
42
+ // 2. Create the orchestrator
43
+ const orchestrator = createSwarmOrchestrator({
44
+ adapters: [{ adapter }],
45
+ });
46
+
47
+ // 3. Use the blackboard to coordinate
48
+ orchestrator.blackboard.write('status', { ready: true }, 'greeter');
49
+
50
+ // 4. Execute your agent through the adapter
51
+ const result = await adapter.executeAgent('greeter', {
52
+ action: 'welcome',
53
+ params: { name: 'World' },
54
+ }, { agentId: 'greeter' });
55
+
56
+ console.log(result.data); // "Hello, World! Your task: welcome"
57
+ ```
58
+
59
+ That's it. No config files, no setup wizards. Add more agents, swap frameworks, layer on security -- all optional.
60
+
61
+ ## Why This Exists -- The Multi-Agent Race Condition Problem
62
+
63
+ Most agent frameworks let you run multiple AI agents in parallel. None of them protect you when those agents write to the same resource at the same time.
64
+
65
+ **The "Bank Run" scenario:**
66
+
67
+ ```
68
+ Agent A reads balance: $10,000
69
+ Agent B reads balance: $10,000 (same moment)
70
+ Agent A writes balance: $10,000 - $7,000 = $3,000
71
+ Agent B writes balance: $10,000 - $6,000 = $4,000 <-- Agent A's write is gone
72
+ ```
73
+
74
+ Both agents thought they had $10,000. Both spent from it. You just lost $3,000 to a race condition. This isn't theoretical -- it happens any time two LLM agents hit a shared database, file, or API concurrently.
75
+
76
+ **This is a split-brain problem.** Without concurrency control, your agents will:
77
+ - **Corrupt shared state** -- Two agents overwrite each other's blackboard entries
78
+ - **Double-spend budgets** -- Token costs exceed limits because agents don't see each other's spending
79
+ - **Produce contradictory outputs** -- Agent A says "approved", Agent B says "denied", both write to the same key
80
+
81
+ **How Network-AI prevents this:**
82
+
83
+ ```typescript
84
+ // Atomic commit -- no other agent can read or write "account:balance" during this operation
85
+ const blackboard = new LockedBlackboard('.');
86
+ const changeId = blackboard.proposeChange('account:balance', { amount: 7000, type: 'debit' }, 'agent-a');
87
+ blackboard.validateChange(changeId); // Checks for conflicts
88
+ blackboard.commitChange(changeId); // Atomic write with file-system mutex
89
+
90
+ // Budget tracking -- hard ceiling on token spend
91
+ // Even if 5 agents run in parallel, total spend cannot exceed the budget
92
+ python scripts/swarm_guard.py budget-init --task-id "task_001" --budget 10000
93
+ ```
94
+
95
+ Network-AI wraps your agent swarm with **file-system mutexes**, **atomic commits**, and **token budget ceilings** so race conditions, double-spends, and split-brain writes simply cannot happen. This works with any framework -- LangChain, CrewAI, AutoGen, or anything else connected through the adapter system.
96
+
97
+ ## Features
98
+
99
+ ### Core Orchestration (Multi-Agent Coordination)
100
+ - **Agent-to-Agent Handoffs** -- Delegate tasks between sessions using OpenClaw's `sessions_send`
101
+ - **Permission Wall (AuthGuardian)** -- Gate access to sensitive APIs with justification-based approval
102
+ - **Shared Blackboard** -- Markdown-based coordination state for agent communication
103
+ - **Parallel Execution Patterns** -- Merge, vote, chain, and first-success synthesis strategies
104
+ - **Task Decomposition** -- Automatic breaking of complex tasks into parallel subtasks
105
+
106
+ ### Plug-and-Play Adapter System (v3.0) -- 12 AI Agent Frameworks
107
+ - **AdapterRegistry** -- Route agents to the right framework automatically
108
+ - **OpenClaw Adapter** -- Native OpenClaw skill execution via `callSkill`
109
+ - **LangChain Adapter** -- Supports Runnables (`.invoke()`) and plain functions
110
+ - **AutoGen Adapter** -- Supports `.run()` and `.generateReply()` agents
111
+ - **CrewAI Adapter** -- Individual agents and full crew orchestration
112
+ - **MCP Adapter** -- Model Context Protocol tool handlers
113
+ - **LlamaIndex Adapter** -- Query engines, chat engines, and agent runners
114
+ - **Semantic Kernel Adapter** -- Microsoft SK kernels, functions, and planners
115
+ - **OpenAI Assistants Adapter** -- Assistants API with thread management
116
+ - **Haystack Adapter** -- Pipelines, agents, and components
117
+ - **DSPy Adapter** -- Modules, programs, and predictors
118
+ - **Agno Adapter** -- Agents, teams, and functions (formerly Phidata)
119
+ - **Custom Adapter** -- Register any function or HTTP endpoint as an agent
120
+ - **BaseAdapter** -- Extend to write your own adapter in minutes
121
+
122
+ ### Content Quality Gate (AI Safety)
123
+ - **BlackboardValidator (Layer 1)** -- Rule-based validation at ~159K-1M ops/sec
124
+ - **QualityGateAgent (Layer 2)** -- AI-assisted review with quarantine system
125
+ - **Hallucination Detection** -- Catches vague, unsupported, or fabricated content
126
+ - **Dangerous Code Detection** -- Blocks `eval()`, `exec()`, `rm -rf`, and other risky patterns
127
+ - **Placeholder Rejection** -- Rejects TODO/FIXME/stub content from entering the blackboard
128
+
129
+ ### Security Module (Defense-in-Depth)
130
+ - **HMAC-Signed Tokens** -- Cryptographic token generation with expiration
131
+ - **Input Sanitization** -- XSS, injection, path traversal, and prototype pollution prevention
132
+ - **Blackboard Path Safety** -- Change ID sanitization prevents directory traversal in atomic commits
133
+ - **Rate Limiting** -- Per-agent request throttling with lockout on failed auth
134
+ - **AES-256-GCM Encryption** -- Encrypt sensitive blackboard entries at rest
135
+ - **Privilege Escalation Prevention** -- Trust-ceiling enforcement
136
+ - **Cryptographic Audit Logs** -- Tamper-evident signed audit trail with chain continuation
137
+ - **Secure Gateway** -- Integrated security layer wrapping all operations
138
+
139
+ ### Operational Safety & Governance
140
+ - **Swarm Guard** -- Prevents "Handoff Tax" (wasted tokens) and detects silent agent failures
141
+ - **Atomic Commits** -- File-system mutexes prevent split-brain in concurrent writes
142
+ - **Priority-Based Preemption** -- Higher-priority agents preempt lower-priority writes on same-key conflicts (`priority-wins` strategy)
143
+ - **Cost Awareness** -- Token budget tracking with automatic SafetyShutdown
144
+ - **Budget-Aware Handoffs** -- `intercept-handoff` command wraps `sessions_send` with budget checks
145
+ - **`--active-grants` Observability** -- Real-time view of which agents hold access to which APIs, with TTL countdown
146
+ - **`--audit-summary` Observability** -- Per-agent and per-resource breakdown of permission requests, grants, and denials
147
+ - **Justification Hardening** -- 16-pattern prompt-injection detector, keyword-stuffing defense, structural coherence scoring
148
+
149
+ ## Project Structure
150
+
151
+ ```
152
+ Network-AI/
153
+ |-- index.ts # Core orchestrator (SwarmOrchestrator, SharedBlackboard, AuthGuardian, TaskDecomposer)
154
+ |-- security.ts # Security module (tokens, encryption, rate limiting, audit)
155
+ |-- setup.ts # Developer setup & installation checker
156
+ |-- package.json # NPM manifest & scripts
157
+ |-- tsconfig.json # TypeScript configuration
158
+ |-- skill.json # OpenClaw skill metadata
159
+ |-- SKILL.md # OpenClaw skill definition (frontmatter + instructions)
160
+ |-- QUICKSTART.md # 5-minute getting-started guide
161
+ |-- requirements.txt # Python dependencies
162
+ |-- swarm-blackboard.md # Runtime blackboard state (auto-generated)
163
+ |-- adapters/ # Plug-and-play agent framework adapters (12 frameworks)
164
+ | |-- index.ts # Barrel exports for all adapters
165
+ | |-- base-adapter.ts # Abstract base class for adapters
166
+ | |-- adapter-registry.ts # Multi-adapter routing & discovery
167
+ | |-- openclaw-adapter.ts # OpenClaw skill adapter
168
+ | |-- langchain-adapter.ts # LangChain adapter (Runnables & functions)
169
+ | |-- autogen-adapter.ts # AutoGen adapter (.run() & .generateReply())
170
+ | |-- crewai-adapter.ts # CrewAI adapter (agents & crews)
171
+ | |-- mcp-adapter.ts # MCP tool handler adapter
172
+ | |-- custom-adapter.ts # Custom function/HTTP agent adapter
173
+ | |-- llamaindex-adapter.ts # LlamaIndex adapter (query/chat engines, agent runners)
174
+ | |-- semantic-kernel-adapter.ts # Microsoft Semantic Kernel adapter
175
+ | |-- openai-assistants-adapter.ts # OpenAI Assistants API adapter
176
+ | |-- haystack-adapter.ts # deepset Haystack adapter (pipelines, agents)
177
+ | |-- dspy-adapter.ts # Stanford DSPy adapter (modules, programs)
178
+ | |-- agno-adapter.ts # Agno adapter (agents, teams -- formerly Phidata)
179
+ |-- types/ # TypeScript type definitions
180
+ | |-- agent-adapter.d.ts # Universal adapter interfaces (IAgentAdapter, AgentPayload, etc.)
181
+ | |-- openclaw-core.d.ts # OpenClaw-specific type stubs
182
+ |-- lib/ # TypeScript utilities
183
+ | |-- swarm-utils.ts # Node.js helper functions
184
+ | |-- locked-blackboard.ts # Atomic commits with file-system mutexes
185
+ | |-- blackboard-validator.ts # Content quality gate (BlackboardValidator + QualityGateAgent)
186
+ |-- scripts/ # Python helper scripts
187
+ | |-- check_permission.py # AuthGuardian permission checker
188
+ | |-- validate_token.py # Token validation
189
+ | |-- revoke_token.py # Token revocation
190
+ | |-- blackboard.py # Shared state management (with atomic commits)
191
+ | |-- swarm_guard.py # Handoff tax, failure prevention, & budget tracking
192
+ |-- references/ # Detailed documentation
193
+ | |-- adapter-system.md # Adapter architecture & writing custom adapters
194
+ | |-- auth-guardian.md # Permission system details
195
+ | |-- blackboard-schema.md # Data structures
196
+ | |-- trust-levels.md # Agent trust configuration
197
+ | |-- mcp-roadmap.md # MCP networking implementation plan
198
+ |-- test-standalone.ts # Core orchestrator tests (79 tests)
199
+ |-- test-security.ts # Security module tests (33 tests)
200
+ |-- test-adapters.ts # Adapter system tests (139 tests)
201
+ |-- test-priority.ts # Priority & preemption tests (64 tests)
202
+ |-- test-ai-quality.ts # AI quality gate demo
203
+ |-- test.ts # Full integration test suite
204
+ ```
205
+
206
+ ## Quick Start
207
+
208
+ See [QUICKSTART.md](QUICKSTART.md) for a 5-minute getting-started guide.
209
+
210
+ ## Installation
211
+
212
+ ### As a Dependency (recommended)
213
+
214
+ ```bash
215
+ npm install network-ai
216
+ ```
217
+
218
+ That's it. No native dependencies, no build step.
219
+
220
+ ### For Development (contributing / running tests)
221
+
222
+ ```bash
223
+ git clone https://github.com/jovanSAPFIONEER/Network-AI
224
+ cd Network-AI
225
+ npm install # TypeScript dev dependencies
226
+ pip install -r requirements.txt # Optional: mypy, pytest, filelock for Python script development
227
+ ```
228
+
229
+ ### Verify Development Setup
230
+
231
+ ```bash
232
+ npm run setup:check # Check all files and dependencies
233
+ npm run setup -- --list # List all 12 available adapters
234
+ npm run setup:example # Generate a starter example.ts
235
+ ```
236
+
237
+ ### For OpenClaw Users
238
+
239
+ Copy this skill into your OpenClaw workspace:
240
+
241
+ ```bash
242
+ cp -r Network-AI ~/.openclaw/workspace/skills/swarm-orchestrator
243
+ ```
244
+
245
+ Or install via ClawHub:
246
+
247
+ ```bash
248
+ clawhub install network-ai
249
+ ```
250
+
251
+ ## Usage
252
+
253
+ ### TypeScript / Node.js API
254
+
255
+ #### Basic Setup
256
+
257
+ ```typescript
258
+ import {
259
+ SwarmOrchestrator,
260
+ SharedBlackboard,
261
+ AuthGuardian,
262
+ createSwarmOrchestrator,
263
+ } from 'network-ai';
264
+
265
+ // Quick start with defaults
266
+ const orchestrator = createSwarmOrchestrator();
267
+ ```
268
+
269
+ #### Using Adapters (Plug-and-Play)
270
+
271
+ ```typescript
272
+ import {
273
+ createSwarmOrchestrator,
274
+ AdapterRegistry,
275
+ CustomAdapter,
276
+ LangChainAdapter,
277
+ } from 'network-ai';
278
+
279
+ // Create adapters
280
+ const custom = new CustomAdapter();
281
+ custom.registerHandler('my-agent', async (payload) => {
282
+ return { result: 'done' };
283
+ });
284
+
285
+ const langchain = new LangChainAdapter();
286
+ langchain.registerRunnable('researcher', myLangChainRunnable);
287
+
288
+ // Create orchestrator with adapters
289
+ const orchestrator = createSwarmOrchestrator({
290
+ adapters: [
291
+ { adapter: custom },
292
+ { adapter: langchain },
293
+ ],
294
+ });
295
+ ```
296
+
297
+ #### Blackboard & Permissions
298
+
299
+ ```typescript
300
+ const blackboard = new SharedBlackboard('.');
301
+ blackboard.write('task:analysis', { status: 'running' }, 'orchestrator');
302
+ const data = blackboard.read('task:analysis');
303
+
304
+ const auth = new AuthGuardian();
305
+ const grant = auth.requestPermission('data_analyst', 'DATABASE', 'read',
306
+ 'Need customer order history for sales report');
307
+ ```
308
+
309
+ ### Python Scripts
310
+
311
+ #### 1. Initialize Budget (First!)
312
+
313
+ ```bash
314
+ python scripts/swarm_guard.py budget-init --task-id "task_001" --budget 10000
315
+ ```
316
+
317
+ #### 2. Budget-Aware Handoffs
318
+
319
+ ```bash
320
+ python scripts/swarm_guard.py intercept-handoff \
321
+ --task-id "task_001" \
322
+ --from orchestrator \
323
+ --to data_analyst \
324
+ --message "Analyze Q4 revenue data"
325
+ ```
326
+
327
+ Output (if allowed):
328
+ ```
329
+ HANDOFF ALLOWED: orchestrator -> data_analyst
330
+ Tokens spent: 156
331
+ Budget remaining: 9,844
332
+ Handoff #1 (remaining: 2)
333
+ -> Proceed with sessions_send
334
+ ```
335
+
336
+ #### 3. Check Permissions
337
+
338
+ ```bash
339
+ python scripts/check_permission.py \
340
+ --agent data_analyst \
341
+ --resource DATABASE \
342
+ --justification "Need customer order history for sales report"
343
+ ```
344
+
345
+ Output:
346
+ ```
347
+ GRANTED
348
+ Token: grant_85364b44d987...
349
+ Expires: 2026-02-04T15:30:00Z
350
+ Restrictions: read_only, max_records:100
351
+ ```
352
+
353
+ #### 3a. View Active Grants
354
+
355
+ See which agents currently hold access to which APIs:
356
+
357
+ ```bash
358
+ # Human-readable
359
+ python scripts/check_permission.py --active-grants
360
+
361
+ # Filter by agent
362
+ python scripts/check_permission.py --active-grants --agent data_analyst
363
+
364
+ # Machine-readable JSON
365
+ python scripts/check_permission.py --active-grants --json
366
+ ```
367
+
368
+ Output:
369
+ ```
370
+ Active Grants:
371
+ ======================================================================
372
+ Agent: data_analyst
373
+ Resource: DATABASE
374
+ Scope: read:orders
375
+ Token: grant_c1ea828897...
376
+ Remaining: 4.4 min
377
+ Restrictions: read_only, max_records:100
378
+ ------------------------------------------------------------------
379
+
380
+ Total: 1 active, 0 expired
381
+ ```
382
+
383
+ #### 3b. Audit Summary
384
+
385
+ Summarize permission activity across all agents:
386
+
387
+ ```bash
388
+ # Human-readable
389
+ python scripts/check_permission.py --audit-summary
390
+
391
+ # Last 50 entries, JSON output
392
+ python scripts/check_permission.py --audit-summary --last 50 --json
393
+ ```
394
+
395
+ Output:
396
+ ```
397
+ Audit Summary
398
+ ======================================================================
399
+ Requests: 12
400
+ Grants: 9
401
+ Denials: 3
402
+ Grant Rate: 75%
403
+
404
+ By Agent:
405
+ --------------------------------------------------
406
+ Agent Requests Grants Denials
407
+ data_analyst 4 3 1
408
+ orchestrator 5 4 1
409
+ strategy_advisor 3 2 1
410
+ ```
411
+
412
+ #### 4. Use the Blackboard
413
+
414
+ ```bash
415
+ # Write
416
+ python scripts/blackboard.py write "task:analysis" '{"status": "running"}'
417
+
418
+ # Read
419
+ python scripts/blackboard.py read "task:analysis"
420
+
421
+ # Atomic commit workflow (for multi-agent safety)
422
+ python scripts/blackboard.py propose "chg_001" "key" '{"value": 1}'
423
+ python scripts/blackboard.py validate "chg_001"
424
+ python scripts/blackboard.py commit "chg_001"
425
+
426
+ # List all keys
427
+ python scripts/blackboard.py list
428
+ ```
429
+
430
+ #### 5. Fan-Out / Fan-In with Shared Blackboard
431
+
432
+ Coordinate multiple specialized agents working on independent subtasks, then merge results:
433
+
434
+ ```typescript
435
+ import { LockedBlackboard } from 'network-ai';
436
+ import { Logger } from 'network-ai';
437
+
438
+ const logger = Logger.create('fan-out');
439
+ const board = new LockedBlackboard('.', logger, { conflictResolution: 'first-commit-wins' });
440
+
441
+ // Fan-out: each agent writes to its own section
442
+ const agents = ['reliability', 'security', 'cost', 'operations', 'performance'];
443
+
444
+ for (const pillar of agents) {
445
+ // Each agent evaluates independently, writes to its own key
446
+ const id = board.propose(`eval:${pillar}`, { score: Math.random(), findings: [] }, pillar);
447
+ board.validate(id, 'orchestrator');
448
+ board.commit(id);
449
+ }
450
+
451
+ // Fan-in: orchestrator reads all results and merges
452
+ const results = agents.map(pillar => ({
453
+ pillar,
454
+ ...board.read(`eval:${pillar}`)
455
+ }));
456
+
457
+ const summary = board.propose('eval:summary', {
458
+ overall: results.reduce((sum, r) => sum + r.score, 0) / results.length,
459
+ pillars: results
460
+ }, 'orchestrator');
461
+ board.validate(summary, 'orchestrator');
462
+ board.commit(summary);
463
+ ```
464
+
465
+ This pattern works with any framework adapter -- LangChain agents, AutoGen agents, CrewAI crews, or any mix. The blackboard ensures no agent overwrites another's results.
466
+
467
+ #### 6. Priority-Based Conflict Resolution (Phase 3)
468
+
469
+ ```typescript
470
+ import { LockedBlackboard } from 'network-ai';
471
+
472
+ // Enable priority-wins strategy
473
+ const board = new LockedBlackboard('.', { conflictResolution: 'priority-wins' });
474
+
475
+ // Low-priority worker proposes a change
476
+ const lowId = board.propose('shared:config', { mode: 'draft' }, 'worker', undefined, 1);
477
+
478
+ // High-priority supervisor proposes to same key
479
+ const highId = board.propose('shared:config', { mode: 'final' }, 'supervisor', undefined, 3);
480
+
481
+ // Worker commits first
482
+ board.validate(lowId, 'orchestrator');
483
+ board.commit(lowId);
484
+
485
+ // Supervisor validates -- higher priority wins despite stale hash
486
+ board.validate(highId, 'orchestrator'); // true (preempts worker's value)
487
+ board.commit(highId); // success
488
+
489
+ board.read('shared:config'); // { mode: 'final' } -- supervisor wins
490
+ ```
491
+
492
+ #### 7. Check Budget Status
493
+
494
+ ```bash
495
+ python scripts/swarm_guard.py budget-check --task-id "task_001"
496
+ python scripts/swarm_guard.py budget-report --task-id "task_001"
497
+ ```
498
+
499
+ ## Adapter System
500
+
501
+ The adapter system lets you plug any agent framework into the orchestrator. Each adapter implements the `IAgentAdapter` interface.
502
+
503
+ | Adapter | Framework | Agent Registration | Dependencies |
504
+ |---------|-----------|-------------------|-------------|
505
+ | `OpenClawAdapter` | OpenClaw | `registerSkill(name, skillRef)` | openclaw-core |
506
+ | `LangChainAdapter` | LangChain | `registerRunnable(name, runnable)` or `registerFunction(name, fn)` | None (BYOC) |
507
+ | `AutoGenAdapter` | AutoGen | `registerAgent(name, agent)` -- supports `.run()` and `.generateReply()` | None (BYOC) |
508
+ | `CrewAIAdapter` | CrewAI | `registerAgent(name, agent)` or `registerCrew(name, crew)` | None (BYOC) |
509
+ | `MCPAdapter` | MCP | `registerTool(name, handler)` | None (BYOC) |
510
+ | `LlamaIndexAdapter` | LlamaIndex | `registerQueryEngine()`, `registerChatEngine()`, `registerAgentRunner()` | None (BYOC) |
511
+ | `SemanticKernelAdapter` | Semantic Kernel | `registerKernel()`, `registerFunction()` | None (BYOC) |
512
+ | `OpenAIAssistantsAdapter` | OpenAI Assistants | `registerAssistant(name, config)` | None (BYOC) |
513
+ | `HaystackAdapter` | Haystack | `registerPipeline()`, `registerAgent()`, `registerComponent()` | None (BYOC) |
514
+ | `DSPyAdapter` | DSPy | `registerModule()`, `registerProgram()`, `registerPredictor()` | None (BYOC) |
515
+ | `AgnoAdapter` | Agno | `registerAgent()`, `registerTeam()`, `registerFunction()` | None (BYOC) |
516
+ | `CustomAdapter` | Any | `registerHandler(name, fn)` or `registerHttpAgent(name, config)` | None |
517
+
518
+ > **BYOC** = Bring Your Own Client. All adapters (except OpenClaw) are self-contained with zero npm dependencies. You provide your framework's SDK objects and the adapter wraps them.
519
+
520
+ ### Writing a Custom Adapter
521
+
522
+ Extend `BaseAdapter`:
523
+
524
+ ```typescript
525
+ import { BaseAdapter } from 'network-ai';
526
+ import type { AgentPayload, AgentResult } from 'network-ai';
527
+
528
+ class MyAdapter extends BaseAdapter {
529
+ readonly name = 'my-framework';
530
+
531
+ async executeAgent(agentId: string, payload: AgentPayload): Promise<AgentResult> {
532
+ // Your framework-specific logic here
533
+ return { success: true, output: 'result', metadata: { adapter: this.name } };
534
+ }
535
+
536
+ async listAgents() { return []; }
537
+ async isAgentAvailable(id: string) { return true; }
538
+ }
539
+ ```
540
+
541
+ See [references/adapter-system.md](references/adapter-system.md) for the full adapter architecture guide.
542
+
543
+ ## Permission System
544
+
545
+ The AuthGuardian evaluates requests using:
546
+
547
+ | Factor | Weight | Description |
548
+ |--------|--------|-------------|
549
+ | Justification | 40% | Quality of business reason (hardened against prompt injection) |
550
+ | Trust Level | 30% | Agent's established trust |
551
+ | Risk Assessment | 30% | Resource sensitivity + scope |
552
+
553
+ **Approval threshold: 0.5**
554
+
555
+ ### Resource Types
556
+
557
+ | Resource | Base Risk | Default Restrictions |
558
+ |----------|-----------|---------------------|
559
+ | `DATABASE` | 0.5 | `read_only`, `max_records:100` |
560
+ | `PAYMENTS` | 0.7 | `read_only`, `no_pii_fields`, `audit_required` |
561
+ | `EMAIL` | 0.4 | `rate_limit:10_per_minute` |
562
+ | `FILE_EXPORT` | 0.6 | `anonymize_pii`, `local_only` |
563
+
564
+ ## Security Module
565
+
566
+ The security module ([security.ts](security.ts)) provides defense-in-depth protections:
567
+
568
+ | Component | Class | Purpose |
569
+ |-----------|-------|---------|
570
+ | Token Manager | `SecureTokenManager` | HMAC-signed tokens with expiration |
571
+ | Input Sanitizer | `InputSanitizer` | XSS, injection, traversal prevention |
572
+ | Rate Limiter | `RateLimiter` | Per-agent request throttling + lockout |
573
+ | Encryptor | `DataEncryptor` | AES-256-GCM encryption for sensitive data |
574
+ | Permission Hardener | `PermissionHardener` | Trust-ceiling & privilege escalation prevention |
575
+ | Audit Logger | `SecureAuditLogger` | Cryptographically signed audit entries |
576
+ | Gateway | `SecureSwarmGateway` | Integrated security layer wrapping all ops |
577
+
578
+ ## Agent Trust Levels
579
+
580
+ | Agent | Trust | Role |
581
+ |-------|-------|------|
582
+ | `orchestrator` | 0.9 | Primary coordinator |
583
+ | `risk_assessor` | 0.85 | Compliance specialist |
584
+ | `data_analyst` | 0.8 | Data processing |
585
+ | `strategy_advisor` | 0.7 | Business strategy |
586
+ | Unknown | 0.5 | Default |
587
+
588
+ ## Handoff Protocol
589
+
590
+ Format messages for delegation:
591
+
592
+ ```
593
+ [HANDOFF]
594
+ Instruction: Analyze monthly sales by product category
595
+ Context: Using database export from ./data/sales_export.csv
596
+ Constraints: Focus on top 5 categories only
597
+ Expected Output: JSON summary with category, revenue, growth_pct
598
+ [/HANDOFF]
599
+ ```
600
+
601
+ ## Testing
602
+
603
+ Run all test suites:
604
+
605
+ ```bash
606
+ # All tests at once
607
+ npm run test:all
608
+
609
+ # Core orchestrator tests (79 tests)
610
+ npm test
611
+
612
+ # Security module tests (33 tests)
613
+ npm run test:security
614
+
615
+ # Adapter system tests (139 tests)
616
+ npm run test:adapters
617
+
618
+ # Full integration tests
619
+ npx ts-node test.ts
620
+ ```
621
+
622
+ Test Python scripts:
623
+
624
+ ```bash
625
+ # Test permission system
626
+ python scripts/check_permission.py --agent orchestrator --resource PAYMENTS \
627
+ --justification "Generating monthly revenue report for management" --json
628
+
629
+ # Test blackboard
630
+ python scripts/blackboard.py write "test:key" '{"value": 123}' --ttl 60
631
+ python scripts/blackboard.py read "test:key"
632
+
633
+ # Test TTL cleanup
634
+ python scripts/revoke_token.py --list-expired
635
+ python scripts/revoke_token.py --cleanup
636
+ ```
637
+
638
+ **Test results (315 total):**
639
+ - `test-standalone.ts` -- 79 passed (blackboard, auth, integration, persistence, parallelization, coding domain, quality gate)
640
+ - `test-security.ts` -- 33 passed (tokens, sanitization, rate limiting, encryption, permissions, audit)
641
+ - `test-adapters.ts` -- 139 passed (12 adapters: Custom, LangChain, AutoGen, CrewAI, MCP, LlamaIndex, Semantic Kernel, OpenAI Assistants, Haystack, DSPy, Agno + registry routing, integration, edge cases)
642
+ - `test-priority.ts` -- 64 passed (priority-based preemption, conflict resolution, constructor overloads, backward compatibility)
643
+
644
+ ## Audit Trail
645
+
646
+ Logged events: `permission_granted`, `permission_denied`, `permission_revoked`, `ttl_cleanup`, `result_validated`
647
+
648
+ The security module's `SecureAuditLogger` produces cryptographically signed entries that can be verified for tamper detection.
649
+
650
+ ## Documentation
651
+
652
+ - [QUICKSTART.md](QUICKSTART.md) -- 5-minute getting-started guide
653
+ - [SKILL.md](SKILL.md) -- Main skill instructions (includes Orchestrator protocol)
654
+ - [references/adapter-system.md](references/adapter-system.md) -- Adapter architecture & writing custom adapters
655
+ - [references/auth-guardian.md](references/auth-guardian.md) -- Permission system details
656
+ - [references/blackboard-schema.md](references/blackboard-schema.md) -- Data structures
657
+ - [references/trust-levels.md](references/trust-levels.md) -- Trust configuration
658
+ - [references/mcp-roadmap.md](references/mcp-roadmap.md) -- MCP networking implementation plan
659
+
660
+ ## Configuration
661
+
662
+ ### Modify Trust Levels
663
+
664
+ Edit `scripts/check_permission.py`:
665
+
666
+ ```python
667
+ DEFAULT_TRUST_LEVELS = {
668
+ "orchestrator": 0.9,
669
+ "my_new_agent": 0.75, # Add your agent
670
+ }
671
+ ```
672
+
673
+ ### Adjust Token TTL
674
+
675
+ ```python
676
+ GRANT_TOKEN_TTL_MINUTES = 5 # Change as needed
677
+ ```
678
+
679
+ ## Exports
680
+
681
+ The module exports everything needed for programmatic use:
682
+
683
+ ```typescript
684
+ // Core classes
685
+ import SwarmOrchestrator, { SharedBlackboard, AuthGuardian, TaskDecomposer } from 'network-ai';
686
+ import { BlackboardValidator, QualityGateAgent } from 'network-ai';
687
+
688
+ // Factory
689
+ import { createSwarmOrchestrator } from 'network-ai';
690
+
691
+ // Adapters (all 12)
692
+ import {
693
+ AdapterRegistry, BaseAdapter,
694
+ OpenClawAdapter, LangChainAdapter, AutoGenAdapter,
695
+ CrewAIAdapter, MCPAdapter, CustomAdapter,
696
+ LlamaIndexAdapter, SemanticKernelAdapter, OpenAIAssistantsAdapter,
697
+ HaystackAdapter, DSPyAdapter, AgnoAdapter,
698
+ } from 'network-ai';
699
+
700
+ // Types
701
+ import type {
702
+ IAgentAdapter, AgentPayload, AgentContext, AgentResult, AgentInfo,
703
+ AdapterConfig, AdapterCapabilities,
704
+ TaskPayload, HandoffMessage, PermissionGrant, SwarmState,
705
+ AgentStatus, ParallelTask, ParallelExecutionResult, SynthesisStrategy,
706
+ } from 'network-ai';
707
+ ```
708
+
709
+ ## License
710
+
711
+ MIT License -- See [LICENSE](LICENSE)
712
+
713
+ ## Contributing
714
+
715
+ If you find Network-AI useful, **give it a star** -- it helps others discover the project and motivates development:
716
+
717
+ [![Star on GitHub](https://img.shields.io/github/stars/jovanSAPFIONEER/Network-AI?style=social)](https://github.com/jovanSAPFIONEER/Network-AI)
718
+
719
+ **Want to contribute code?**
720
+
721
+ 1. Fork the repository
722
+ 2. Create a feature branch
723
+ 3. Make your changes
724
+ 4. Run all tests (`npm run test:all`)
725
+ 5. Submit a pull request
726
+
727
+ **Other ways to help:**
728
+ - Report bugs or suggest features via [Issues](https://github.com/jovanSAPFIONEER/Network-AI/issues)
729
+ - Share Network-AI with your team or on social media
730
+ - Write about your experience using it
731
+
732
+ ---
733
+
734
+ **Compatible with 12 agent frameworks: OpenClaw, LangChain, AutoGen, CrewAI, MCP, LlamaIndex, Semantic Kernel, OpenAI Assistants, Haystack, DSPy, Agno, and any custom adapter**
735
+
736
+ ## Competitive Comparison
737
+
738
+ How Network-AI compares to other multi-agent frameworks:
739
+
740
+ | Capability | Network-AI | LangChain/LangGraph | AutoGen/AG2 | CrewAI | Claude SDK |
741
+ |---|---|---|---|---|---|
742
+ | **Multi-framework support** | 12 adapters | LangChain only | AutoGen only | CrewAI only | Claude only |
743
+ | **Shared state (blackboard)** | Atomic commits, TTL, priority | LangGraph state | Shared context | Shared memory | Project memory |
744
+ | **Conflict resolution** | Priority preemption, last-write-wins | None | None | None | None |
745
+ | **Fan-out / fan-in** | Native (parallel + merge) | LangGraph branches | Group chat | Parallel tasks | Subagents |
746
+ | **Permission gating** | AuthGuardian (weighted scoring) | None | None | None | None |
747
+ | **Budget tracking** | Token ceiling + per-task budgets | Callbacks only | None | None | None |
748
+ | **Audit trail** | HMAC-signed, tamper-evident | None | None | None | None |
749
+ | **Encryption at rest** | AES-256-GCM | None | None | None | None |
750
+ | **Observability** | `--active-grants`, `--audit-summary` | LangSmith (SaaS) | None | None | None |
751
+ | **Rate limiting** | Per-agent with lockout | None | None | None | None |
752
+ | **Justification hardening** | 16-pattern injection defense | None | None | None | None |
753
+ | **Language** | TypeScript/Node.js | Python | Python | Python | Python |
754
+ | **Dependencies** | Zero (per adapter) | Heavy | Heavy | Heavy | Moderate |
755
+ | **License** | MIT | MIT | CC-BY-4.0 | MIT | MIT |
756
+
757
+ **Key differentiator:** Network-AI is the only framework that combines multi-framework orchestration with a governance layer (permissions, audit, encryption, budget enforcement). Other frameworks focus on one LLM provider; Network-AI wraps all of them.
758
+
759
+ ## Related Concepts
760
+
761
+ Network-AI fits into the broader AI agent ecosystem:
762
+
763
+ - **Multi-Agent Systems** -- Coordinate multiple AI agents working together on complex tasks
764
+ - **Agentic AI** -- Build autonomous agents that reason, plan, and execute using LLMs
765
+ - **Behavioral Control Plane** -- Govern agent behavior with permission gating, compliance enforcement, and audit trails
766
+ - **Swarm Intelligence** -- Parallel fan-out/fan-in patterns with voting, merging, and chain strategies
767
+ - **Model Context Protocol (MCP)** -- Standard protocol support for LLM tool integration
768
+ - **Agent-to-Agent (A2A)** -- Inter-agent communication via shared blackboard and handoff protocol
769
+ - **Context Engineering** -- Manage and share context across agent boundaries
770
+ - **Agentic Workflows** -- Task decomposition, parallel processing, and synthesis pipelines
771
+ - **LLM Orchestration** -- Route tasks to the right agent framework automatically
772
+ - **Agent Governance** -- Permission gating, budget enforcement, audit logging, and compliance monitoring
773
+
774
+ If you're using LangGraph, Dify, Flowise, PraisonAI, AutoGen/AG2, CrewAI, or any other agent framework, Network-AI can integrate with it through the adapter system.
775
+
776
+ ---
777
+
778
+ <details>
779
+ <summary>Keywords (for search)</summary>
780
+
781
+ ai-agents, agentic-ai, multi-agent, multi-agent-systems, multi-agent-system, agent-framework, ai-agent-framework, agentic-framework, agentic-workflow, llm, llm-agents, llm-agent, large-language-models, generative-ai, genai, orchestration, ai-orchestration, swarm, swarm-intelligence, autonomous-agents, agents, ai, typescript, nodejs, mcp, model-context-protocol, a2a, agent-to-agent, function-calling, tool-integration, context-engineering, rag, ai-safety, multi-agents-collaboration, multi-agents, aiagents, aiagentframework, plug-and-play, adapter-registry, blackboard-pattern, agent-coordination, agent-handoffs, token-permissions, budget-tracking, cost-awareness, atomic-commits, hallucination-detection, content-quality-gate, behavioral-control-plane, governance-layer, compliance-enforcement, fan-out-fan-in, agent-observability, permission-gating, audit-trail, OpenClaw, Clawdbot, Moltbot, Clawdbot Swarm, Moltbot Security, Moltbot multi-agent, OpenClaw skills, AgentSkills, LangChain adapter, LangGraph, AutoGen adapter, AG2, CrewAI adapter, MCP adapter, LlamaIndex adapter, Semantic Kernel adapter, OpenAI Assistants adapter, Haystack adapter, DSPy adapter, Agno adapter, Phidata adapter, Dify, Flowise, PraisonAI, custom-adapter, AES-256 encryption, HMAC tokens, rate limiting, input sanitization, privilege escalation prevention, ClawHub, clawhub, agentic-rag, deep-research, workflow-orchestration, ai-assistant, ai-tools, developer-tools, open-source
782
+
783
+ </details>