graphbus 0.1.0__tar.gz

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.
Files changed (102) hide show
  1. graphbus-0.1.0/LICENSE +21 -0
  2. graphbus-0.1.0/PKG-INFO +495 -0
  3. graphbus-0.1.0/README.md +452 -0
  4. graphbus-0.1.0/graphbus-mcp-server/server.py +184 -0
  5. graphbus-0.1.0/graphbus.egg-info/PKG-INFO +495 -0
  6. graphbus-0.1.0/graphbus.egg-info/SOURCES.txt +100 -0
  7. graphbus-0.1.0/graphbus.egg-info/dependency_links.txt +1 -0
  8. graphbus-0.1.0/graphbus.egg-info/entry_points.txt +3 -0
  9. graphbus-0.1.0/graphbus.egg-info/requires.txt +20 -0
  10. graphbus-0.1.0/graphbus.egg-info/top_level.txt +8 -0
  11. graphbus-0.1.0/graphbus_agent/__init__.py +20 -0
  12. graphbus-0.1.0/graphbus_agent/__main__.py +84 -0
  13. graphbus-0.1.0/graphbus_agent/auth.py +99 -0
  14. graphbus-0.1.0/graphbus_agent/claude_client.py +164 -0
  15. graphbus-0.1.0/graphbus_agent/runner.py +155 -0
  16. graphbus-0.1.0/graphbus_cli/__init__.py +5 -0
  17. graphbus-0.1.0/graphbus_cli/commands/__init__.py +3 -0
  18. graphbus-0.1.0/graphbus_cli/commands/build.py +327 -0
  19. graphbus-0.1.0/graphbus_cli/commands/ci.py +450 -0
  20. graphbus-0.1.0/graphbus_cli/commands/coherence.py +461 -0
  21. graphbus-0.1.0/graphbus_cli/commands/contract.py +477 -0
  22. graphbus-0.1.0/graphbus_cli/commands/dashboard.py +694 -0
  23. graphbus-0.1.0/graphbus_cli/commands/docker.py +474 -0
  24. graphbus-0.1.0/graphbus_cli/commands/generate.py +429 -0
  25. graphbus-0.1.0/graphbus_cli/commands/init.py +115 -0
  26. graphbus-0.1.0/graphbus_cli/commands/inspect.py +390 -0
  27. graphbus-0.1.0/graphbus_cli/commands/inspect_negotiation.py +259 -0
  28. graphbus-0.1.0/graphbus_cli/commands/k8s.py +495 -0
  29. graphbus-0.1.0/graphbus_cli/commands/migrate.py +332 -0
  30. graphbus-0.1.0/graphbus_cli/commands/negotiate.py +417 -0
  31. graphbus-0.1.0/graphbus_cli/commands/profile.py +335 -0
  32. graphbus-0.1.0/graphbus_cli/commands/run.py +308 -0
  33. graphbus-0.1.0/graphbus_cli/commands/state.py +152 -0
  34. graphbus-0.1.0/graphbus_cli/commands/tui.py +74 -0
  35. graphbus-0.1.0/graphbus_cli/commands/validate.py +263 -0
  36. graphbus-0.1.0/graphbus_cli/hooks.py +178 -0
  37. graphbus-0.1.0/graphbus_cli/main.py +127 -0
  38. graphbus-0.1.0/graphbus_cli/repl/__init__.py +3 -0
  39. graphbus-0.1.0/graphbus_cli/repl/runtime_repl.py +663 -0
  40. graphbus-0.1.0/graphbus_cli/templates/__init__.py +52 -0
  41. graphbus-0.1.0/graphbus_cli/templates/base.py +61 -0
  42. graphbus-0.1.0/graphbus_cli/templates/basic.py +356 -0
  43. graphbus-0.1.0/graphbus_cli/templates/chatbot.py +134 -0
  44. graphbus-0.1.0/graphbus_cli/templates/etl.py +211 -0
  45. graphbus-0.1.0/graphbus_cli/templates/microservices.py +173 -0
  46. graphbus-0.1.0/graphbus_cli/templates/workflow.py +196 -0
  47. graphbus-0.1.0/graphbus_cli/utils/__init__.py +3 -0
  48. graphbus-0.1.0/graphbus_cli/utils/config.py +150 -0
  49. graphbus-0.1.0/graphbus_cli/utils/errors.py +282 -0
  50. graphbus-0.1.0/graphbus_cli/utils/output.py +148 -0
  51. graphbus-0.1.0/graphbus_cli/utils/websocket.py +185 -0
  52. graphbus-0.1.0/graphbus_cli/websocket_server.py +280 -0
  53. graphbus-0.1.0/graphbus_core/__init__.py +23 -0
  54. graphbus-0.1.0/graphbus_core/agents/__init__.py +11 -0
  55. graphbus-0.1.0/graphbus_core/agents/agent.py +646 -0
  56. graphbus-0.1.0/graphbus_core/agents/llm_client.py +106 -0
  57. graphbus-0.1.0/graphbus_core/agents/negotiation.py +224 -0
  58. graphbus-0.1.0/graphbus_core/agents/negotiation_async.py +278 -0
  59. graphbus-0.1.0/graphbus_core/agents/negotiation_client.py +234 -0
  60. graphbus-0.1.0/graphbus_core/agents/schemas.py +226 -0
  61. graphbus-0.1.0/graphbus_core/build/__init__.py +16 -0
  62. graphbus-0.1.0/graphbus_core/build/artifacts.py +158 -0
  63. graphbus-0.1.0/graphbus_core/build/builder.py +212 -0
  64. graphbus-0.1.0/graphbus_core/build/code_writer.py +200 -0
  65. graphbus-0.1.0/graphbus_core/build/contract_validator.py +344 -0
  66. graphbus-0.1.0/graphbus_core/build/extractor.py +347 -0
  67. graphbus-0.1.0/graphbus_core/build/graph_builder.py +193 -0
  68. graphbus-0.1.0/graphbus_core/build/negotiation_session.py +665 -0
  69. graphbus-0.1.0/graphbus_core/build/orchestrator.py +870 -0
  70. graphbus-0.1.0/graphbus_core/build/refactoring.py +352 -0
  71. graphbus-0.1.0/graphbus_core/build/scanner.py +131 -0
  72. graphbus-0.1.0/graphbus_core/config.py +86 -0
  73. graphbus-0.1.0/graphbus_core/constants.py +19 -0
  74. graphbus-0.1.0/graphbus_core/decorators.py +467 -0
  75. graphbus-0.1.0/graphbus_core/exceptions.py +89 -0
  76. graphbus-0.1.0/graphbus_core/model/__init__.py +29 -0
  77. graphbus-0.1.0/graphbus_core/model/agent_def.py +99 -0
  78. graphbus-0.1.0/graphbus_core/model/graph.py +185 -0
  79. graphbus-0.1.0/graphbus_core/model/message.py +210 -0
  80. graphbus-0.1.0/graphbus_core/model/prompt.py +19 -0
  81. graphbus-0.1.0/graphbus_core/model/schema.py +81 -0
  82. graphbus-0.1.0/graphbus_core/model/serialization.py +95 -0
  83. graphbus-0.1.0/graphbus_core/model/topic.py +41 -0
  84. graphbus-0.1.0/graphbus_core/node_base.py +366 -0
  85. graphbus-0.1.0/graphbus_core/runtime/__init__.py +22 -0
  86. graphbus-0.1.0/graphbus_core/runtime/coherence.py +700 -0
  87. graphbus-0.1.0/graphbus_core/runtime/contracts.py +595 -0
  88. graphbus-0.1.0/graphbus_core/runtime/debugger.py +297 -0
  89. graphbus-0.1.0/graphbus_core/runtime/event_router.py +168 -0
  90. graphbus-0.1.0/graphbus_core/runtime/executor.py +704 -0
  91. graphbus-0.1.0/graphbus_core/runtime/health.py +396 -0
  92. graphbus-0.1.0/graphbus_core/runtime/hot_reload.py +303 -0
  93. graphbus-0.1.0/graphbus_core/runtime/loader.py +241 -0
  94. graphbus-0.1.0/graphbus_core/runtime/message_bus.py +199 -0
  95. graphbus-0.1.0/graphbus_core/runtime/migrations.py +648 -0
  96. graphbus-0.1.0/graphbus_core/runtime/monitoring.py +310 -0
  97. graphbus-0.1.0/graphbus_core/runtime/profiler.py +798 -0
  98. graphbus-0.1.0/graphbus_core/runtime/state.py +212 -0
  99. graphbus-0.1.0/graphbus_core/utils.py +112 -0
  100. graphbus-0.1.0/pyproject.toml +55 -0
  101. graphbus-0.1.0/setup.cfg +4 -0
  102. graphbus-0.1.0/setup.py +3 -0
