Implementing Agent Classes¶
All agents used in Creamas must inherit from
CreativeAgent. They should also accept
the agent’s Environment as the first
parameter in their __init__(). The environment should then be passed on
to super().__init__().
Each agent class should call super().__init__() as one of the first
things in __init__(), for example:
from creamas import CreativeAgent, Environment
class MyAgent(CreativeAgent):
def __init__(self, environment, *args, **kwargs):
self.my_arg = kwargs.pop('my_arg', None)
super().__init__(environment, *args, **kwargs)
# Your own initialization code
env = Environment.create(('localhost', 5555))
agent = MyAgent(env, my_arg=5)
# do stuff
env.close()