The abce.Agent class is the basic class for creating your agents. It automatically handles the possession of goods of an agent. In order to produce/transforme goods you also need to subclass the abce.Firm or to create a consumer the abce.Household.

For detailed documentation on:

Trading, see Trade

Logging and data creation, see Observing agents and logging.

Messaging between agents, see Messaging.

class abce.Agent(id, agent_parameters, simulation_parameters, group, trade_logging, database, check_unchecked_msgs, expiring, perishable, resource_endowment, start_round=None)[source]

Bases: abce.database.Database,, abce.messaging.Messaging, abce.goods.Goods

Every agent has to inherit this class. It connects the agent to the simulation and to other agent. The abce.Trade, abce.Database and abce.Messaging classes are included. An agent can also inheriting from abce.Firm, abce.FirmMultiTechnologies or abce.Household classes.

Every method can return parameters to the simulation.

For example:

class Household(abce.Agent, abce.Household):
    def init(self, simulation_parameters, agent_parameters):
        self.num_firms = simulation_parameters['num_firms']
        self.type = agent_parameters['type']

    def selling(self):
        for i in range(self.num_firms):
            self.sell('firm', i, 'good', quantity=1, price=1)

    def return_quantity_of_good(self):


simulation = Simulation()
households = Simulation.build_agents(household, 'household',
                                     agent_parameters=[{'type': 'a'},
                                                       {'type': 'b'}])
for r in range(10):
group = None returns the agents group or type READ ONLY!

id = None returns the agents id READ ONLY


This method is called when the agents are build. It can be overwritten by the user, to initialize the agents. Parameters are the parameters given to abce.Simulation.build_agents().


class Student(abce.Agent):
    def init(self, rounds, age, lazy, school_size):
        self.rounds = rounds
        self.age = age
        self.lazy = lazy
        self.school_size = school_size

    def say(self):
        print('I am', self.age ' years old and go to a school
        that is ', self.school_size')

def main():
    sim = Simulation()
    students = sim.build_agents(Student, 'student',
                                agent_parameters=[{'age': 12, lazy: True},
                                                  {'age': 12, lazy: True},
                                                  {'age': 13, lazy: False},
                                                  {'age': 14, lazy: True}],
name = None returns the agents name, which is the group name and the id

round = None

self.round is depreciated

time = None

self.time, contains the time set with simulation.advance_round(time) you can set time to anything you want an integer or (12, 30, 21, 09, 1979) or ‘monday’