TheDocumentation 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.
Gather component (registered as "Gather") allows BasicMobileAgent instances to navigate the world grid in four cardinal directions and automatically collect resources when they land on populated resource tiles. Movement and collection each incur a configurable labor cost, and agents can optionally have heterogeneous collection skills sampled from statistical distributions.
The class name is
Gather and its registry name is "Gather". It applies only to agents of subclass BasicMobileAgent.Constructor parameters
Labor cost incurred each time an agent successfully moves to an adjacent tile. Must be
>= 0.Additional labor cost incurred on top of movement cost when the agent lands on a tile containing a resource and triggers collection. Must be
>= 0.Distribution used to sample each agent’s
bonus_gather_prob at episode reset.| Value | Behavior |
|---|---|
"none" | All agents receive bonus_gather_prob = 0.0 (no bonus) |
"pareto" | Skills sampled from a Pareto distribution, clipped and normalized to [0, 1] |
"lognormal" | Skills sampled from a log-normal distribution, clipped and normalized to [0, 1] |
Action space
This component adds 4 discrete movement actions for eachBasicMobileAgent:
| Action index | Meaning |
|---|---|
0 | No-op — agent stays in place |
1 | Move left (column − 1) |
2 | Move right (column + 1) |
3 | Move up (row − 1) |
4 | Move down (row + 1) |
Movement and resource collection
On each timestep the component iterates over all agents in a random order and:- Resolves the chosen direction by calling
world.set_agent_loc(). If the target tile is occupied or out of bounds the agent stays put. - Charges
move_labortoagent.state["endogenous"]["Labor"]if the agent actually moved. - Checks every resource at the agent’s final tile via
world.location_resources(). - For each resource with
health >= 1, collects1unit (or2ifrand() < agent.state["bonus_gather_prob"]), callsworld.consume_resource(), and chargescollect_labor.
Coin, House, Labor.
Collection skill
Each agent carries abonus_gather_prob state field (float in [0, 1]). When this value is non-zero, each collection event has a chance of yielding an extra unit of the resource at no extra labor cost.
Skills are re-sampled at the start of every episode via additional_reset_steps():
reset skill sampling
Observations
Each agent observes its own collection skill. The planner receives nothing from this component.The agent’s probability of collecting a bonus resource unit on each gather event. Keyed by agent index string.
Action masks
Generated every step, the mask for each of the 4 movement directions is1 only if the target tile is both unoccupied and accessible (according to world.maps.unoccupied and world.maps.accessibility). No-op (index 0) is always allowed.
Dense log
get_dense_log() returns a list of gather events — one list per timestep. Each gather event is a dict:
Index of the agent that collected the resource.
Name of the collected resource (e.g.,
"Wood", "Stone").Number of units collected (
1 or 2).[row, col] of the tile where collection occurred.