Agent-based model in Streamlit


I am working on an agent-based simulation in Streamlit, and the model runs extremely slow. I am looking for solutions such as calling API or using external resources. Still, no luck so far! So now I am open to explore any alternative solutions form the streamlit community.

Btw, the simulation that I am working on is dealing with approx 60,000 agents, and the clock cycle is hourly.

Hi @Chaitawat

Perhaps the streamlit-profiler might be of use to help you optimize your code:

Alternatively, if this is a computation intensive task, it may be worth to have the simulation live on an external cloud server and interface with that via API call as you had mentioned. It’s because the Community Cloud computer resource is provided 1 GB memory (StreamlitCloud Computer Specs).

Please have a look at the following blog by @asehmi for some ideas on accessing a remote API from within a Streamlit app.

Best regards,