Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
# app.py
|
| 2 |
# Author: Liam Grinstead
|
|
|
|
| 3 |
|
| 4 |
from modules.agent_spawner import spawn_agent
|
| 5 |
from modules.mutation_engine import mutate_agent
|
|
@@ -9,15 +10,32 @@ from modules.codex_logger import log_artifact
|
|
| 9 |
from modules.codex_viewer import load_codex
|
| 10 |
|
| 11 |
def run_simulation(agent_id, mutation_profile):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
agent = spawn_agent(agent_id)
|
|
|
|
|
|
|
| 13 |
mutated = mutate_agent(agent, mutation_profile)
|
| 14 |
|
| 15 |
-
#
|
| 16 |
try:
|
| 17 |
render_fields(mutated)
|
| 18 |
except Exception:
|
|
|
|
| 19 |
pass
|
| 20 |
|
|
|
|
| 21 |
score, hash_val = run_falsifiability(mutated)
|
|
|
|
|
|
|
| 22 |
log_artifact(mutated, score, hash_val)
|
|
|
|
|
|
|
| 23 |
return mutated, hash_val
|
|
|
|
| 1 |
# app.py
|
| 2 |
# Author: Liam Grinstead
|
| 3 |
+
# Purpose: Run agent simulations, mutations, and falsifiability checks with automatic logging
|
| 4 |
|
| 5 |
from modules.agent_spawner import spawn_agent
|
| 6 |
from modules.mutation_engine import mutate_agent
|
|
|
|
| 10 |
from modules.codex_viewer import load_codex
|
| 11 |
|
| 12 |
def run_simulation(agent_id, mutation_profile):
|
| 13 |
+
"""
|
| 14 |
+
Run a full simulation cycle:
|
| 15 |
+
1. Spawn agent
|
| 16 |
+
2. Apply mutation profile
|
| 17 |
+
3. Render fields (optional)
|
| 18 |
+
4. Run falsifiability bench
|
| 19 |
+
5. Log artifact with SHA-512 seal
|
| 20 |
+
"""
|
| 21 |
+
# Step 1: Spawn agent
|
| 22 |
agent = spawn_agent(agent_id)
|
| 23 |
+
|
| 24 |
+
# Step 2: Mutate agent
|
| 25 |
mutated = mutate_agent(agent, mutation_profile)
|
| 26 |
|
| 27 |
+
# Step 3: Optional visualization
|
| 28 |
try:
|
| 29 |
render_fields(mutated)
|
| 30 |
except Exception:
|
| 31 |
+
# Visualization is non-critical, continue if it fails
|
| 32 |
pass
|
| 33 |
|
| 34 |
+
# Step 4: Falsifiability scoring
|
| 35 |
score, hash_val = run_falsifiability(mutated)
|
| 36 |
+
|
| 37 |
+
# Step 5: Log artifact (saved to JSON with timestamp + SHA-512 seal)
|
| 38 |
log_artifact(mutated, score, hash_val)
|
| 39 |
+
|
| 40 |
+
# Return mutated agent and hash for downstream use
|
| 41 |
return mutated, hash_val
|