Skip to main content

Rule-based tree decider for Cosmergon api-agents (deterministic, no inference)

Project description

cosmergon-decider-tree

Rule-based tree decider for Cosmergon api-agents — deterministic, no inference, latency well under 10 ms.

Implements the Decider protocol from cosmergon-agent 0.13.0+. Branch-Logik aus docs/konzepte/konzept-default-entscheidungsbaum-api-agents.md §3 plus Pet-S165-L1-Conditional-Sequences als Schwellen-Inspiration.

Architektur

state (GameState)
   │
   ├─ persona = state.persona_type or "scientist"
   ▼
PERSONA_TREES[persona]   (list of (condition, action_fn) tuples)
   │
   ├─ first matching condition wins
   ▼
(action, params)           ← optional Compass-Modulation

Sechs Persona-Bäume (scientist / warrior / expansionist / trader / diplomat / farmer), gemeinsamer Survival-Header (critical-energy → wait, 0-fields → create_field, empty-field → place_cells block) und gemeinsamer Wachstums-Fallback (fewest-cells, wait).

Usage

from cosmergon_decider_tree import TreeDecider

decider = TreeDecider()  # no config — fully deterministic

# In runner-loop:
async with CosmergonAgent(api_key=..., base_url="https://cosmergon.com") as agent:
    while True:
        await agent.refresh_state()
        action, params = await decider.decide(agent.state)
        await agent.act(action, **params)
        await asyncio.sleep(90)

Vorteile

  • Deterministisch: identischer State → identische Action.
  • Schnell: <10 ms pro decide()-Call (lambda-evaluation, kein Modell-Load).
  • Interpretierbar: Branch-Liste ist lesbar, Debug-fähig.
  • Offline-fähig: kein LLM-Provider, kein Modell-File, läuft auf jedem ARM-Linux mit Python 3.10+.

Begrenzung

  • Lernt nicht: Cosmergon-Mechanik-Änderungen (neue Action-Klassen, geänderte Konditions-Schwellen) brechen Tree → klare Versions-Bindung an SDK + Backend-Stand.
  • Persona-Bäume teils ähnlich: Konzept §3.2 hat das adressiert, Differenzierung muss strukturiert sichtbar sein.

Tests

cd research/decider-cluster/decider-tree
pip install -e '.[dev]'
pytest -q

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cosmergon_decider_tree-2.0.2.tar.gz (19.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cosmergon_decider_tree-2.0.2-py3-none-any.whl (14.7 kB view details)

Uploaded Python 3

File details

Details for the file cosmergon_decider_tree-2.0.2.tar.gz.

File metadata

  • Download URL: cosmergon_decider_tree-2.0.2.tar.gz
  • Upload date:
  • Size: 19.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cosmergon_decider_tree-2.0.2.tar.gz
Algorithm Hash digest
SHA256 d3bed1a8fc70d8bdb14ce51e9cb2aee916c39cb0db35cd34e6a8ae4de4fa2ab9
MD5 e00a4751e3a090dc5c5580984bc28493
BLAKE2b-256 2a2e4ca63eaa267c8d851112e99af1b14ac6586b6959a7a474791db5513a0444

See more details on using hashes here.

Provenance

The following attestation bundles were made for cosmergon_decider_tree-2.0.2.tar.gz:

Publisher: publish.yml on rkocosmergon/cosmergon-decider-tree

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cosmergon_decider_tree-2.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for cosmergon_decider_tree-2.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 898c1e3133c74a99509877fc4d21c6bae0882ea45c36f17ed94c5f67acd04bb2
MD5 bb8d5c6f6ae1635fc2b0e486247039a6
BLAKE2b-256 f5a521bf2e57d7b9098fc085e6065cbf8624a3feb047a10b6aa00d6e1865de83

See more details on using hashes here.

Provenance

The following attestation bundles were made for cosmergon_decider_tree-2.0.2-py3-none-any.whl:

Publisher: publish.yml on rkocosmergon/cosmergon-decider-tree

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page