Error in Agent pos attribute Prisoner’s Dilemma Agents

I am trying to duplicate the demographic Prisoner’s Dilemma by Epstein. I am having a code problem related to moving the agent according to my below function. basically I canot get the attribute position.
function movement!(agent, model)
newsite = agent.pos
# find all unoccupied position within vision
neighbors = nearby_positions(agent.pos, model, agent.Vision)
empty = collect(empty_positions(model))
if length(empty) > 0
newsite = rand(empty)
end
newsite != agent.pos && move_agent!(agent, newsite, model)
agent.Age += 1
#play nearby neighbors
nearbyAgents = collect(nearby_agents(agent, model, agent.Vision))
if length(nearbyAgents)>0
for ne in 1:length(nearbyAgents)
if agent.Strategy==true && nearbyAgents[ne].Strategy== true
agent.Wealth+= payoff[:R]
elseif agent.Strategy == false && nearbyAgents[ne].Strategy == true
agent.Wealth+= payoff[:T]
elseif agent.Strategy == false && nearbyAgents[ne].Strategy == false
agent.Wealth+= payoff[:P]
elseif agent.Strategy == false && nearbyAgents[ne].Strategy == true
agent.Wealth+= payoff[:S]
end
end
end
end
movement!(Test, Model)

and I get this error

While this is how I define my agent
mutable struct Test <: AbstractAgent
id::Int
pos::Dims{2}
Strategy::Bool
Wealth::Int
Age::Int
Max_Age::Int
Vision::Int
end

And this is how I define my model:
#initializing agents
Model= ABM(Test,space,properties = properties,scheduler = random_activation)
for ag in 1:N
add_agent_single!(
Model,rand(Bool),Intial_Endowment,0,rand(max_age_dist[1]:max_age_dist[2]),
rand(vision_dist[1]:vision_dist[2])
)
end

As far as I can tell the problem is in movement!(Test, Model) in the last line of this block:

movement!, your stepping function, needs an agent instance to work, but in the last liner it gets the Agent type Test.

Thank you… I should have used Model[id] instead of Test.