Skip to content

Use postgres as default session service#46

Merged
falquaddoomi merged 7 commits intomainfrom
issue-45-use-db-sessions
Mar 11, 2026
Merged

Use postgres as default session service#46
falquaddoomi merged 7 commits intomainfrom
issue-45-use-db-sessions

Conversation

@falquaddoomi
Copy link
Copy Markdown
Collaborator

As mentioned in #45, a recent(?) change to the version of google-adk we're using is causing an exception when we attempt to add figures to the context when using the default session service, InMemorySessionService.

A quick fix introduced in this PR is to switch to DatabaseSessionService, in our case backed by postgres. Recent(?) changes in google-adk require the database connection to be async-compatible, so this PR also adds a dependency on asyncpg and has the backend use it when constructing a database connection.

This PR amends the documentation to use the docker-compose.with-pg.yml compose config in both the dev and prod instructions, which starts a postgres container and instructs the backend to use it.

I also included a run_stack.sh shell script and would like to know if we'd like to switch the documentation over to using it. There are a few perks to using it:

  • it copies the .env.TEMPLATE file to .env and fills in missing passwords with secure randomly-generated ones
  • it constructs the required compose configs based on the selected environment, reducing possible mistakes
  • IMHO it improves the behavior after launching the stack: dev remains attached, and prod detaches + tails the logs

Of course, encouraging them to use run_stack.sh implies they have a GNU environment in which to run bash scripts.

Closes #45.

@falquaddoomi falquaddoomi requested a review from d33bs March 11, 2026 15:03
Copy link
Copy Markdown
Collaborator

@d33bs d33bs left a comment

Choose a reason for hiding this comment

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

LGTM!

Comment thread run_stack.sh
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.

This could be worth a quick check with shellcheck. I don't see anything especially dangerous but it might provide some good feedback for string composition.

@falquaddoomi falquaddoomi merged commit 891a726 into main Mar 11, 2026
1 check passed
@falquaddoomi falquaddoomi deleted the issue-45-use-db-sessions branch March 11, 2026 20:17
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.

Exception when submitting image assets

2 participants