ADK Agent Parallel Processing - Session Management and Response Mixing Issues #3076
karthirrp12
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.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello All,
I have an ADK agent deployed in a GKE pod and am accessing it from a React application through FastAPI endpoints. Here's my setup:
Current Architecture:
app: FastAPI = get_fast_api_app(
agents_dir=AGENT_DIR,
allow_origins=["*", "http://localhost:3000", "http://localhost:3001"],
web=True)
Two main endpoints:
Session creation: {BASE_URL}/apps/{APP_NAME}/users/{USER_ID}/sessions
Prompt submission: {BASE_URL}/run_sse (for agent responses)
Requirement:
I need to call the /run_sse endpoint in parallel to populate different sections of my react application simultaneously.
Approaches Tested:
Approach 1 - Single Shared Session:
Created one session, shared the session ID across multiple parallel threads
Issues: Response mixing (requests receiving wrong responses) and occasional no-response scenarios
Suspected cause: Session state contamination
Approach 2 - Multiple Isolated Sessions:
Created separate sessions for each parallel request
Issues: Frequent "no responses" despite successful session creation
All prompts work perfectly when tested individually through the ADK web console, even across different browsers simultaneously.
So here are my questions,
Consistency Gap:
Why does the ADK web console handle parallel requests consistently while /run_sse doesn't? Is /run_sse the recommended approach for external integrations, or are there more stable alternatives?
Best Practice: Which approach should I follow - shared session (Approach 1) or isolated sessions (Approach 2)? What are the recommended patterns considering session management, performance, and scalability?
ADK Limitations: Are there known limitations or best practices for ADK parallel processing that I should be aware of?
I'd appreciate guidance on the most reliable way to implement parallel agent calls while maintaining response accuracy and system stability.
Beta Was this translation helpful? Give feedback.
All reactions