Passing db connection object as tool context

I have 2 tools: db_connection tool and sql_query_execution tool.

I want create_react_agent to call first the db_connection,pass the db connection object through customstate and sql_query_execution to read the db connection object through customstate.

Is there a reason you don’t want to establish a db connection using a custom lifespan event? I think this is a scenario where it makes more sense to have database connections available independent of the agent.

I did some quick search just now and found custom lifespan event under langgraph platform.

Can it be used without langgraph platform with fastapi?

Can you please point me to the resources on how to use without fastapi and langgraph platform.