The Gather-Trade-Build simulation is the core scenario in the AI Economist Foundation framework. Mobile agents navigate a 2D grid world, gather scarce resources (wood and stone), trade them with each other through a commodity exchange, and use the resources to build houses and earn income. A social planner agent sets tax policy to influence the distribution of wealth.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/salesforce/ai-economist/llms.txt
Use this file to discover all available pages before exploring further.
Scenario variants
Two scenario names are registered:| Scenario name | Layout |
|---|---|
uniform/simple_wood_and_stone | Resources placed stochastically at reset with configurable clumping and gradient |
layout_from_file/simple_wood_and_stone | Resources placed according to a fixed map file (e.g. quadrant_25x25_20each_30clump.txt) |
BasicMobileAgent, BasicPlanner) and required entities (Wood, Stone).
Components used
Gather (move.py)
Gather (move.py)
Registered as
Gather. Allows mobile agents to move around the world and collect resources. Supports heterogeneous collection skill via skill_dist (none, pareto, or lognormal). Key parameters:move_labor(float, default1.0): Labor cost per move.collect_labor(float, default1.0): Additional labor cost when collecting a resource.skill_dist(str, default"none"): Skill distribution for bonus collection probability.
Build (build.py)
Build (build.py)
Registered as
Build. Allows agents to spend 1 wood + 1 stone to place a house landmark, earning coin. Supports heterogeneous build skill. Key parameters:payment(int, default10): Base coin earned per house built.payment_max_skill_multiplier(int, default1): Upper bound on the skill multiplier.skill_dist(str, default"none"): Skill distribution for build income.build_labor(float, default10.0): Labor cost per build action.
ContinuousDoubleAuction (continuous_double_auction.py)
ContinuousDoubleAuction (continuous_double_auction.py)
Registered as
ContinuousDoubleAuction. Implements a commodity-exchange-style market where agents submit bids and asks for resources. Trades clear when a bid meets or exceeds an ask. Key parameters:max_bid_ask(int, default10): Maximum coin value for a bid or ask.order_labor(float, default0.25): Labor cost for placing an order.order_duration(int, default50): Timesteps before an unfilled order expires.max_num_orders(int, optional): Maximum open orders per resource per agent.
WealthRedistribution / PeriodicBracketTax (redistribution.py)
WealthRedistribution / PeriodicBracketTax (redistribution.py)
Two redistribution components are available:
WealthRedistribution: Passively divides total agent coin equally each step. No planner actions required.PeriodicBracketTax: The planner sets marginal tax bracket rates. Taxes are collected and redistributed as lump-sum payments at the end of each tax period.
WealthRedistribution must always be placed last in the component list.Key scenario parameters
TheUniform scenario (uniform/simple_wood_and_stone) exposes the following constructor arguments in addition to the base environment arguments.
| Parameter | Type | Default | Description |
|---|---|---|---|
n_agents | int | — | Number of mobile agents (passed via base env config) |
world_size | list | — | [height, width] of the grid (passed via base env config) |
episode_length | int | — | Number of timesteps per episode (passed via base env config) |
starting_wood_coverage | float | 0.025 | Target fraction of tiles covered by wood at reset |
wood_regen_halfwidth | int | 0 | Spatial halfwidth of the wood regeneration kernel |
wood_regen_weight | float | 0.01 | Per-tile regen probability for wood |
wood_max_health | int | 1 | Maximum wood units per source tile |
wood_clumpiness | float | 0.35 | Degree of spatial wood clustering |
starting_stone_coverage | float | 0.025 | Target fraction of tiles covered by stone at reset |
stone_regen_halfwidth | int | 0 | Spatial halfwidth of the stone regeneration kernel |
stone_regen_weight | float | 0.01 | Per-tile regen probability for stone |
stone_max_health | int | 1 | Maximum stone units per source tile |
stone_clumpiness | float | 0.5 | Degree of spatial stone clustering |
gradient_steepness | float | 8 | How steeply wood/stone are restricted to opposite ends of the map |
starting_agent_coin | float | 0 | Coin each agent starts with |
isoelastic_eta | float | 0.23 | Isoelastic utility shape parameter (0 = linear, 1 = log) |
energy_cost | float | 0.21 | Coefficient converting labor to negative utility |
energy_warmup_constant | float | 0 | Annealing decay constant for energy cost (0 = no annealing) |
energy_warmup_method | str | "decay" | "decay" (episode count) or "auto" (positive-reward timesteps) |
planner_reward_type | str | "coin_eq_times_productivity" | Planner reward: "coin_eq_times_productivity", "inv_income_weighted_coin_endowment", or "inv_income_weighted_utility" |
mixing_weight_gini_vs_coin | float | 0.0 | Weight on productivity vs. equality for the planner reward (0 = equal weighting, 1 = productivity only) |
Instantiating the environment
Observation space
Each mobile agent’s observation consists of:- A spatial tensor (egocentric or full-world view, depending on
full_observability) with channels for each resource type, agent locations, house locations, and water. - Inventory contents: current holdings of Wood, Stone, Coin, and Labor.
- Endogenous quantities: accumulated labor.
- A spatial tensor of the world (if
planner_gets_spatial_info=True). - The inventory of each mobile agent.
- Current tax rates (when using
PeriodicBracketTax).
Reward structure
Mobile agents receive isoelastic utility over coin minus a labor cost:u(coin) is the isoelastic function parameterized by isoelastic_eta.
The social planner receives one of three reward types (set via planner_reward_type):
| Type | Description |
|---|---|
coin_eq_times_productivity | Product of equality (1 − Gini) and total coin productivity, weighted by mixing_weight_gini_vs_coin |
inv_income_weighted_coin_endowment | Inverse-income-weighted average coin endowment |
inv_income_weighted_utility | Inverse-income-weighted average utility |
Tutorials
Economic simulation (basic)
Interact with and visualize the simulation interactively in Colab.
Economic simulation (advanced)
Explore composable building blocks and custom scenario construction.
Optimal taxation
Use the simulation to study optimal tax policy design.
Multi-agent training with RLlib
Train agents with distributed RL using RLlib.