Skip to main content
You can customize the lifespan context manager of the AgentOS. This allows you to run code before and after the AgentOS is started and stopped. For example, you can use this to:
  • Connect to a database
  • Log information
  • Setup a monitoring system
See FastAPI documentation for more information about the lifespan context manager.
For example:
custom_lifespan.py