ormica 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.
- ormica-0.1.0/LICENSE +21 -0
- ormica-0.1.0/PKG-INFO +493 -0
- ormica-0.1.0/README.md +438 -0
- ormica-0.1.0/ormica/__init__.py +31 -0
- ormica-0.1.0/ormica/agent.py +332 -0
- ormica-0.1.0/ormica/arbor/__init__.py +29 -0
- ormica-0.1.0/ormica/arbor/branch.py +22 -0
- ormica-0.1.0/ormica/arbor/exceptions.py +17 -0
- ormica-0.1.0/ormica/arbor/node.py +70 -0
- ormica-0.1.0/ormica/arbor/policy.py +24 -0
- ormica-0.1.0/ormica/arbor/tree.py +97 -0
- ormica-0.1.0/ormica/brain/__init__.py +76 -0
- ormica-0.1.0/ormica/brain/claude.py +184 -0
- ormica-0.1.0/ormica/brain/gemini.py +249 -0
- ormica-0.1.0/ormica/brain/gpt.py +189 -0
- ormica-0.1.0/ormica/brain/mock.py +149 -0
- ormica-0.1.0/ormica/brain/protocol.py +56 -0
- ormica-0.1.0/ormica/brain/providers.py +190 -0
- ormica-0.1.0/ormica/brain/router.py +34 -0
- ormica-0.1.0/ormica/brain/tool.py +107 -0
- ormica-0.1.0/ormica/brain/types.py +65 -0
- ormica-0.1.0/ormica/brain/universal.py +160 -0
- ormica-0.1.0/ormica/canopy/__init__.py +26 -0
- ormica-0.1.0/ormica/canopy/approver.py +34 -0
- ormica-0.1.0/ormica/canopy/policy.py +73 -0
- ormica-0.1.0/ormica/canopy/risk.py +56 -0
- ormica-0.1.0/ormica/cli/__init__.py +5 -0
- ormica-0.1.0/ormica/cli/config.py +46 -0
- ormica-0.1.0/ormica/cli/main.py +306 -0
- ormica-0.1.0/ormica/colony/__init__.py +25 -0
- ormica-0.1.0/ormica/colony/base.py +68 -0
- ormica-0.1.0/ormica/colony/business/__init__.py +65 -0
- ormica-0.1.0/ormica/colony/registry.py +30 -0
- ormica-0.1.0/ormica/colony/supply_chain/__init__.py +63 -0
- ormica-0.1.0/ormica/colony/yaml_loader.py +96 -0
- ormica-0.1.0/ormica/config/__init__.py +0 -0
- ormica-0.1.0/ormica/core.py +299 -0
- ormica-0.1.0/ormica/cortex/__init__.py +27 -0
- ormica-0.1.0/ormica/cortex/constitution.py +54 -0
- ormica-0.1.0/ormica/cortex/policy.py +43 -0
- ormica-0.1.0/ormica/cortex/rule.py +62 -0
- ormica-0.1.0/ormica/integrations/__init__.py +0 -0
- ormica-0.1.0/ormica/integrations/communication/__init__.py +0 -0
- ormica-0.1.0/ormica/integrations/data/__init__.py +0 -0
- ormica-0.1.0/ormica/integrations/llm/__init__.py +0 -0
- ormica-0.1.0/ormica/integrations/memory_backends/__init__.py +0 -0
- ormica-0.1.0/ormica/mycelium/__init__.py +25 -0
- ormica-0.1.0/ormica/mycelium/backend.py +47 -0
- ormica-0.1.0/ormica/mycelium/entry.py +27 -0
- ormica-0.1.0/ormica/mycelium/file_backend.py +99 -0
- ormica-0.1.0/ormica/mycelium/mycelium.py +119 -0
- ormica-0.1.0/ormica/mycelium/sqlite_backend.py +121 -0
- ormica-0.1.0/ormica/observe/__init__.py +40 -0
- ormica-0.1.0/ormica/observe/bus.py +47 -0
- ormica-0.1.0/ormica/observe/event.py +30 -0
- ormica-0.1.0/ormica/observe/observer.py +67 -0
- ormica-0.1.0/ormica/observe/trace.py +208 -0
- ormica-0.1.0/ormica/plugins/__init__.py +0 -0
- ormica-0.1.0/ormica/plugins/builtin/__init__.py +0 -0
- ormica-0.1.0/ormica/py.typed +0 -0
- ormica-0.1.0/ormica/runtime.py +335 -0
- ormica-0.1.0/ormica/stigma/__init__.py +14 -0
- ormica-0.1.0/ormica/stigma/signal.py +26 -0
- ormica-0.1.0/ormica/stigma/stigma.py +163 -0
- ormica-0.1.0/ormica.egg-info/PKG-INFO +493 -0
- ormica-0.1.0/ormica.egg-info/SOURCES.txt +96 -0
- ormica-0.1.0/ormica.egg-info/dependency_links.txt +1 -0
- ormica-0.1.0/ormica.egg-info/entry_points.txt +2 -0
- ormica-0.1.0/ormica.egg-info/requires.txt +29 -0
- ormica-0.1.0/ormica.egg-info/top_level.txt +1 -0
- ormica-0.1.0/pyproject.toml +100 -0
- ormica-0.1.0/setup.cfg +4 -0
- ormica-0.1.0/tests/test_agent.py +117 -0
- ormica-0.1.0/tests/test_arbor.py +125 -0
- ormica-0.1.0/tests/test_async_brain.py +211 -0
- ormica-0.1.0/tests/test_async_runtime.py +283 -0
- ormica-0.1.0/tests/test_brain.py +122 -0
- ormica-0.1.0/tests/test_canopy.py +149 -0
- ormica-0.1.0/tests/test_claude_brain.py +212 -0
- ormica-0.1.0/tests/test_cli.py +540 -0
- ormica-0.1.0/tests/test_colony.py +165 -0
- ormica-0.1.0/tests/test_concrete_colonies.py +79 -0
- ormica-0.1.0/tests/test_cortex.py +222 -0
- ormica-0.1.0/tests/test_file_backend.py +211 -0
- ormica-0.1.0/tests/test_gemini_brain.py +295 -0
- ormica-0.1.0/tests/test_gpt_brain.py +222 -0
- ormica-0.1.0/tests/test_mycelium.py +140 -0
- ormica-0.1.0/tests/test_observe.py +229 -0
- ormica-0.1.0/tests/test_ormica.py +181 -0
- ormica-0.1.0/tests/test_package.py +14 -0
- ormica-0.1.0/tests/test_provider_helpers.py +83 -0
- ormica-0.1.0/tests/test_runtime.py +223 -0
- ormica-0.1.0/tests/test_sqlite_backend.py +184 -0
- ormica-0.1.0/tests/test_stigma.py +198 -0
- ormica-0.1.0/tests/test_tools.py +274 -0
- ormica-0.1.0/tests/test_trace.py +240 -0
- ormica-0.1.0/tests/test_universal_brain.py +277 -0
- ormica-0.1.0/tests/test_yaml_colony.py +143 -0
ormica-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ranzim
|
|
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.
|
ormica-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,493 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ormica
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: An Autonomous Coordination Engine β build self-organizing AI agent colonies inspired by ant-colony stigmergy.
|
|
5
|
+
Author-email: Ranzim <ranzimthekare123@gmail.com>
|
|
6
|
+
Maintainer-email: Ranzim <ranzimthekare123@gmail.com>
|
|
7
|
+
License: MIT
|
|
8
|
+
Project-URL: Homepage, https://github.com/Ranzim/ormica
|
|
9
|
+
Project-URL: Repository, https://github.com/Ranzim/ormica
|
|
10
|
+
Project-URL: Documentation, https://github.com/Ranzim/ormica/tree/master/docs
|
|
11
|
+
Project-URL: Issues, https://github.com/Ranzim/ormica/issues
|
|
12
|
+
Project-URL: Discussions, https://github.com/Ranzim/ormica/discussions
|
|
13
|
+
Project-URL: Changelog, https://github.com/Ranzim/ormica/blob/master/CHANGELOG.md
|
|
14
|
+
Keywords: ai,agents,agentic,multi-agent,multi-agent-framework,ant-colony,stigmergy,swarm-intelligence,distributed-systems,self-organization,emergence,cybernetics,autonomous-agents,llm,automation,framework
|
|
15
|
+
Classifier: Development Status :: 4 - Beta
|
|
16
|
+
Classifier: Intended Audience :: Developers
|
|
17
|
+
Classifier: Intended Audience :: System Administrators
|
|
18
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
19
|
+
Classifier: Operating System :: OS Independent
|
|
20
|
+
Classifier: Programming Language :: Python :: 3
|
|
21
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
25
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
26
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
27
|
+
Classifier: Topic :: System :: Distributed Computing
|
|
28
|
+
Classifier: Typing :: Typed
|
|
29
|
+
Requires-Python: >=3.10
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
License-File: LICENSE
|
|
32
|
+
Requires-Dist: pyyaml>=6.0
|
|
33
|
+
Provides-Extra: claude
|
|
34
|
+
Requires-Dist: anthropic>=0.40; extra == "claude"
|
|
35
|
+
Provides-Extra: openai
|
|
36
|
+
Requires-Dist: openai>=1.0; extra == "openai"
|
|
37
|
+
Provides-Extra: gemini
|
|
38
|
+
Requires-Dist: google-generativeai>=0.8; extra == "gemini"
|
|
39
|
+
Provides-Extra: universal
|
|
40
|
+
Requires-Dist: openai>=1.0; extra == "universal"
|
|
41
|
+
Provides-Extra: memory
|
|
42
|
+
Requires-Dist: chromadb>=0.5; extra == "memory"
|
|
43
|
+
Provides-Extra: dev
|
|
44
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
45
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
|
|
46
|
+
Requires-Dist: ruff>=0.6; extra == "dev"
|
|
47
|
+
Requires-Dist: build>=1.0; extra == "dev"
|
|
48
|
+
Requires-Dist: twine>=5.0; extra == "dev"
|
|
49
|
+
Provides-Extra: all
|
|
50
|
+
Requires-Dist: anthropic>=0.40; extra == "all"
|
|
51
|
+
Requires-Dist: openai>=1.0; extra == "all"
|
|
52
|
+
Requires-Dist: google-generativeai>=0.8; extra == "all"
|
|
53
|
+
Requires-Dist: chromadb>=0.5; extra == "all"
|
|
54
|
+
Dynamic: license-file
|
|
55
|
+
|
|
56
|
+
<div align="center">
|
|
57
|
+
|
|
58
|
+
# π Ormica
|
|
59
|
+
### An Autonomous Coordination Engine
|
|
60
|
+
> **Seed the colony. Let the organization emerge.**
|
|
61
|
+
|
|
62
|
+
[](LICENSE)
|
|
63
|
+
[](https://www.python.org/downloads/)
|
|
64
|
+
[]()
|
|
65
|
+
[]()
|
|
66
|
+
[]()
|
|
67
|
+
|
|
68
|
+
</div>
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
> Traditional AI systems are **machines** β programmed to perform tasks until they fail.
|
|
73
|
+
> **Ormica is a cybernetic organism** β designed to evolve within your business architecture.
|
|
74
|
+
|
|
75
|
+
Ormica is an **open-source coordination framework** for building agentic systems that scale through biological principles. Instead of brittle chains or static pipelines, it provides the *infrastructure* to **spawn**, **signal**, **prune**, and **govern** a living hierarchy of AI agents.
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## πΊοΈ The Living Colony
|
|
80
|
+
|
|
81
|
+
```mermaid
|
|
82
|
+
flowchart TB
|
|
83
|
+
R(("π<br/><b>ROOT</b>"))
|
|
84
|
+
OPS(("π<br/><b>OPS</b>"))
|
|
85
|
+
SAL(("π<br/><b>SALES</b>"))
|
|
86
|
+
FIN(("π<br/><b>FIN</b>"))
|
|
87
|
+
S["π<br/>scout"]
|
|
88
|
+
H["π<br/>hunter"]
|
|
89
|
+
A["π<br/>analyst"]
|
|
90
|
+
D["pruned"]
|
|
91
|
+
|
|
92
|
+
R --> OPS
|
|
93
|
+
R --> SAL
|
|
94
|
+
R --> FIN
|
|
95
|
+
OPS --> S
|
|
96
|
+
SAL --> H
|
|
97
|
+
FIN --> A
|
|
98
|
+
SAL -. "prune" .-> D
|
|
99
|
+
|
|
100
|
+
S -. "β hot_lead β0.8" .-> H
|
|
101
|
+
H -. "β‘ deal_closed ββ2.4" .-> FIN
|
|
102
|
+
FIN -. "β’ cash_signal β0.6" .-> R
|
|
103
|
+
|
|
104
|
+
classDef root fill:#2d2418,stroke:#d4a04a,stroke-width:3px,color:#f0c068
|
|
105
|
+
classDef caste fill:#241e15,stroke:#a07d3a,stroke-width:2px,color:#d4a04a
|
|
106
|
+
classDef worker fill:#1f1a13,stroke:#6b5538,stroke-width:1.5px,color:#b8a78d
|
|
107
|
+
classDef dead fill:#1a1410,stroke:#3d3528,stroke-width:1px,color:#5c4538
|
|
108
|
+
|
|
109
|
+
class R root
|
|
110
|
+
class OPS,SAL,FIN caste
|
|
111
|
+
class S,H,A worker
|
|
112
|
+
class D dead
|
|
113
|
+
|
|
114
|
+
%% Spawn arrows β muted earth tones
|
|
115
|
+
linkStyle 0,1,2 stroke:#8c6b30,stroke-width:2px
|
|
116
|
+
linkStyle 3,4,5 stroke:#6b5538,stroke-width:1.5px
|
|
117
|
+
linkStyle 6 stroke:#3d3528,stroke-width:1px
|
|
118
|
+
|
|
119
|
+
%% Pheromone trails β single amber accent, intensity = brightness/thickness
|
|
120
|
+
linkStyle 7 stroke:#a07d3a,stroke-width:1.5px,color:#a07d3a
|
|
121
|
+
linkStyle 8 stroke:#f0c068,stroke-width:3px,color:#f0c068
|
|
122
|
+
linkStyle 9 stroke:#d4a04a,stroke-width:2px,color:#d4a04a
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
<sub>**Every node is an ant.** Solid arrows = spawn hierarchy. Dashed amber arrows = pheromone trails. β **scout** senses a hot lead and signals **hunter** β β‘ **hunter** closes the deal and signals **finance** β β’ **finance** reports cash back to **root**. One sensing pathway, full closed loop, decay-prunes the dead branch. *Brightness = signal intensity. Thickness = reinforcement count.*</sub>
|
|
126
|
+
|
|
127
|
+
**Solid arrows** = the spawn hierarchy. Every node has a parent. Every spawn was approved.
|
|
128
|
+
**Dashed trails** = stigmergic signals β pheromone trails, with intensity. Strong trails dominate, weak ones decay, dead branches are pruned.
|
|
129
|
+
**You stay at the root.** The colony grows beneath you.
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## 𧬠The Ormica Philosophy: *"Computational Stigmergy"*
|
|
134
|
+
|
|
135
|
+
Four biological principles, one architecture.
|
|
136
|
+
|
|
137
|
+
### π² Emergent Hierarchy β `arbor`
|
|
138
|
+
You define the *goals*; the framework grows the *tree*. Agents are spawned dynamically to meet demand, creating a depth-first hierarchy that is as complex or as simple as the task requires. No fixed graphs. No predefined chains.
|
|
139
|
+
|
|
140
|
+
### π Stigmergic Coordination β `stigma` + `mycelium`
|
|
141
|
+
Agents do not rely on fragile message-passing. They post state, intent, and progress to a **shared digital pheromone field**. Other agents detect strong trails and follow; weak signals evaporate. Coordination is *emergent*, not orchestrated.
|
|
142
|
+
|
|
143
|
+
### ποΈ Permission Chain β `canopy`
|
|
144
|
+
The engine prevents agent runaway. **Every sub-agent birth** must pass through a permission gate β `AUTO` (parent alone), `CHAIN` (N ancestors), or `ROOT` (only you). High-risk growth propagates all the way to the human owner. The colony remains aligned with your core directives.
|
|
145
|
+
|
|
146
|
+
### βοΈ Constitutional Governance β `cortex`
|
|
147
|
+
The colony's *law*. Hard constraints and soft policies encoded as `Rule` objects. Where the **brain** generates a response, the **cortex** decides whether it's permissible. Anatomically and architecturally: the brain *acts*; the cortex *inhibits*.
|
|
148
|
+
|
|
149
|
+
### π Persistent Memory β `mycelium`
|
|
150
|
+
The colony maintains a shared underground network of knowledge. Agents read and write to this state-layer with full author tags, timestamps, and TTL. Pluggable backends (`FileBackend`, `SqliteBackend`) keep state across process restarts. **The system learns from its own history rather than starting from zero.**
|
|
151
|
+
|
|
152
|
+
### π‘ The Thought Trail β `observe`
|
|
153
|
+
Every reasoning step β messages, tool calls, response, tokens β captured and tied to the task that triggered it. Not just *what* happened, but *why the colony chose that path*. Queryable via `org.trace_for(task_id)`. The Black-Box Problem, solved.
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## ποΈ Why this is a *Framework*, not just *Software*
|
|
158
|
+
|
|
159
|
+
| | What you'd normally write | What Ormica gives you |
|
|
160
|
+
|---|---|---|
|
|
161
|
+
| π§ **You provide** | Individual agent actions, prompts, glue code | The *intent* β a colony config + a few tools |
|
|
162
|
+
| 𦴠**Ormica provides** | (you wire it together) | **The nervous system** β `arbor`, `stigma`, `mycelium`, `cortex`, `observe` |
|
|
163
|
+
| π₯ **Industry** | Hard-coded for one domain | **Industry-agnostic core** β same engine runs a hospital, a supply chain, a solo founder, just by swapping a colony |
|
|
164
|
+
| π¬ **Failure model** | "Catch and retry" | **Bounded blast radius** β a failed task β a dead colony; a prunable branch β tree death |
|
|
165
|
+
| π **Observability** | Logs you grep later | **Thought Trail** β structured per-task reasoning capture, persisted |
|
|
166
|
+
|
|
167
|
+
You're not writing the colony. You're writing the colony's *constitution*.
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## π¬ Engineered for Distributed Systems
|
|
172
|
+
|
|
173
|
+
Multi-agent AI hits the same problems distributed systems solved 40 years ago. Ormica answers each one explicitly:
|
|
174
|
+
|
|
175
|
+
| Distributed-systems problem | Ormica's answer |
|
|
176
|
+
|---|---|
|
|
177
|
+
| Coordination without central commands | **Stigmergy** β agents read/write a shared signal field; strong trails reinforce, weak ones decay |
|
|
178
|
+
| Bounded growth | **Permission chain** on every spawn (AUTO / CHAIN / ROOT); root owner is the final authority |
|
|
179
|
+
| Failure isolation | A failed task marks *itself* failed; the run continues |
|
|
180
|
+
| State persistence | Pluggable `Backend` β `FileBackend` (JSON), `SqliteBackend` (WAL). Memory survives restarts |
|
|
181
|
+
| Scheduling fairness | Priority bands (`high` β `normal` β `low`) run sequentially; same-band tasks fan out concurrently |
|
|
182
|
+
| Governance & safety | **Constitutional cortex** β hard constraints enforced regardless of LLM output |
|
|
183
|
+
| Auditability | **Thought Trail** β per-task capture of every reasoning step + tool call |
|
|
184
|
+
|
|
185
|
+
This is the framing that separates a lab experiment from **infrastructure a CTO would actually trust**.
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## π₯ Install
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
pip install ormica # core (MockBrain β no LLM cost)
|
|
193
|
+
pip install ormica[claude] # + Anthropic Claude (native)
|
|
194
|
+
pip install ormica[gemini] # + Google Gemini (native)
|
|
195
|
+
pip install ormica[universal] # + OpenAI Β· Ollama (local) Β· OpenRouter Β· Groq Β· Together Β· DeepSeek Β· vLLM Β· LM Studio Β· β¦
|
|
196
|
+
pip install ormica[all] # everything above
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Python 3.10+ required. **One install command, every major LLM.** See [docs/guides/llm-providers.md](./docs/guides/llm-providers.md) for the full recipe matrix.
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## π 30-Second Taste
|
|
204
|
+
|
|
205
|
+
```python
|
|
206
|
+
from ormica import Ormica
|
|
207
|
+
from ormica.brain import ClaudeBrain # or GeminiBrain Β· ollama_brain Β· UniversalBrain
|
|
208
|
+
from ormica.cortex import Constitution, Rule
|
|
209
|
+
|
|
210
|
+
# 1. Encode the law of the colony
|
|
211
|
+
constitution = Constitution([
|
|
212
|
+
Rule(name="depth_cap",
|
|
213
|
+
description="never grow past depth 4",
|
|
214
|
+
check=lambda ctx: ctx["depth"] <= 4, stage="spawn"),
|
|
215
|
+
])
|
|
216
|
+
|
|
217
|
+
# 2. Seed the colony
|
|
218
|
+
org = Ormica("My SaaS", owner="Founder",
|
|
219
|
+
constitution=constitution,
|
|
220
|
+
memory_db="./acme.db") # state survives restarts
|
|
221
|
+
org.plant("business") # 4 departments emerge under root
|
|
222
|
+
|
|
223
|
+
# 3. Queue intent (not implementation)
|
|
224
|
+
org.task("Reach out to 3 SMB leads", dept="sales", priority="high")
|
|
225
|
+
org.task("Forecast Q3 cash flow", dept="finance")
|
|
226
|
+
|
|
227
|
+
# 4. Let the organization emerge
|
|
228
|
+
org.run(brain=ClaudeBrain())
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
β¦or from a terminal:
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
ormica init "My SaaS" --industry business --brain claude
|
|
235
|
+
ormica run --async --concurrency 5
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
Five lines from "no colony" to "running, signal-driven, governed, audited."
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
## π‘ How the Colony Behaves β Three Living Diagrams
|
|
243
|
+
|
|
244
|
+
### 1. The Permission Chain β *why growth is bounded*
|
|
245
|
+
|
|
246
|
+
```mermaid
|
|
247
|
+
%%{init: {'theme':'base','themeVariables':{
|
|
248
|
+
'background':'#14110d',
|
|
249
|
+
'primaryColor':'#241e15','primaryBorderColor':'#a07d3a','primaryTextColor':'#d4a04a',
|
|
250
|
+
'lineColor':'#8c6b30','secondaryColor':'#2d2418','tertiaryColor':'#1f1a13',
|
|
251
|
+
'actorBkg':'#241e15','actorBorder':'#a07d3a','actorTextColor':'#d4a04a',
|
|
252
|
+
'signalColor':'#a07d3a','signalTextColor':'#d4a04a',
|
|
253
|
+
'noteBkgColor':'#1f1a13','noteBorderColor':'#6b5538','noteTextColor':'#b8a78d',
|
|
254
|
+
'sequenceNumberColor':'#f0c068','labelBoxBkgColor':'#241e15','labelBoxBorderColor':'#a07d3a'
|
|
255
|
+
}}}%%
|
|
256
|
+
sequenceDiagram
|
|
257
|
+
autonumber
|
|
258
|
+
participant W as π sub-agent
|
|
259
|
+
participant P as π parent
|
|
260
|
+
participant D as π dept lead
|
|
261
|
+
participant R as π ROOT
|
|
262
|
+
|
|
263
|
+
W->>P: "Spawn a sub-worker?"
|
|
264
|
+
Note over P: assess risk
|
|
265
|
+
rect rgba(212, 160, 74, 0.08)
|
|
266
|
+
Note over P,R: risk = ROOT β escalate
|
|
267
|
+
P->>D: forward request
|
|
268
|
+
D->>R: forward request
|
|
269
|
+
Note right of R: approve / deny
|
|
270
|
+
R-->>D: approved
|
|
271
|
+
D-->>P: forwarded
|
|
272
|
+
P-->>W: spawn proceeds
|
|
273
|
+
end
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
Three risk levels: **AUTO** Β· **CHAIN** Β· **ROOT**. Configure per role:
|
|
277
|
+
`RoleRisk({"finance": ROOT, "scout": AUTO})`. See [docs/architecture/01-hierarchy.md](./docs/architecture/01-hierarchy.md).
|
|
278
|
+
|
|
279
|
+
### 2. The Pheromone Field β *coordination without chat*
|
|
280
|
+
|
|
281
|
+
```mermaid
|
|
282
|
+
flowchart LR
|
|
283
|
+
A([π<br/>ant-Ξ±]) -->|"emit Β· 1.0"| F
|
|
284
|
+
B([π<br/>ant-Ξ²]) -->|"+1.0"| F
|
|
285
|
+
C([π<br/>ant-Ξ³]) -->|"+1.0"| F
|
|
286
|
+
F[("trail<br/><b>strength 3.0</b><br/><i>mycelium</i>")]
|
|
287
|
+
F -->|"decay Β· half-life"| F
|
|
288
|
+
F -->|"sense βΈ follow"| D([π<br/>ant-Ξ΄])
|
|
289
|
+
|
|
290
|
+
classDef ant fill:#1f1a13,stroke:#6b5538,stroke-width:1.5px,color:#b8a78d
|
|
291
|
+
classDef field fill:#2d2418,stroke:#f0c068,stroke-width:3px,color:#f0c068
|
|
292
|
+
class A,B,C,D ant
|
|
293
|
+
class F field
|
|
294
|
+
|
|
295
|
+
linkStyle 0,1,2 stroke:#a07d3a,stroke-width:2px,color:#a07d3a
|
|
296
|
+
linkStyle 3 stroke:#6b5538,stroke-width:1px,color:#8c7a60
|
|
297
|
+
linkStyle 4 stroke:#d4a04a,stroke-width:2.5px,color:#d4a04a
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
Reinforced trails dominate. Weak trails evaporate. **Persistence is automatic** β restart the process and the field is still there (if you used a persistent backend).
|
|
301
|
+
|
|
302
|
+
### 3. Agent State Topology β *every node has a known phase*
|
|
303
|
+
|
|
304
|
+
```mermaid
|
|
305
|
+
%%{init: {'theme':'base','themeVariables':{
|
|
306
|
+
'background':'#14110d',
|
|
307
|
+
'primaryColor':'#241e15','primaryBorderColor':'#a07d3a','primaryTextColor':'#d4a04a',
|
|
308
|
+
'lineColor':'#8c6b30','secondaryColor':'#2d2418','tertiaryColor':'#1f1a13',
|
|
309
|
+
'noteBkgColor':'#1f1a13','noteBorderColor':'#6b5538','noteTextColor':'#b8a78d',
|
|
310
|
+
'labelTextColor':'#d4a04a','labelBoxBkgColor':'#241e15','labelBoxBorderColor':'#6b5538'
|
|
311
|
+
}}}%%
|
|
312
|
+
stateDiagram-v2
|
|
313
|
+
[*] --> IDLE: spawn approved
|
|
314
|
+
IDLE --> WORKING: act()
|
|
315
|
+
WORKING --> DONE: response received
|
|
316
|
+
WORKING --> FAILED: exception<br/>Β· budget exhausted<br/>Β· rule violation
|
|
317
|
+
DONE --> [*]: task complete
|
|
318
|
+
FAILED --> [*]: task complete
|
|
319
|
+
IDLE --> PRUNED: tree.prune()
|
|
320
|
+
WORKING --> PRUNED: tree.prune()
|
|
321
|
+
DONE --> PRUNED: tree.prune()
|
|
322
|
+
|
|
323
|
+
note right of WORKING
|
|
324
|
+
every think() call emits
|
|
325
|
+
think.recorded β the
|
|
326
|
+
Thought Trail
|
|
327
|
+
end note
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
Every transition emits an event onto the colony's bus. A `TraceObserver` aggregates them per task β that's the **Thought Trail**.
|
|
331
|
+
|
|
332
|
+
---
|
|
333
|
+
|
|
334
|
+
## π©Ί The Colony Health Report
|
|
335
|
+
|
|
336
|
+
`ormica status` β the colony's vital signs without running anything.
|
|
337
|
+
|
|
338
|
+
```text
|
|
339
|
+
$ ormica status
|
|
340
|
+
|
|
341
|
+
name: My SaaS
|
|
342
|
+
owner: Ranzim
|
|
343
|
+
industry: business
|
|
344
|
+
brain: claude (model=claude-opus-4-7)
|
|
345
|
+
|
|
346
|
+
tree (5 nodes):
|
|
347
|
+
- My SaaS [root]
|
|
348
|
+
- operations [operations]
|
|
349
|
+
- sales [sales]
|
|
350
|
+
- marketing [marketing]
|
|
351
|
+
- finance [finance]
|
|
352
|
+
|
|
353
|
+
tasks queued: 2
|
|
354
|
+
- [high] sales: Reach out to 3 SMB leads
|
|
355
|
+
- [normal] finance: Forecast Q3 cash flow
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
A richer dashboard β signal intensity per topic, branch depth, governance compliance, top-N pheromone trails β is on the [roadmap](#%EF%B8%8F-roadmap) as a v0.5 web UI on top of the Thought Trail.
|
|
359
|
+
|
|
360
|
+
---
|
|
361
|
+
|
|
362
|
+
## π vs. the Alternatives
|
|
363
|
+
|
|
364
|
+
| | LangChain Β· CrewAI Β· AutoGen | **Ormica** |
|
|
365
|
+
|---|---|---|
|
|
366
|
+
| Structure | Fixed chains / graphs | **Living tree** β grows to N depth |
|
|
367
|
+
| Agent creation | Defined upfront | **Self-spawning** on demand |
|
|
368
|
+
| Growth control | None built in | **Permission chain to root** (canopy) |
|
|
369
|
+
| Coordination | Direct messaging | **Stigmergic signals + emergence** |
|
|
370
|
+
| State persistence | DIY | **Pluggable `Backend`** (file / sqlite) |
|
|
371
|
+
| Failure handling | Often kills the run | **Failed task β dead system** |
|
|
372
|
+
| Governance | "Try harder prompts" | **First-class `Constitution`** (cortex) |
|
|
373
|
+
| Auditability | Ad-hoc logging | **Thought Trail per task** (observe) |
|
|
374
|
+
| Focus | General purpose | **Production agent operations** |
|
|
375
|
+
|
|
376
|
+
---
|
|
377
|
+
|
|
378
|
+
## π¦ What's Inside
|
|
379
|
+
|
|
380
|
+
```
|
|
381
|
+
ormica/
|
|
382
|
+
βββ arbor/ Tree Β· Node Β· Branch Β· SpawnPolicy π² emergent hierarchy
|
|
383
|
+
βββ canopy/ Permission chain (AUTO Β· CHAIN Β· ROOT) ποΈ growth governance
|
|
384
|
+
βββ mycelium/ Shared KV + FileBackend + SqliteBackend π persistent memory
|
|
385
|
+
βββ stigma/ Pheromone trails Β· lazy decay π stigmergic signals
|
|
386
|
+
βββ brain/ LLM seam: Mock Β· Claude Β· GPT π§ the colony's thinking
|
|
387
|
+
β (sync + async) Β· Router Β· Tool Β· @tool
|
|
388
|
+
βββ cortex/ Constitution Β· Rule Β· Policy βοΈ law of the colony
|
|
389
|
+
βββ observe/ Event Β· EventBus Β· TraceObserver π‘ the Thought Trail
|
|
390
|
+
βββ colony/ AgentTemplate Β· Colony Β· YAML loader π’ industry templates
|
|
391
|
+
β (business + supply_chain bundled)
|
|
392
|
+
βββ agent.py Agent Β· AsyncAgent Β· ToolLoopExceeded
|
|
393
|
+
βββ runtime.py Task Β· TaskRunner Β· AsyncTaskRunner
|
|
394
|
+
βββ core.py Ormica facade β single import
|
|
395
|
+
βββ cli/ ormica init / run / status / colonies
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
```
|
|
399
|
+
docs/ # the onboarding map
|
|
400
|
+
βββ README.md index
|
|
401
|
+
βββ concepts.md Computational Stigmergy in depth
|
|
402
|
+
βββ getting-started.md install + hello-world
|
|
403
|
+
βββ architecture/ one page per module / pillar
|
|
404
|
+
βββ guides/ writing colonies, tools, rules, tracesβ¦
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
`tests/` β **310 tests Β· ~370ms Β· no SDK deps required for CI.**
|
|
408
|
+
|
|
409
|
+
---
|
|
410
|
+
|
|
411
|
+
## π£οΈ Roadmap
|
|
412
|
+
|
|
413
|
+
- [x] **v0.1** β Four pillars + runtime + CLI + persistence + async + observability *(here)*
|
|
414
|
+
- [ ] **v0.2** β YAML Constitutions Β· soft-violation events Β· per-node rule overrides
|
|
415
|
+
- [ ] **v0.3** β Async tools Β· streaming responses Β· first integrations (Gmail Β· Notion Β· GitHub Β· Stripe)
|
|
416
|
+
- [ ] **v0.4** β ChromaDB backend (semantic mycelium) Β· vector signals
|
|
417
|
+
- [ ] **v0.5** β **Colony Dashboard** (web UI) β signal intensity, branch depth, governance compliance, live Thought Trail
|
|
418
|
+
- [ ] **v1.0** β Ormica Cloud (hosted platform)
|
|
419
|
+
|
|
420
|
+
GitHub Project board is coming. Open an issue to vote on or contribute to any roadmap item.
|
|
421
|
+
|
|
422
|
+
---
|
|
423
|
+
|
|
424
|
+
## π€ Join the Colony β Contributing
|
|
425
|
+
|
|
426
|
+
The colony is young; new contributors shape its character.
|
|
427
|
+
|
|
428
|
+
### π New here? Three pages to read:
|
|
429
|
+
|
|
430
|
+
| | Page | What you'll get |
|
|
431
|
+
|---|---|---|
|
|
432
|
+
| 1 | **[Your First PR](./docs/guides/your-first-pr.md)** | The shortest path from "I want to help" to "my PR is merged." |
|
|
433
|
+
| 2 | **[CONTRIBUTING.md](./CONTRIBUTING.md)** | The *where-to-put-what* matrix + hard rules of the codebase. |
|
|
434
|
+
| 3 | **One [architecture page](./docs/architecture/README.md)** | Pick the pillar you're touching. Each page is ~5 minutes. |
|
|
435
|
+
|
|
436
|
+
### π Good first contributions
|
|
437
|
+
|
|
438
|
+
| You want to add⦠| Where it goes | Read first |
|
|
439
|
+
|---|---|---|
|
|
440
|
+
| π’ A new industry / colony | `ormica/colony/<name>/` or a YAML file | [Writing a colony](./docs/guides/writing-a-colony.md) |
|
|
441
|
+
| π οΈ A new tool | wherever you use `act_with_tools(...)` | [Writing tools](./docs/guides/writing-tools.md) |
|
|
442
|
+
| π§ A new LLM provider | `ormica/brain/<provider>.py` | [Brain](./docs/architecture/03-brain.md) |
|
|
443
|
+
| π A persistence backend | `ormica/mycelium/<name>_backend.py` | [Persistence](./docs/guides/persistence.md) |
|
|
444
|
+
| π‘ A new observer (metrics, log sink) | `ormica/observe/<observer>.py` | [Observability](./docs/architecture/05-observability.md) |
|
|
445
|
+
| π A docs improvement | `docs/` | The page itself |
|
|
446
|
+
| π A small bug fix | wherever the bug lives | The bug report |
|
|
447
|
+
|
|
448
|
+
### π¬ Other ways to help
|
|
449
|
+
|
|
450
|
+
- π **Browse open issues** β look for [`good first issue`](https://github.com/Ranzim/ormica/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) or [`help wanted`](https://github.com/Ranzim/ormica/labels/help%20wanted).
|
|
451
|
+
- π **Open a Discussion** β questions, ideas, show-and-tell at [GitHub Discussions](https://github.com/Ranzim/ormica/discussions).
|
|
452
|
+
- β **Star the repo** β visibility helps new contributors find us.
|
|
453
|
+
- π£ **Share your colony** β tag the project when you build something cool.
|
|
454
|
+
|
|
455
|
+
### π§ͺ Before you push
|
|
456
|
+
|
|
457
|
+
```bash
|
|
458
|
+
pytest # 310 tests, ~370ms, all green
|
|
459
|
+
ruff check . # lint clean
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
By participating, you agree to abide by the [Code of Conduct](./CODE_OF_CONDUCT.md). To report a security issue, see [SECURITY.md](./SECURITY.md).
|
|
463
|
+
|
|
464
|
+
---
|
|
465
|
+
|
|
466
|
+
## π·οΈ Recommended GitHub Topics
|
|
467
|
+
|
|
468
|
+
When tagging the repo (Settings β "Manage topics"):
|
|
469
|
+
|
|
470
|
+
```
|
|
471
|
+
ai Β· agents Β· agentic Β· multi-agent Β· multi-agent-framework
|
|
472
|
+
distributed-systems Β· stigmergy Β· swarm-intelligence
|
|
473
|
+
cybernetics Β· self-organization Β· emergence
|
|
474
|
+
llm Β· autonomous-agents Β· python Β· framework
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
Positions Ormica where it belongs: **systems engineering**, not "another AI agent chatbot."
|
|
478
|
+
|
|
479
|
+
---
|
|
480
|
+
|
|
481
|
+
## π License
|
|
482
|
+
|
|
483
|
+
MIT β see [LICENSE](LICENSE). Free to use, modify, and build on.
|
|
484
|
+
|
|
485
|
+
---
|
|
486
|
+
|
|
487
|
+
<div align="center">
|
|
488
|
+
|
|
489
|
+
**Ormica** β *organize like a colony Β· grow like a forest Β· decide like an organization Β· audit like infrastructure.*
|
|
490
|
+
|
|
491
|
+
<sub><i>Computational Stigmergy Β· v0.1 Β· ant-colony-inspired coordination for autonomous AI operations</i></sub>
|
|
492
|
+
|
|
493
|
+
</div>
|