WorldSmithAI / examples /farm.json
Srishti280992's picture
Upload 39 files
caad8d0 verified
Raw
History Blame
26.4 kB
{
"schema_version": "1.0",
"id": "farm_ecosystem",
"name": "Adaptive Farm Ecosystem",
"description": "A compact farm world where generic agents coordinate around crops, water, soil health, pollination, and market demand.",
"simulation": {
"steps": 60,
"seed": 7,
"scheduler": "sequential",
"activation": "sequential",
"collect_history": true,
"metadata": {
"example": true,
"domain": "farm"
}
},
"space": {
"dimensions": 2,
"bounds": [
[
0,
10
],
[
0,
10
]
],
"toroidal": false,
"enforce_bounds": true,
"metadata": {
"layout": "small_demo_field"
}
},
"agents": [
{
"id": "farmer_1",
"type": "farmer",
"position": [
1.5,
2.0
],
"state": {
"energy": 10,
"credits": 8,
"knowledge": 2,
"soil_moisture_signal": 0.45,
"inventory": {
"wood": 3,
"tools": 2,
"seeds": 4
}
},
"memory": {
"goals": [
{
"id": "sustain_harvest",
"description": "Keep crop output high without exhausting the field.",
"importance": 3,
"score": 3,
"duration": 2
},
{
"id": "coordinate_workers",
"description": "Coordinate pollination, water, and soil stewardship.",
"importance": 2,
"score": 2,
"duration": 1
}
],
"known_options": {
"composting": {
"score": 1.2,
"soil_health": 0.8
},
"irrigation": {
"score": 1.0,
"water_efficiency": 0.7
},
"market_delivery": {
"score": 0.8,
"credits": 0.6
}
},
"relationships": {}
},
"goals": [
{
"id": "sustain_harvest",
"importance": 3,
"score": 3
},
{
"id": "coordinate_workers",
"importance": 2,
"score": 2
}
],
"behaviors": [
{
"name": "remember",
"params": {
"category": "farm_context",
"content": {
"note": "The farmer tracks crops, water, soil, and market needs."
},
"tags": [
"farm",
"initial"
]
}
},
{
"name": "prioritize",
"params": {
"source_path": "memory.goals",
"item_attribute_weights": {
"importance": 1.0,
"score": 1.0
}
}
},
{
"name": "choose_goal",
"params": {
"source_path": "memory.latest_priorities.items",
"current_goal_path": "state.current_goal"
}
},
{
"name": "evaluate",
"params": {
"category": "farm_strategy",
"candidate_options": [
"composting",
"irrigation",
"market_delivery"
],
"known_options_path": "memory.known_options",
"adoption_threshold": 0.8,
"write_decision_path": "memory.latest_strategy_decision"
}
},
{
"name": "adopt",
"params": {
"option_id": "composting",
"category": "soil_strategy",
"adoption_strength": 0.4,
"state_updates_on_adopt": {
"soil_practice": "composting"
}
}
},
{
"name": "communicate",
"params": {
"message": "field_status_update",
"target_agent_id": "water_manager_1",
"max_recipients": 1
}
},
{
"name": "cooperate",
"params": {
"target_agent_id": "soil_steward_1",
"goal": "sustain_harvest",
"effort": 1.0
}
},
{
"name": "harvest",
"params": {}
},
{
"name": "build",
"params": {
"structure_id": "storage_shed",
"structure_type": "storage",
"material_cost": {
"wood": 1.0
},
"work_required": 4.0,
"work_amount": 1.0,
"initial_capacity": 5.0,
"initial_durability": 8.0
}
}
],
"policy": {
"type": "rule_policy",
"params": {
"selection_strategy": "highest_score",
"rules": [
{
"id": "farmer_choose_goal",
"behavior_name": "choose_goal",
"score_delta": 5.0,
"priority_delta": 2.0
},
{
"id": "farmer_prioritize",
"behavior_name": "prioritize",
"score_delta": 4.0,
"priority_delta": 1.0
},
{
"id": "farmer_harvest",
"behavior_name": "harvest",
"conditions": {
"state.energy": {
"min": 2
}
},
"score_delta": 3.0
},
{
"id": "farmer_communicate",
"behavior_name": "communicate",
"score_delta": 2.0
},
{
"id": "farmer_cooperate",
"behavior_name": "cooperate",
"score_delta": 1.5
},
{
"id": "farmer_evaluate",
"behavior_name": "evaluate",
"score_delta": 1.0
},
{
"id": "farmer_build",
"behavior_name": "build",
"conditions": {
"state.inventory.wood": {
"min": 1
}
},
"score_delta": 0.8
},
{
"id": "farmer_remember",
"behavior_name": "remember",
"score_delta": 0.2
},
{
"id": "farmer_adopt",
"behavior_name": "adopt",
"score_delta": 0.1
}
]
}
},
"alive": true,
"metadata": {
"role": "coordination",
"example_note": "Primary coordinating farm agent."
}
},
{
"id": "pollinator_1",
"type": "pollinator",
"position": [
3.0,
7.5
],
"state": {
"energy": 8,
"credits": 1,
"pollination_signal": 0.75,
"inventory": {
"nectar": 2
}
},
"memory": {
"goals": [
{
"id": "increase_pollination",
"description": "Support crop growth by moving information and effort through the field.",
"importance": 3,
"score": 2.5,
"duration": 1
}
],
"known_options": {
"flower_route": {
"score": 1.0
},
"cooperate": {
"score": 0.9
}
},
"relationships": {}
},
"goals": [
{
"id": "increase_pollination",
"importance": 3,
"score": 2.5
}
],
"behaviors": [
{
"name": "remember",
"params": {
"category": "pollination_context",
"content": {
"note": "The pollinator observes flowering resources and nearby agent signals."
},
"tags": [
"pollination"
]
}
},
{
"name": "prioritize",
"params": {
"source_path": "memory.goals"
}
},
{
"name": "choose_goal",
"params": {
"source_path": "memory.latest_priorities.items",
"current_goal_path": "state.current_goal"
}
},
{
"name": "communicate",
"params": {
"message": "pollination_status",
"target_agent_id": "farmer_1",
"max_recipients": 1
}
},
{
"name": "cooperate",
"params": {
"target_agent_id": "farmer_1",
"goal": "sustain_harvest",
"effort": 0.8
}
},
{
"name": "collect",
"params": {}
},
{
"name": "update_belief",
"params": {
"belief_id": "field_is_flowering",
"proposition": "The field currently supports pollination.",
"evidence_path": "state.pollination_signal",
"learning_rate": 0.25,
"write_belief_path": "memory.latest_pollination_belief"
}
}
],
"policy": {
"type": "rule_policy",
"params": {
"selection_strategy": "highest_score",
"rules": [
{
"behavior_name": "choose_goal",
"score_delta": 4.0
},
{
"behavior_name": "communicate",
"score_delta": 3.0
},
{
"behavior_name": "cooperate",
"score_delta": 2.0
},
{
"behavior_name": "collect",
"score_delta": 1.0
},
{
"behavior_name": "update_belief",
"score_delta": 0.8
},
{
"behavior_name": "remember",
"score_delta": 0.3
},
{
"behavior_name": "prioritize",
"score_delta": 0.2
}
]
}
},
"alive": true,
"metadata": {
"role": "ecosystem_support"
}
},
{
"id": "soil_steward_1",
"type": "soil_steward",
"position": [
5.0,
4.0
],
"state": {
"energy": 9,
"credits": 2,
"soil_health_signal": 0.65,
"inventory": {
"compost": 5,
"tools": 1
}
},
"memory": {
"goals": [
{
"id": "restore_soil",
"description": "Preserve soil nutrients and stabilize farm output.",
"importance": 3,
"score": 3,
"duration": 2
}
],
"known_options": {
"composting": {
"score": 1.3,
"soil_health": 0.9
},
"cover_crops": {
"score": 1.0,
"soil_health": 0.8
}
},
"relationships": {}
},
"goals": [
{
"id": "restore_soil",
"importance": 3,
"score": 3
}
],
"behaviors": [
{
"name": "remember",
"params": {
"category": "soil_context",
"content": {
"note": "The soil steward monitors nutrient depletion and restoration."
},
"tags": [
"soil",
"nutrients"
]
}
},
{
"name": "prioritize",
"params": {
"source_path": "memory.goals"
}
},
{
"name": "choose_goal",
"params": {}
},
{
"name": "evaluate",
"params": {
"category": "soil_strategy",
"candidate_options": [
"composting",
"cover_crops"
],
"known_options_path": "memory.known_options",
"adoption_threshold": 0.7
}
},
{
"name": "adopt",
"params": {
"option_id": "cover_crops",
"category": "soil_strategy",
"adoption_strength": 0.3,
"state_updates_on_adopt": {
"soil_practice": "cover_crops"
}
}
},
{
"name": "communicate",
"params": {
"message": "soil_health_update",
"target_agent_id": "farmer_1",
"max_recipients": 1
}
},
{
"name": "cooperate",
"params": {
"target_agent_id": "farmer_1",
"goal": "restore_soil",
"effort": 1.0
}
},
{
"name": "update_belief",
"params": {
"belief_id": "soil_is_resilient",
"proposition": "Soil quality can sustain future harvests.",
"evidence_path": "state.soil_health_signal",
"learning_rate": 0.2,
"write_belief_path": "memory.latest_soil_belief"
}
}
],
"policy": {
"type": "rule_policy",
"params": {
"selection_strategy": "highest_score",
"rules": [
{
"behavior_name": "choose_goal",
"score_delta": 4.0
},
{
"behavior_name": "evaluate",
"score_delta": 3.0
},
{
"behavior_name": "communicate",
"score_delta": 2.0
},
{
"behavior_name": "cooperate",
"score_delta": 1.5
},
{
"behavior_name": "update_belief",
"score_delta": 1.0
},
{
"behavior_name": "adopt",
"score_delta": 0.5
},
{
"behavior_name": "remember",
"score_delta": 0.2
},
{
"behavior_name": "prioritize",
"score_delta": 0.2
}
]
}
},
"alive": true,
"metadata": {
"role": "resource_health"
}
},
{
"id": "water_manager_1",
"type": "water_manager",
"position": [
7.5,
2.0
],
"state": {
"energy": 9,
"credits": 3,
"water_pressure_signal": 0.55,
"inventory": {
"pipes": 3,
"tools": 2
}
},
"memory": {
"goals": [
{
"id": "balance_water",
"description": "Keep water available without overusing reserves.",
"importance": 3,
"score": 2.8,
"duration": 2
}
],
"known_options": {
"drip_irrigation": {
"score": 1.2,
"water_efficiency": 0.9
},
"rationing": {
"score": 0.7,
"water_efficiency": 0.6
}
},
"relationships": {}
},
"goals": [
{
"id": "balance_water",
"importance": 3,
"score": 2.8
}
],
"behaviors": [
{
"name": "remember",
"params": {
"category": "water_context",
"content": {
"note": "The water manager observes irrigation pressure and resource levels."
},
"tags": [
"water"
]
}
},
{
"name": "prioritize",
"params": {
"source_path": "memory.goals"
}
},
{
"name": "choose_goal",
"params": {}
},
{
"name": "evaluate",
"params": {
"category": "water_strategy",
"candidate_options": [
"drip_irrigation",
"rationing"
],
"known_options_path": "memory.known_options",
"adoption_threshold": 0.75
}
},
{
"name": "adopt",
"params": {
"option_id": "drip_irrigation",
"category": "water_strategy",
"adoption_strength": 0.4,
"state_updates_on_adopt": {
"water_practice": "drip_irrigation"
}
}
},
{
"name": "communicate",
"params": {
"message": "water_status_update",
"target_agent_id": "farmer_1",
"max_recipients": 1
}
},
{
"name": "cooperate",
"params": {
"target_agent_id": "farmer_1",
"goal": "balance_water",
"effort": 1.0
}
},
{
"name": "build",
"params": {
"structure_id": "drip_irrigation_line",
"structure_type": "irrigation",
"material_cost": {
"pipes": 1.0
},
"work_required": 5.0,
"work_amount": 1.0,
"initial_capacity": 4.0,
"initial_durability": 6.0
}
},
{
"name": "update_belief",
"params": {
"belief_id": "water_supply_is_stable",
"proposition": "The farm has enough water pressure for current crops.",
"evidence_path": "state.water_pressure_signal",
"learning_rate": 0.25,
"write_belief_path": "memory.latest_water_belief"
}
}
],
"policy": {
"type": "rule_policy",
"params": {
"selection_strategy": "highest_score",
"rules": [
{
"behavior_name": "choose_goal",
"score_delta": 4.0
},
{
"behavior_name": "evaluate",
"score_delta": 3.0
},
{
"behavior_name": "communicate",
"score_delta": 2.0
},
{
"behavior_name": "cooperate",
"score_delta": 1.5
},
{
"behavior_name": "build",
"conditions": {
"state.inventory.pipes": {
"min": 1
}
},
"score_delta": 1.0
},
{
"behavior_name": "update_belief",
"score_delta": 0.8
},
{
"behavior_name": "adopt",
"score_delta": 0.4
},
{
"behavior_name": "remember",
"score_delta": 0.2
},
{
"behavior_name": "prioritize",
"score_delta": 0.2
}
]
}
},
"alive": true,
"metadata": {
"role": "infrastructure"
}
},
{
"id": "market_vendor_1",
"type": "market_vendor",
"position": [
8.0,
8.0
],
"state": {
"energy": 8,
"credits": 12,
"demand_signal": 0.7,
"inventory": {
"crates": 4,
"produce": 1
}
},
"memory": {
"goals": [
{
"id": "match_market_demand",
"description": "Track demand and share price signals with the farm.",
"importance": 2,
"score": 2.4,
"duration": 1
}
],
"known_options": {
"direct_sales": {
"score": 1.0,
"credits": 0.9
},
"community_supported_agriculture": {
"score": 0.9,
"trust": 0.8
}
},
"relationships": {}
},
"goals": [
{
"id": "match_market_demand",
"importance": 2,
"score": 2.4
}
],
"behaviors": [
{
"name": "remember",
"params": {
"category": "market_context",
"content": {
"note": "The vendor tracks demand and coordinates distribution."
},
"tags": [
"market"
]
}
},
{
"name": "prioritize",
"params": {
"source_path": "memory.goals"
}
},
{
"name": "choose_goal",
"params": {}
},
{
"name": "evaluate",
"params": {
"category": "market_strategy",
"candidate_options": [
"direct_sales",
"community_supported_agriculture"
],
"known_options_path": "memory.known_options",
"adoption_threshold": 0.75
}
},
{
"name": "communicate",
"params": {
"message": "market_demand_update",
"target_agent_id": "farmer_1",
"max_recipients": 1
}
},
{
"name": "cooperate",
"params": {
"target_agent_id": "farmer_1",
"goal": "match_market_demand",
"effort": 0.7
}
},
{
"name": "collect",
"params": {}
},
{
"name": "update_belief",
"params": {
"belief_id": "market_demand_is_high",
"proposition": "Market demand is strong enough to reward harvest activity.",
"evidence_path": "state.demand_signal",
"learning_rate": 0.25,
"write_belief_path": "memory.latest_market_belief"
}
}
],
"policy": {
"type": "rule_policy",
"params": {
"selection_strategy": "highest_score",
"rules": [
{
"behavior_name": "choose_goal",
"score_delta": 4.0
},
{
"behavior_name": "communicate",
"score_delta": 3.0
},
{
"behavior_name": "evaluate",
"score_delta": 2.0
},
{
"behavior_name": "cooperate",
"score_delta": 1.5
},
{
"behavior_name": "collect",
"score_delta": 1.0
},
{
"behavior_name": "update_belief",
"score_delta": 0.8
},
{
"behavior_name": "remember",
"score_delta": 0.2
},
{
"behavior_name": "prioritize",
"score_delta": 0.2
}
]
}
},
"alive": true,
"metadata": {
"role": "market_signal"
}
}
],
"resources": [
{
"id": "crop_patch_1",
"type": "crops",
"amount": 18,
"position": [
4.0,
5.0
],
"regeneration_rate": 0.4,
"max_amount": 30,
"metadata": {
"renewable": true,
"farm_layer": "field"
}
},
{
"id": "water_reserve_1",
"type": "water",
"amount": 24,
"position": [
7.0,
1.5
],
"regeneration_rate": 0.2,
"max_amount": 40,
"metadata": {
"renewable": true,
"farm_layer": "irrigation"
}
},
{
"id": "soil_nutrients_1",
"type": "soil_nutrients",
"amount": 16,
"position": [
5.0,
4.5
],
"regeneration_rate": 0.1,
"max_amount": 25,
"metadata": {
"renewable": true,
"farm_layer": "soil"
}
},
{
"id": "seed_bank_1",
"type": "seeds",
"amount": 10,
"position": [
2.0,
3.0
],
"regeneration_rate": 0,
"max_amount": 20,
"metadata": {
"renewable": false,
"farm_layer": "storage"
}
},
{
"id": "market_demand_1",
"type": "market_demand",
"amount": 14,
"position": [
8.5,
8.5
],
"regeneration_rate": 0.1,
"max_amount": 25,
"metadata": {
"renewable": true,
"farm_layer": "market"
}
}
],
"events": [
{
"id": "dry_spell",
"name": "dry_spell",
"trigger_step": 20,
"payload": {
"description": "A dry spell increases the importance of water coordination.",
"signals": {
"water_pressure": -0.2,
"soil_moisture": -0.2
}
},
"enabled": true,
"repeat_interval": null,
"target_agent_ids": [
"farmer_1",
"water_manager_1",
"soil_steward_1"
],
"target_resource_ids": [
"water_reserve_1",
"soil_nutrients_1"
],
"metadata": {
"narrative_hint": "Environmental pressure tests coordination."
}
},
{
"id": "market_surge",
"name": "market_surge",
"trigger_step": 40,
"payload": {
"description": "Market demand rises, increasing the value of harvest and distribution coordination.",
"signals": {
"demand": 0.25
}
},
"enabled": true,
"repeat_interval": null,
"target_agent_ids": [
"farmer_1",
"market_vendor_1"
],
"target_resource_ids": [
"market_demand_1"
],
"metadata": {
"narrative_hint": "Economic pressure rewards coordination."
}
}
],
"metrics": [
{
"name": "diversity",
"params": {
"collection": "agents",
"group_by_path": "type"
},
"enabled": true,
"metadata": {
"display": "Agent type diversity"
}
},
{
"name": "entropy",
"params": {
"collection": "agents",
"value_path": "type"
},
"enabled": true,
"metadata": {
"display": "Agent type entropy"
}
},
{
"name": "stability",
"params": {
"collection": "agents",
"group_by_path": "type"
},
"enabled": true,
"metadata": {
"display": "Population stability"
}
},
{
"name": "interestingness",
"params": {
"collection": "agents",
"group_by_path": "type"
},
"enabled": true,
"metadata": {
"display": "Composite interestingness"
}
}
],
"metadata": {
"example": true,
"domain": "farm",
"created_for": "WorldSmithAI Gradio demo",
"design_note": "No farm-specific runtime classes are required. The example uses generic agents, resources, behaviors, policies, metrics, and events."
}
}