Python session status
Each new Assistant thread runs a Python environment. It is in the Python environment where all Python code suggested by the Assistant runs to deliver data insights and visualizations.
After you create a new thread, the Python session is initialized in the background before it becomes ready for use. Until then, the Python session status is Initializing.
![Python session initializing](/docs/_next/image?url=%2Fdocs%2Fdocimages%2Fassistant%2Fpython-session-initializing.webp&w=1920&q=75)
After the Python session becomes available, its status changes to Running.
![Python session running](/docs/_next/image?url=%2Fdocs%2Fdocimages%2Fassistant%2Fpython-session-running.webp&w=1920&q=75)
After 15 minutes of inactivity, the Python session status changes to Expired.
![Python session expired](/docs/_next/image?url=%2Fdocs%2Fdocimages%2Fassistant%2Fpython-session-expired.webp&w=1920&q=75)
Handle expired Python sessions
After the Python session expires in a thread, you can no longer run Python code in that thread. If you try to run Python code in an expired Python session, you will see an error message.
To run Python again, you need to create a new Assistant thread.