agents and control return it elseranreal -prob raise runtimeerror(str(item_prob_dist)+is not probability distribution"the agent the agent does not have access to the price model but can only observe the current price and the amount in stock it has to decide how much to buy the belief state of the agent is an estimate of the average price of the paperand the total amount of money the agent has spent agents py -(continued class tp_agent(agent)def __init__(selfenv)self env env self spent percepts env initial_percepts(self ave self last_price percepts['price'self instock percepts['instock' def go(selfn)"""go for time steps ""for in range( )if self last_price *self ave and self instock tobuy elif self instock tobuy elsetobuy self spent +tobuy*self last_price percepts env do({'buy'tobuy}self last_price percepts['price'self ave self ave+(self last_price-self ave)* self instock percepts['instock'set up an environment and an agent uncomment the last lines to run the agent for stepsand determine the average amount spent agents py -(continued env tp_env(ag tp_agent(env#ag go( #ag spent/env time #average spent per time period version june