Is the python ag_ui_langgraph "thread" safe? #692
marksmithson
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
(Yes FastAPI uses asyncio, and uses a single thread, so not strictly thread safety, rather safe for concurrent use)
Looking at the Python FastAPI endpoint , this takes a
LangGraphAgentas an argument.This means that the agent is shared across all requests. The agent implementation appears to store state for each request in
self.active_run.Within the
runfunction it callsawait self.graph.aget_state(config)potentially yielding to another requestDoesn't this mean that concurrent requests to FastAPI may change this variable for different requests?
Or have I misunderstood how asyncio works in this case? (newish to python so not impossible)
Beta Was this translation helpful? Give feedback.
All reactions