# Recording data from model\_step in Agents.jl

**URL:** https://discourse.julialang.org/t/recording-data-from-model-step-in-agents-jl/131543
**Category:** Modelling & Simulations
**Created:** [August 12, 2025, 3:05am UTC](https://discourse.julialang.org/t/recording-data-from-model-step-in-agents-jl/131543 "2025-08-12T03:05:25Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![geoffD](https://avatars.discourse-cdn.com/v4/letter/g/cdc98d/32.png) [@geoffD](https://discourse.julialang.org/u/geoffD)
#### Post date: [August 12, 2025, 3:05am UTC](https://discourse.julialang.org/t/recording-data-from-model-step-in-agents-jl/131543/1 "2025-08-12T03:05:25Z")

</div>

Hi, I am trying to increment a few pieces of data on every model step in Agents.jl. Data are structured as Dict entries. The code appears to be incrementing appropriately when I examine the values from within model\_step! using @infiltrate.

However, the corresponding variable in the model dataframe is constant for each time step.

I’ve replicated this issue by adding a couple of snippets to the Schelling model. Any suggestions on how to recover the appropriate values at each time step? Thanks!

Here is the code:

```julia-auto
function model_step!(model)
    model.foo["baz"] += 1 
    model.foo["bar"] += 5 
end 

@kwdef mutable struct Parameters
    min_to_be_happy::Int = 3
    foo::Dict{String,Int16} = Dict("baz" => 0, "bar" => 0) 
end

```

And the output from mdf

0 Dict{String, Int16}(“bar”=\>25, "…  
1 Dict{String, Int16}(“bar”=\>25, "…  
2 Dict{String, Int16}(“bar”=\>25, "…  
3 Dict{String, Int16}(“bar”=\>25, "…  
4 Dict{String, Int16}(“bar”=\>25, "…  
5 Dict{String, Int16}(“bar”=\>25, "…
