cosmergon-decider-tree 2.0.2__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.
- cosmergon_decider_tree-2.0.2/LICENSE +21 -0
- cosmergon_decider_tree-2.0.2/PKG-INFO +92 -0
- cosmergon_decider_tree-2.0.2/README.md +68 -0
- cosmergon_decider_tree-2.0.2/pyproject.toml +37 -0
- cosmergon_decider_tree-2.0.2/setup.cfg +4 -0
- cosmergon_decider_tree-2.0.2/src/cosmergon_decider_tree/__init__.py +15 -0
- cosmergon_decider_tree-2.0.2/src/cosmergon_decider_tree/decider.py +580 -0
- cosmergon_decider_tree-2.0.2/src/cosmergon_decider_tree/persona_profiles.py +343 -0
- cosmergon_decider_tree-2.0.2/src/cosmergon_decider_tree.egg-info/PKG-INFO +92 -0
- cosmergon_decider_tree-2.0.2/src/cosmergon_decider_tree.egg-info/SOURCES.txt +13 -0
- cosmergon_decider_tree-2.0.2/src/cosmergon_decider_tree.egg-info/dependency_links.txt +1 -0
- cosmergon_decider_tree-2.0.2/src/cosmergon_decider_tree.egg-info/entry_points.txt +2 -0
- cosmergon_decider_tree-2.0.2/src/cosmergon_decider_tree.egg-info/requires.txt +5 -0
- cosmergon_decider_tree-2.0.2/src/cosmergon_decider_tree.egg-info/top_level.txt +1 -0
- cosmergon_decider_tree-2.0.2/tests/test_tree_decider.py +658 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 RKO Consult UG (haftungsbeschraenkt)
|
|
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,92 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cosmergon-decider-tree
|
|
3
|
+
Version: 2.0.2
|
|
4
|
+
Summary: Rule-based tree decider for Cosmergon api-agents (deterministic, no inference)
|
|
5
|
+
Author-email: "RKO Consult UG (haftungsbeschraenkt)" <contact@cosmergon.de>
|
|
6
|
+
License: MIT
|
|
7
|
+
Keywords: cosmergon,ai-agent,decider,behavior-tree,rule-based
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Requires-Python: >=3.10
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
Requires-Dist: cosmergon-agent<0.16,>=0.15.0
|
|
20
|
+
Provides-Extra: dev
|
|
21
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
|
22
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
|
|
23
|
+
Dynamic: license-file
|
|
24
|
+
|
|
25
|
+
# cosmergon-decider-tree
|
|
26
|
+
|
|
27
|
+
Rule-based tree decider for Cosmergon api-agents — deterministic, no
|
|
28
|
+
inference, latency well under 10 ms.
|
|
29
|
+
|
|
30
|
+
Implements the `Decider` protocol from `cosmergon-agent` 0.13.0+.
|
|
31
|
+
Branch-Logik aus `docs/konzepte/konzept-default-entscheidungsbaum-api-agents.md`
|
|
32
|
+
§3 plus Pet-S165-L1-Conditional-Sequences als Schwellen-Inspiration.
|
|
33
|
+
|
|
34
|
+
## Architektur
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
state (GameState)
|
|
38
|
+
│
|
|
39
|
+
├─ persona = state.persona_type or "scientist"
|
|
40
|
+
▼
|
|
41
|
+
PERSONA_TREES[persona] (list of (condition, action_fn) tuples)
|
|
42
|
+
│
|
|
43
|
+
├─ first matching condition wins
|
|
44
|
+
▼
|
|
45
|
+
(action, params) ← optional Compass-Modulation
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Sechs Persona-Bäume (scientist / warrior / expansionist / trader /
|
|
49
|
+
diplomat / farmer), gemeinsamer Survival-Header (critical-energy → wait,
|
|
50
|
+
0-fields → create_field, empty-field → place_cells block) und
|
|
51
|
+
gemeinsamer Wachstums-Fallback (fewest-cells, wait).
|
|
52
|
+
|
|
53
|
+
## Usage
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
from cosmergon_decider_tree import TreeDecider
|
|
57
|
+
|
|
58
|
+
decider = TreeDecider() # no config — fully deterministic
|
|
59
|
+
|
|
60
|
+
# In runner-loop:
|
|
61
|
+
async with CosmergonAgent(api_key=..., base_url="https://cosmergon.com") as agent:
|
|
62
|
+
while True:
|
|
63
|
+
await agent.refresh_state()
|
|
64
|
+
action, params = await decider.decide(agent.state)
|
|
65
|
+
await agent.act(action, **params)
|
|
66
|
+
await asyncio.sleep(90)
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Vorteile
|
|
70
|
+
|
|
71
|
+
- **Deterministisch:** identischer State → identische Action.
|
|
72
|
+
- **Schnell:** <10 ms pro `decide()`-Call (lambda-evaluation, kein
|
|
73
|
+
Modell-Load).
|
|
74
|
+
- **Interpretierbar:** Branch-Liste ist lesbar, Debug-fähig.
|
|
75
|
+
- **Offline-fähig:** kein LLM-Provider, kein Modell-File, läuft auf
|
|
76
|
+
jedem ARM-Linux mit Python 3.10+.
|
|
77
|
+
|
|
78
|
+
## Begrenzung
|
|
79
|
+
|
|
80
|
+
- **Lernt nicht:** Cosmergon-Mechanik-Änderungen (neue Action-Klassen,
|
|
81
|
+
geänderte Konditions-Schwellen) brechen Tree → klare Versions-Bindung
|
|
82
|
+
an SDK + Backend-Stand.
|
|
83
|
+
- **Persona-Bäume teils ähnlich:** Konzept §3.2 hat das adressiert,
|
|
84
|
+
Differenzierung muss strukturiert sichtbar sein.
|
|
85
|
+
|
|
86
|
+
## Tests
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
cd research/decider-cluster/decider-tree
|
|
90
|
+
pip install -e '.[dev]'
|
|
91
|
+
pytest -q
|
|
92
|
+
```
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# cosmergon-decider-tree
|
|
2
|
+
|
|
3
|
+
Rule-based tree decider for Cosmergon api-agents — deterministic, no
|
|
4
|
+
inference, latency well under 10 ms.
|
|
5
|
+
|
|
6
|
+
Implements the `Decider` protocol from `cosmergon-agent` 0.13.0+.
|
|
7
|
+
Branch-Logik aus `docs/konzepte/konzept-default-entscheidungsbaum-api-agents.md`
|
|
8
|
+
§3 plus Pet-S165-L1-Conditional-Sequences als Schwellen-Inspiration.
|
|
9
|
+
|
|
10
|
+
## Architektur
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
state (GameState)
|
|
14
|
+
│
|
|
15
|
+
├─ persona = state.persona_type or "scientist"
|
|
16
|
+
▼
|
|
17
|
+
PERSONA_TREES[persona] (list of (condition, action_fn) tuples)
|
|
18
|
+
│
|
|
19
|
+
├─ first matching condition wins
|
|
20
|
+
▼
|
|
21
|
+
(action, params) ← optional Compass-Modulation
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Sechs Persona-Bäume (scientist / warrior / expansionist / trader /
|
|
25
|
+
diplomat / farmer), gemeinsamer Survival-Header (critical-energy → wait,
|
|
26
|
+
0-fields → create_field, empty-field → place_cells block) und
|
|
27
|
+
gemeinsamer Wachstums-Fallback (fewest-cells, wait).
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
from cosmergon_decider_tree import TreeDecider
|
|
33
|
+
|
|
34
|
+
decider = TreeDecider() # no config — fully deterministic
|
|
35
|
+
|
|
36
|
+
# In runner-loop:
|
|
37
|
+
async with CosmergonAgent(api_key=..., base_url="https://cosmergon.com") as agent:
|
|
38
|
+
while True:
|
|
39
|
+
await agent.refresh_state()
|
|
40
|
+
action, params = await decider.decide(agent.state)
|
|
41
|
+
await agent.act(action, **params)
|
|
42
|
+
await asyncio.sleep(90)
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Vorteile
|
|
46
|
+
|
|
47
|
+
- **Deterministisch:** identischer State → identische Action.
|
|
48
|
+
- **Schnell:** <10 ms pro `decide()`-Call (lambda-evaluation, kein
|
|
49
|
+
Modell-Load).
|
|
50
|
+
- **Interpretierbar:** Branch-Liste ist lesbar, Debug-fähig.
|
|
51
|
+
- **Offline-fähig:** kein LLM-Provider, kein Modell-File, läuft auf
|
|
52
|
+
jedem ARM-Linux mit Python 3.10+.
|
|
53
|
+
|
|
54
|
+
## Begrenzung
|
|
55
|
+
|
|
56
|
+
- **Lernt nicht:** Cosmergon-Mechanik-Änderungen (neue Action-Klassen,
|
|
57
|
+
geänderte Konditions-Schwellen) brechen Tree → klare Versions-Bindung
|
|
58
|
+
an SDK + Backend-Stand.
|
|
59
|
+
- **Persona-Bäume teils ähnlich:** Konzept §3.2 hat das adressiert,
|
|
60
|
+
Differenzierung muss strukturiert sichtbar sein.
|
|
61
|
+
|
|
62
|
+
## Tests
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
cd research/decider-cluster/decider-tree
|
|
66
|
+
pip install -e '.[dev]'
|
|
67
|
+
pytest -q
|
|
68
|
+
```
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "cosmergon-decider-tree"
|
|
7
|
+
version = "2.0.2"
|
|
8
|
+
description = "Rule-based tree decider for Cosmergon api-agents (deterministic, no inference)"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "RKO Consult UG (haftungsbeschraenkt)", email = "contact@cosmergon.de" },
|
|
14
|
+
]
|
|
15
|
+
keywords = ["cosmergon", "ai-agent", "decider", "behavior-tree", "rule-based"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 4 - Beta",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"License :: OSI Approved :: MIT License",
|
|
20
|
+
"Operating System :: POSIX :: Linux",
|
|
21
|
+
"Programming Language :: Python :: 3",
|
|
22
|
+
"Programming Language :: Python :: 3.10",
|
|
23
|
+
"Programming Language :: Python :: 3.11",
|
|
24
|
+
"Programming Language :: Python :: 3.12",
|
|
25
|
+
]
|
|
26
|
+
dependencies = [
|
|
27
|
+
"cosmergon-agent>=0.15.0,<0.16",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
[project.entry-points."cosmergon.deciders"]
|
|
31
|
+
tree = "cosmergon_decider_tree:TreeDecider"
|
|
32
|
+
|
|
33
|
+
[project.optional-dependencies]
|
|
34
|
+
dev = ["pytest>=8", "pytest-asyncio>=0.23"]
|
|
35
|
+
|
|
36
|
+
[tool.setuptools.packages.find]
|
|
37
|
+
where = ["src"]
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""cosmergon-decider-tree — rule-based decision tree for Cosmergon api-agents.
|
|
2
|
+
|
|
3
|
+
Implements the SDK 0.13.0 Decider protocol with deterministic rule-based
|
|
4
|
+
logic — no inference, no model. Mirrors the Pet's S165 conditional
|
|
5
|
+
persona-sequences but in pure Python lambdas, suitable for Lab-Cluster
|
|
6
|
+
B.2 baseline (S165) and as a fallback decider when LLM-providers fail.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
from cosmergon_decider_tree.decider import TreeDecider
|
|
12
|
+
|
|
13
|
+
__version__ = "1.1.1"
|
|
14
|
+
|
|
15
|
+
__all__ = ["TreeDecider", "__version__"]
|