Agents


As the name suggests, agents lie at the heart of agent-based modeling. Agents are made up of State, Behaviors, and Context.

Anatomy of an Agent

Every agent has a name and a unique identifier. As a simulation creator, you can set and change the agent_name and you can set the agent_idbefore the agent is initialized, but you can't change the agent_id after the simulation has started.

The HASH Engine by default will set the agent_id, so don't worry about setting it manually unless you have a particular need for an agent's id value in the sim logic.

JavaScript
Python
const agent = {
    agent_id: <uuid v4>, // Set on_create by the hEngine
    agent_name: <string>
}

Naming your agent is entirely optional. The simplest possible agent is simply {} (although it won't do much of anything!)

An individual agent has a state and a context.

An Agent

When we define the initial conditions of a simulation, we're defining the initial agents that will be present in the first timestep of the simulation, each of which will have its own state and context.

Three agents, ready to simulate.

Join our community of HASH developers