Static runtime context represents immutable data like user metadata, tools, and database connections that are passed to an application at the start of a run via the context argument to invoke/stream
Up until now I’ve been using RunnableConfig to define a schema to provide an Assistant (Langgraph Platform) configuration for prompts, but I’m interested to understand how I can use the Runtime to continue to do this but also potentially provide additional functionality of holding runtime data.
Yeah i am also wondering this since the documentation is really just scratching the surface at this point have you figured it out ? I am looking for a way to initiate a AsyncConnectionPool on startup which gets then passed as an object in runtime context.
The issue with Runtime Context though is that I don’t use .invoke()on the graph when using LangGraph Server. How do you suggest we inject the db when running via LangGraph Server?
Yes same issue for me. Basically I no longer rely on context. I populate whats needed in configurable, and instantiate any instances using those static values in the graph.
Same issue for me, what i did in the end was initializing my db connection via a custom lifespan event., following this doc: How to add custom lifespan events - Docs by LangChain , this seems to work well with my async db pool, though i am still not sure whats the best way to access my db objects now via graph nodes.