Skip to content

docs: Demonstration of Google Firestore for Persistent session data … - #2818

Open
mohan-ganesh wants to merge 9 commits into
google:mainfrom
mohan-ganesh:firestore-session-servicev1
Open

mohan-ganesh wants to merge 9 commits into
google:mainfrom
mohan-ganesh:firestore-session-servicev1

Conversation

@mohan-ganesh

Copy link
Copy Markdown

docs: Demonstration of Google Firestore for Persistent session data

Add agent demonstrating session persistence using Google Cloud Firestore

This commit introduces a new sample agent, FirestoreRunner, that shows how to use FirestoreDatabaseRunner to persist agent session state. It includes a simple time-telling agent and a corresponding test class

Submitting new PR @happyhuman as per #772

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated House Rules review — 2 finding(s).

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated Security review — 2 finding(s).


Round 1 · 0 of this PR's 25 automated comments used · this round is capped at 20 across all reviewers.

@mohan-ganesh
mohan-ganesh force-pushed the firestore-session-servicev1 branch 3 times, most recently from d2891b1 to bc61289 Compare October 18, 2026 20:51
@github-actions github-actions Bot added the status/not-ready-for-review Review requests held until checks pass and bot comments are resolved label Oct 19, 2026
@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Ready for review. All checks pass.

Re-requested review from tommywagz.

@mohan-ganesh
mohan-ganesh force-pushed the firestore-session-servicev1 branch from bc61289 to e870529 Compare October 19, 2026 22:05
@github-actions github-actions Bot removed the status/not-ready-for-review Review requests held until checks pass and bot comments are resolved label Oct 19, 2026
@github-actions github-actions Bot added the status/not-ready-for-review Review requests held until checks pass and bot comments are resolved label Oct 28, 2026
@mohan-ganesh
mohan-ganesh force-pushed the firestore-session-servicev1 branch from b189f71 to 12893ca Compare October 28, 2026 21:47
@github-actions github-actions Bot removed the status/not-ready-for-review Review requests held until checks pass and bot comments are resolved label Oct 28, 2026

@happyhuman happyhuman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just reviewed the PR and left a few comments. PTAL

Comment thread .github/policy.yml Resolved
language: "java" # Options: [python | java | go | kotlin | typescript]
description: "Demonstrates persistent multi-turn conversation using Google Firestore as a session data store with the ADK Java SDK."

deployable: true

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The .github/policy.yml entry in this PR notes FirestoreRunner is an interactive stdin CLI rather than a service. Should deployable be false here?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This issue was flagged from my prior run..

Looking at tools/validate_manifest.py — every recipe under contrib/ is required to have deployable: true unconditionally, so it needs to stay. The .github/policy.yml exemption I added is answering a different question: it only skips the recipe-docker-build HTTP-probe step for this recipe, since FirestoreRunner is a stdin CLI and never binds a port — the image still gets built. Added a comment on the deployable: true line in the manifest clarifying this so it doesn't look contradictory again.

@github-actions github-actions Bot added the status/not-ready-for-review Review requests held until checks pass and bot comments are resolved label Oct 31, 2026
@mohan-ganesh
mohan-ganesh force-pushed the firestore-session-servicev1 branch from 4c2b737 to 7a4f290 Compare October 31, 2026 17:49
@github-actions github-actions Bot removed the status/not-ready-for-review Review requests held until checks pass and bot comments are resolved label Oct 31, 2026
@mohan-ganesh

Copy link
Copy Markdown
Author

thanks for review Shahin @happyhuman. I have addressed all except the manifest.yml.. that seem to have dependancy on the contrib/ is required to have deployable: true unconditionally.. please take a look.

@happyhuman happyhuman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just reviewed the PR and left a few comments. PTAL

.toMaybe()
: Maybe.error(error))
.blockingGet();
logger.info("Resumed session " + sessionId + " for user " + userId);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems this still logs "Resumed session" when the SessionNotFoundException fallback above created a brand-new session instead. Is that intentional?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was intentional. If the user passes an user id and session id, if found use, else create the session using the provided values for demonstration.

logger.info("FirestoreRunner finished execution.");
// The Gemini API client leaves non-daemon OkHttp threads running; force
// a clean exit instead of waiting on them to time out.
System.exit(0);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still exits 0 after the catch above

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The System.exit(0) isn't there to handle the exception from the catch block above — it's there regardless of whether an exception occurs. The catch only logs errors from the chat loop; it doesn't change the JVM's thread state.

The real issue is that the Gemini API client (via OkHttp) spins up non-daemon threads internally. Those threads keep running even after main() returns normally, which means the JVM won't exit on its own — the process just hangs. System.exit(0) forces termination so the process doesn't get stuck waiting on threads we don't manage.

So this isn't error-path cleanup; it's unconditional shutdown needed because of a dependency's threading behavior, placed after the try-catch so it runs whether we exit via quit, EOF, or a caught exception.

@mohan-ganesh

Copy link
Copy Markdown
Author

@happyhuman updated the comments to two new query.

@happyhuman happyhuman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just reviewed the PR and left a few comments. PTAL

mohan-ganesh and others added 2 commits November 7, 2026 18:25
- Comment out GOOGLE_API_KEY in .env.example for default Vertex AI path
- Document env export step in README for Java runtime
- Preserve stack trace on error in FirestoreRunner
- Remove redundant resources COPY in Dockerfile
- Add Apache-2.0 license header to logback.xml
@mohan-ganesh

Copy link
Copy Markdown
Author

@happyhuman addressed the latest review comments.. please review them.

…el to gemini-3.7-flash, and add docker docs

- Update default model from gemini-3.5-flash to gemini-3.7-flash
- Add .dockerignore to exclude target, .env, and metadata from build context
- Add Apache-2.0 license header to adk-firestore.properties
- Document interactive Docker CLI usage in README

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants