feat: Topology Tournament demo (mesh vs hierarchy vs chain) - #12
Conversation
Four teams of LLM-powered agents in ring, star, mesh, and tree topologies race to reach consensus. Demonstrates how network structure affects information propagation and collective reasoning.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1be8ed74df
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| if llm-ready? [ | ||
| carefully [ | ||
| let response llm:chat-with-template "demos/topology-tournament/coordinator-template.yaml" (list |
There was a problem hiding this comment.
Use model-relative template path for chat calls
This call hardcodes a repo-relative filename, but the template loader resolves paths as modelDir + filename, then raw filename/CWD (src/main/LLMExtension.scala:176-186); for a model opened from demos/topology-tournament, that first probe becomes .../demos/topology-tournament/demos/topology-tournament/coordinator-template.yaml, and when CWD is not the repo root the file is not found, so each tick falls into the carefully error handler and silently degrades to deterministic MAJORITY_PUSH instead of running the LLM coordinator.
Useful? React with 👍 / 👎.
| 195 | ||
| 255 | ||
| llm-config-path | ||
| demos/topology-tournament/config.txt |
There was a problem hiding this comment.
Set default config path relative to this model
The default llm-config-path is also repo-relative, but config loading uses the same resolution pattern (src/main/config/ConfigLoader.scala:24-30), so from this model directory it first checks a duplicated non-existent path and then depends on process CWD being the repo root; in normal NetLogo launches this often misses the file and setup immediately falls back to non-LLM behavior, so the demo does not work out of the box with the provided default.
Useful? React with 👍 / 👎.
Code Review: Topology Tournament Demo ✅Strengths:
Logic Review:
Minor Recommendations:
Status: APPROVED FOR MERGE ✅ |
Each agent now observes only its link-neighbors and independently chooses a belief via llm:choose (or local majority fallback), making topology genuinely constrain information flow. Simultaneous update semantics via previous-belief snapshots ensure consistent decisions. - Rewrite code section: add decide-belief, decide-belief-llm, decide-belief-deterministic, belief-count-summary, initialize-agents, check-all-convergence; remove coordinate-topology, apply-coordinator-action, parse-action, next-belief - Delete coordinator-template.yaml (no longer needed) - Migrate .nlogo to .nlogox format - Update tests: add PerAgentDecisionTests, remove CoordinatorTemplateTests (28 tests passing) - Update README with per-agent mechanics and topology degree explanation
- Fix widget XML format for nlogox (kind=Observer, input element, direction capitalization, plot pen child elements) - Fix NetLogo syntax: parenthesize nested filter/reduce calls, replace all? on lists with member? check - Rewrite LLM prompts for topology-aware per-tick agent decisions with debug logging - Add 10% random perturbation to break hierarchy oscillation - Add Stop button and stop-tournament procedure - Improve layout: larger agents (size 2), brighter colors, wider spacing, simplified belief-only labels - Switch config to ollama/qwen3:4b with base_url - Change config path from full path to relative config.txt - Config test now validates structure instead of specific values
…gy-tournament # Conflicts: # .bundledFiles # demos/topology-tournament/README.md # demos/topology-tournament/config.txt
…files Replace vague "decide strategically" prompt with explicit majority-rule instructions so small models reliably follow neighbor consensus signals. Switch default model from qwen3:4b to qwen3.5:9b for better instruction-following. Delete files from the old centralized coordinator design that was replaced by the per-agent .nlogox architecture: topology-tournament.nlogo, coordinator-template.yaml, behaviorspace-config.xml, analyze-results.py, and all python test files. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add Command Center logging at setup (config + initial beliefs), per-tick (belief counts + agreement %), convergence events, and tournament results. Switch back to llama3.2:3b since llm:choose does not support thinking models (tracked in #24). Use llm:choose as intended — no custom parsing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix chain deadlock: add tie-breaking LLM prompt when stuck 3+ rounds, increase deterministic symmetry-breaking from 10% to 40% when stuck - Color agents by belief (red/blue/green) instead of topology, keeping shape for topology identity (circle/triangle/square) - Add topology group labels (MESH, HIERARCHY, CHAIN) with CONVERGED indicator and gold link highlighting on convergence - Improve spatial layout: larger mesh radius, wider hierarchy spacing, parabolic arc for chain instead of flat line - Add color legend note widget below view - Reorganize right-side widget layout for compactness
Compares mesh, hierarchy, and chain topologies for agent coordination using LLM-based coordinators.
What it does:
Why NetLogo + Python:
How to run:
cd demos/topology-tournament python3 -m unittest discover testsExpected results: See convergence time differences across topologies