graphbus-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 GraphBus
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,495 @@
1
+ Metadata-Version: 2.4
2
+ Name: graphbus
3
+ Version: 0.1.0
4
+ Summary: Multi-agent orchestration framework — LLM-powered agents negotiate, refactor, and evolve your codebase
5
+ Author-email: GraphBus Team <hello@graphbus.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://graphbus.com
8
+ Project-URL: Documentation, https://graphbus.com/docs
9
+ Project-URL: Repository, https://github.com/graphbus/graphbus-core
10
+ Project-URL: Bug Tracker, https://github.com/graphbus/graphbus-core/issues
11
+ Keywords: agents,llm,orchestration,multi-agent,code-evolution,negotiation
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
22
+ Requires-Python: >=3.9
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Requires-Dist: networkx>=3.0
26
+ Requires-Dist: litellm>=1.0.0
27
+ Requires-Dist: click>=8.1.0
28
+ Requires-Dist: rich>=13.0.0
29
+ Requires-Dist: PyYAML>=6.0
30
+ Requires-Dist: websockets>=12.0
31
+ Requires-Dist: httpx>=0.25.0
32
+ Requires-Dist: python-dotenv>=1.0.0
33
+ Provides-Extra: dev
34
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
35
+ Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
36
+ Provides-Extra: server
37
+ Requires-Dist: firebase-admin>=6.0.0; extra == "server"
38
+ Requires-Dist: fastapi>=0.100.0; extra == "server"
39
+ Requires-Dist: uvicorn[standard]>=0.24.0; extra == "server"
40
+ Provides-Extra: tui
41
+ Requires-Dist: textual>=0.47.0; extra == "tui"
42
+ Dynamic: license-file
43
+
44
+ # GraphBus
45
+
46
+ <div align="center">
47
+
48
+ **A multi-agent orchestration protocol where LLM-powered agents negotiate, refactor, and evolve your codebase — then run it statically at zero AI cost.**
49
+
50
+ [![License: MIT](https://img.shields.io/badge/License-MIT-purple.svg)](https://opensource.org/licenses/MIT)
51
+ [![Python 3.9+](https://img.shields.io/badge/python-3.9%2B-blue.svg)](https://www.python.org/downloads/)
52
+ [![Build Status](https://img.shields.io/badge/tests-passing-brightgreen.svg)](#testing)
53
+ [![Version](https://img.shields.io/badge/version-0.1.0--alpha-orange.svg)](https://github.com/graphbus/graphbus-core/releases)
54
+ [![graphbus.com](https://img.shields.io/badge/site-graphbus.com-7c3aed.svg)](https://graphbus.com)
55
+
56
+ [**Website**](https://graphbus.com) · [**Quickstart**](#quickstart) · [**Examples**](#examples) · [**CLI Reference**](#cli-reference) · [**Architecture**](#architecture)
57
+
58
+ </div>
59
+
60
+ ---
61
+
62
+ ## What is GraphBus?
63
+
64
+ GraphBus is a Python framework with a radical idea: **let your agents improve the code itself, not just run it.**
65
+
66
+ Every class in a GraphBus project is a potential LLM agent. During a **build cycle**, agents wake up, read their own source, propose improvements, and negotiate consensus with other agents via a typed message bus. An arbiter resolves conflicts. The result is committed back to source.
67
+
68
+ At **runtime**, none of that happens. The built artifacts execute as plain, deterministic Python — no LLM calls, no network latency, zero AI cost.
69
+
70
+ ```
71
+ Build once (agents active) → Deploy forever (agents dormant, code immutable)
72
+ ```
73
+
74
+ ### Why this matters
75
+
76
+ Most LLM orchestration frameworks call LLMs at runtime — forever. Every user request burns tokens. GraphBus inverts this: the intelligence is spent once at build time to improve the code, and the improved code runs cheaply at scale.
77
+
78
+ ---
79
+
80
+ ## Getting Started
81
+
82
+ GraphBus uses two keys for different purposes:
83
+
84
+ **LLM provider key** — powers LLM agent negotiation via [LiteLLM](https://docs.litellm.ai/docs/providers). Set the key for your chosen provider:
85
+ ```bash
86
+ export DEEPSEEK_API_KEY=... # default model: deepseek/deepseek-reasoner
87
+ export ANTHROPIC_API_KEY=sk-ant-... # for claude-* models
88
+ export OPENAI_API_KEY=sk-... # for gpt-* models
89
+ export OPENROUTER_API_KEY=... # access all models with one key
90
+ ```
91
+
92
+ **GraphBus API key** *(optional)* — warehouses your negotiation history, contracts, and cross-session memory at [api.graphbus.com](https://graphbus.com). Without it, negotiation works fine but history isn't persisted.
93
+ ```bash
94
+ export GRAPHBUS_API_KEY=gb_... # sign up at graphbus.com
95
+ ```
96
+
97
+ ---
98
+
99
+ ## Quickstart
100
+
101
+ ```bash
102
+ # Install
103
+ pip install graphbus
104
+
105
+ # Create a new project
106
+ graphbus init my-project --template microservices
107
+ cd my-project
108
+
109
+ # Build (static, no LLM)
110
+ graphbus build agents/
111
+
112
+ # Run the built artifacts
113
+ graphbus run .graphbus/
114
+
115
+ # Enable LLM agents for a negotiation round
116
+ export DEEPSEEK_API_KEY=your_key_here # or ANTHROPIC_API_KEY=sk-ant-...
117
+ graphbus build agents/ --enable-agents
118
+ ```
119
+
120
+ That's it. Your agents will propose improvements, evaluate each other's proposals, and commit consensus changes. The `run` step uses zero AI budget.
121
+
122
+ ---
123
+
124
+ ## Hello World
125
+
126
+ ```python
127
+ # agents/hello_service.py
128
+ from graphbus_core import GraphBusNode, schema_method, subscribe
129
+
130
+ class HelloService(GraphBusNode):
131
+ SYSTEM_PROMPT = "I generate friendly greeting messages."
132
+
133
+ @schema_method(
134
+ input_schema={},
135
+ output_schema={"message": str}
136
+ )
137
+ def generate_message(self):
138
+ return {"message": "Hello from GraphBus!"}
139
+
140
+ @subscribe("/Hello/MessageGenerated")
141
+ def on_message(self, event):
142
+ self.log(event.payload)
143
+ ```
144
+
145
+ ```bash
146
+ graphbus build agents/
147
+ # [BUILD] Scanning agents/hello_service.py
148
+ # [BUILD] Graph: 1 node, 0 edges
149
+ # [BUILD] Artifacts written to .graphbus/
150
+
151
+ graphbus run .graphbus/
152
+ # [RUNTIME] Loaded 1 agent
153
+ # [RUNTIME] HelloService → "Hello from GraphBus!"
154
+ ```
155
+
156
+ Enable agents and watch them negotiate:
157
+
158
+ ```bash
159
+ export DEEPSEEK_API_KEY=your_key_here # or ANTHROPIC_API_KEY=sk-ant-...
160
+ graphbus build agents/ --enable-agents
161
+ # [AGENT] HelloService: "I propose adding input validation..."
162
+ # [AGENT] LoggerService: "I accept — improves contract safety"
163
+ # [ARBITER] Consensus reached. Committing changes.
164
+ # [BUILD] Artifacts written to .graphbus/ (2 files modified)
165
+ ```
166
+
167
+ ---
168
+
169
+ ## Architecture
170
+
171
+ GraphBus has two strictly separated modes:
172
+
173
+ ```
174
+ ┌─────────────────────────────────────────────────────────────────┐
175
+ │ BUILD MODE │
176
+ │ ┌──────────┐ proposals ┌─────────┐ evaluations ┌────────┐ │
177
+ │ │ AgentA │────────────▶│ BUS │◀──────────────│ AgentB │ │
178
+ │ │ (LLM) │◀────────────│ │───────────────▶│ (LLM) │ │
179
+ │ └──────────┘ commits └────┬────┘ └────────┘ │
180
+ │ │ │
181
+ │ ┌─────▼─────┐ │
182
+ │ │ Arbiter │ resolves conflicts │
183
+ │ └─────┬─────┘ │
184
+ │ │ │
185
+ │ ┌───────────▼──────────┐ │
186
+ │ │ Build Artifacts │ (.graphbus/) │
187
+ │ │ graph.json │ │
188
+ │ │ agents.json │ │
189
+ │ │ topics.json │ │
190
+ │ └───────────────────────┘ │
191
+ └─────────────────────────────────────────────────────────────────┘
192
+
193
+ ▼ (deploy once)
194
+ ┌─────────────────────────────────────────────────────────────────┐
195
+ │ RUNTIME MODE │
196
+ │ │
197
+ │ ┌──────────┐ events ┌─────────┐ events ┌──────────┐ │
198
+ │ │ AgentA │────────────▶│ BUS │────────────▶│ AgentB │ │
199
+ │ │ (static) │ │ (pub/ │ │ (static) │ │
200
+ │ └──────────┘ │ sub) │ └──────────┘ │
201
+ │ └─────────┘ │
202
+ │ │
203
+ │ ✅ No LLM calls ✅ Deterministic ✅ $0 AI cost │
204
+ └─────────────────────────────────────────────────────────────────┘
205
+ ```
206
+
207
+ ### Core Concepts
208
+
209
+ | Concept | Description |
210
+ |---|---|
211
+ | **GraphBusNode** | Base class for all agents. Subclass it, add a `SYSTEM_PROMPT`, decorate methods. |
212
+ | **@schema_method** | Declares typed input/output schema for a method — forms the contract between agents. |
213
+ | **@subscribe** | Registers a handler for a topic on the message bus. |
214
+ | **@depends_on** | Declares a dependency edge between agents in the DAG. |
215
+ | **Build Artifacts** | JSON files emitted after a build: `graph.json`, `agents.json`, `topics.json`. |
216
+ | **Arbiter** | A special agent (mark with `IS_ARBITER = True`) that resolves conflicting proposals. |
217
+ | **Message Bus** | Typed pub/sub backbone. Topics are typed paths (e.g. `/Order/Created`). |
218
+
219
+ ---
220
+
221
+ ## CLI Reference
222
+
223
+ GraphBus ships a full-featured CLI with 18 commands:
224
+
225
+ ```
226
+ graphbus [OPTIONS] COMMAND [ARGS]...
227
+ ```
228
+
229
+ ### Core Commands
230
+
231
+ | Command | Description |
232
+ |---|---|
233
+ | `graphbus build <path>` | Scan agents, build dependency graph, emit artifacts |
234
+ | `graphbus run <artifacts>` | Load artifacts and execute the runtime |
235
+ | `graphbus inspect <artifacts>` | Inspect build artifacts (graph, agents, topics) |
236
+ | `graphbus validate <path>` | Validate agent definitions without building |
237
+ | `graphbus tui` | Launch interactive TUI (keyboard-driven UI) |
238
+
239
+ ### Development Tools
240
+
241
+ | Command | Description |
242
+ |---|---|
243
+ | `graphbus init <name>` | Initialize a new project from template |
244
+ | `graphbus generate agent <Name>` | Generate agent boilerplate |
245
+ | `graphbus profile <artifacts>` | Profile runtime performance |
246
+ | `graphbus dashboard` | Launch web-based visualization dashboard |
247
+ | `graphbus negotiate <path>` | Run a standalone LLM negotiation round |
248
+ | `graphbus inspect-negotiation` | Browse negotiation history |
249
+
250
+ ### Deployment Tools
251
+
252
+ | Command | Description |
253
+ |---|---|
254
+ | `graphbus docker build` | Generate Dockerfile for your project |
255
+ | `graphbus docker run` | Build and run in Docker |
256
+ | `graphbus k8s generate` | Generate Kubernetes manifests |
257
+ | `graphbus k8s deploy` | Deploy to Kubernetes cluster |
258
+ | `graphbus ci github` | Generate GitHub Actions workflow |
259
+ | `graphbus ci gitlab` | Generate GitLab CI pipeline |
260
+
261
+ ### Advanced
262
+
263
+ | Command | Description |
264
+ |---|---|
265
+ | `graphbus state` | Manage agent state persistence |
266
+ | `graphbus coherence` | Run inter-agent coherence checks |
267
+ | `graphbus contract` | Validate schema contracts between agents |
268
+ | `graphbus migrate` | Migrate artifacts across schema versions |
269
+
270
+ ---
271
+
272
+ ## Examples
273
+
274
+ Three working examples are included in `examples/`:
275
+
276
+ ### 1. `hello_graphbus` — The basics
277
+
278
+ ```bash
279
+ cd examples/hello_graphbus
280
+ python build.py # Build without agents
281
+ DEEPSEEK_API_KEY=your_key python build.py # Build with LLM agents
282
+ python run.py # Run the built artifacts
283
+ ```
284
+
285
+ ### 2. `hello_world_mcp` — MCP integration
286
+
287
+ GraphBus ships an MCP (Model Context Protocol) server so any MCP-compatible client can interact with a running GraphBus runtime as a tool.
288
+
289
+ ```bash
290
+ cd examples/hello_world_mcp
291
+ graphbus build agents/
292
+ graphbus run .graphbus/ --mcp # Exposes MCP endpoint
293
+ ```
294
+
295
+ ### 3. `news_summarizer` — Real-world pipeline
296
+
297
+ A multi-agent news summarization pipeline. One agent fetches, one summarizes, one formats. Agents negotiate a shared schema for the summary output during build; runtime executes deterministically.
298
+
299
+ ```bash
300
+ cd examples/news_summarizer
301
+ graphbus build agents/
302
+ OPENAI_API_KEY=sk-... graphbus run .graphbus/
303
+ ```
304
+
305
+ ---
306
+
307
+ ## The Negotiation Protocol
308
+
309
+ When `--enable-agents` is set, each agent gets an LLM instance. Build Mode runs this cycle:
310
+
311
+ ```
312
+ 1. SCAN → Discover all GraphBusNode subclasses in the target path
313
+ 2. EXTRACT → Parse methods, schemas, subscriptions, system prompts
314
+ 3. BUILD → Construct networkx DAG (topological sort for eval order)
315
+ 4. ACTIVATE → Instantiate one LLM agent per node
316
+ 5. PROPOSE → Each agent reads its source and proposes improvements
317
+ 6. EVALUATE → Agents evaluate each other's proposals (accept/reject + reasoning)
318
+ 7. ARBITRATE → Arbiter resolves split decisions
319
+ 8. COMMIT → Accepted proposals are applied to source files
320
+ 9. ARTIFACT → Build graph + agent metadata serialized to .graphbus/
321
+ ```
322
+
323
+ Proposals are structured messages:
324
+
325
+ ```python
326
+ class Proposal:
327
+ agent_id: str
328
+ target_file: str
329
+ diff: str # unified diff
330
+ rationale: str # LLM reasoning
331
+ affects: list[str] # other agents impacted
332
+ ```
333
+
334
+ ---
335
+
336
+ ## Project Structure
337
+
338
+ ```
339
+ graphbus-core/
340
+ ├── graphbus_core/ # Core library
341
+ │ ├── node_base.py # GraphBusNode base class
342
+ │ ├── decorators.py # @schema_method, @subscribe, @depends_on
343
+ │ ├── config.py # BuildConfig, RuntimeConfig
344
+ │ ├── build/ # Build pipeline (scanner, extractor, builder, writer)
345
+ │ ├── runtime/ # Runtime engine (loader, bus, router, executor)
346
+ │ ├── agents/ # LLM agent wrappers
347
+ │ └── model/ # Pydantic models (Message, Event, Proposal, ...)
348
+ ├── graphbus_cli/ # CLI (click + rich)
349
+ │ ├── main.py # Entry point
350
+ │ ├── commands/ # One file per command group
351
+ │ └── repl/ # Interactive REPL
352
+ ├── graphbus_api/ # REST API server
353
+ ├── graphbus-mcp-server/ # MCP protocol server
354
+ ├── examples/
355
+ │ ├── hello_graphbus/ # Basic example
356
+ │ ├── hello_world_mcp/ # MCP integration
357
+ │ └── news_summarizer/ # Real-world pipeline
358
+ ├── tests/ # Full test suite
359
+ └── docs/
360
+ └── core/ # Architecture docs
361
+ ```
362
+
363
+ ---
364
+
365
+ ## vs. LangGraph / CrewAI / AutoGen
366
+
367
+ | | **GraphBus** | LangGraph | CrewAI | AutoGen |
368
+ |---|---|---|---|---|
369
+ | Agents rewrite source code | ✅ Core feature | ❌ | ❌ | ⚠️ Limited |
370
+ | Zero LLM cost at runtime | ✅ Always | ❌ Every call | ❌ Every call | ❌ Every call |
371
+ | Agent negotiation / consensus | ✅ Built-in | ❌ | ⚠️ Partial | ⚠️ Partial |
372
+ | Graph-native DAG orchestration | ✅ networkx | ✅ | ❌ | ❌ |
373
+ | Typed schema contracts per edge | ✅ | ⚠️ Partial | ❌ | ❌ |
374
+ | Build / Runtime mode separation | ✅ Core design | ❌ | ❌ | ❌ |
375
+ | Full deployment tooling (K8s/Docker) | ✅ CLI native | ❌ | ❌ | ❌ |
376
+ | Interactive TUI | ✅ | ❌ | ❌ | ❌ |
377
+
378
+ The key difference: **other frameworks run agents to perform tasks. GraphBus runs agents to improve the code that performs tasks.** After a build cycle, the intelligence is baked into static artifacts — not perpetually consumed at runtime.
379
+
380
+ ---
381
+
382
+ ## Installation
383
+
384
+ ### From source (current)
385
+
386
+ ```bash
387
+ git clone https://github.com/graphbus/graphbus-core
388
+ cd graphbus-core
389
+ pip install -e .
390
+ ```
391
+
392
+ ### From PyPI (coming soon)
393
+
394
+ ```bash
395
+ pip install graphbus
396
+ ```
397
+
398
+ ### Requirements
399
+
400
+ - Python 3.9+
401
+ - networkx >= 3.0
402
+ - click >= 8.1.0
403
+ - rich >= 13.0.0
404
+
405
+ Optional (for LLM agents):
406
+ - `litellm` — all LLM providers (Anthropic, OpenAI, DeepSeek, OpenRouter, etc.)
407
+
408
+ Optional (for TUI):
409
+ - `textual >= 0.47.0`
410
+
411
+ ---
412
+
413
+ ## Testing
414
+
415
+ ```bash
416
+ # Run all tests
417
+ pytest
418
+
419
+ # With coverage
420
+ pytest --cov=graphbus_core --cov-report=term-missing
421
+
422
+ # Run a specific test suite
423
+ pytest tests/test_runtime/
424
+ pytest tests/test_build/
425
+ ```
426
+
427
+ **Test coverage:**
428
+ - Build pipeline: 100% passing (scanner, extractor, graph builder, artifact writer)
429
+ - Runtime engine: 100% passing (loader, message bus, event router, executor)
430
+ - End-to-end: Hello World example builds and runs clean
431
+ - CLI: All commands smoke-tested
432
+
433
+ ---
434
+
435
+ ## Contributing
436
+
437
+ GraphBus is in alpha and we welcome contributors. See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
438
+
439
+ Quick start for contributors:
440
+
441
+ ```bash
442
+ git clone https://github.com/graphbus/graphbus-core
443
+ cd graphbus-core
444
+ pip install -e ".[dev]"
445
+ pytest # Make sure everything passes
446
+ ```
447
+
448
+ Areas where we especially want help:
449
+ - **More LLM backends** — LiteLLM integration supports many providers; help us test them
450
+ - **More examples** — real-world pipelines showing agent negotiation
451
+ - **Documentation** — architecture docs, tutorials, protocol spec
452
+ - **Benchmarks** — latency/cost comparisons vs. runtime LLM frameworks
453
+
454
+ ---
455
+
456
+ ## Roadmap
457
+
458
+ See **[ROADMAP.md](ROADMAP.md)** for the full roadmap with targets and status.
459
+
460
+ **What's shipped (v0.1 alpha):**
461
+ - [x] Build Mode (scanner → extractor → graph builder → artifact writer)
462
+ - [x] Runtime Mode (loader → message bus → event router → executor)
463
+ - [x] CLI with 18 commands
464
+ - [x] LLM negotiation engine (propose / evaluate / arbitrate / commit)
465
+ - [x] MCP server integration
466
+ - [x] Docker + Kubernetes deployment tooling
467
+ - [x] 800+ tests, CI with GitHub Actions
468
+
469
+ **Coming next (v0.2):**
470
+ - [ ] `graphbus dev` — hot-reload mode during development
471
+ - [ ] Message trace UI — replay message flows in a web UI
472
+ - [ ] `graphbus test` — agent unit tests with full runtime wired in
473
+
474
+ **Later:**
475
+ - [ ] PyPI release (`pip install graphbus`)
476
+ - [x] Multi-provider LLM support (via LiteLLM)
477
+ - [ ] Ollama local LLM backend
478
+ - [ ] Multi-process distributed runtime
479
+ - [ ] TypeScript SDK
480
+ - [ ] Protocol specification (for non-Python implementations)
481
+
482
+ Want to influence what ships next? [Open a GitHub Discussion](https://github.com/graphbus/graphbus-core/discussions) or 👍 the relevant issue.
483
+
484
+ ---
485
+
486
+ ## License
487
+
488
+ MIT. See [LICENSE](LICENSE).
489
+
490
+ ---
491
+
492
+ ## Links
493
+
494
+ - 🌐 [graphbus.com](https://graphbus.com) — Landing page + waitlist
495
+ - 📧 [hello@graphbus.com](mailto:hello@graphbus.com) — Questions, feedback, partnership