Skip to content

chore: follow-up #946 to allow session db kwargs in fast api entrance. - #1042

Closed
Colstuwjx wants to merge 5 commits into
google:mainfrom
Colstuwjx:chore/expose-database-args-in-fastapi
Closed

Colstuwjx wants to merge 5 commits into
google:mainfrom
Colstuwjx:chore/expose-database-args-in-fastapi

Conversation

@Colstuwjx

Copy link
Copy Markdown
Contributor

No description provided.

@Colstuwjx

Copy link
Copy Markdown
Contributor Author

Hi @DeanChensj , this is the follow-up PR to #946 since some end users might directly use get_fast_api_app to init the adk application web service, it's also necessary to expose these database settings on the fastapi side.

Thanks.

@Colstuwjx

Copy link
Copy Markdown
Contributor Author

Here are the customized db kwargs on our internal project:

# Call the function to get the FastAPI app instance
# Ensure the agent directory name ('capital_agent') matches your agent folder
app: FastAPI = get_fast_api_app(
    agents_dir=AGENTS_DIR,
    session_db_url=SESSION_DB_URL,
    allow_origins=ALLOWED_ORIGINS,
    # Setting this to True would invalidate any additional routes
    # we did a workaround: https://github.com/google/adk-python/issues/51#issuecomment-2899152791
    web=False,
    session_db_kwargs={
        "pool_pre_ping": True,
        "pool_recycle": 3600,
    },
)

@rpedela-recurly

Copy link
Copy Markdown

My team needs this change! Thanks for contributing!

@hangfei
hangfei requested a review from DeanChensj May 30, 2025 17:36
Comment thread src/google/adk/cli/fast_api.py Resolved
Comment thread src/google/adk/cli/fast_api.py Resolved
@hangfei hangfei modified the milestone: 05/14 Sprint May 30, 2025
@DeanChensj DeanChensj added the services [Component] This issue is related to runtime services, e.g. sessions, memory, artifacts, etc label Jul 21, 2025
@DeanChensj DeanChensj added the ready to pull [Status] This PR is ready to be imported back to Google label Jul 22, 2025
copybara-service Bot pushed a commit that referenced this pull request Jul 22, 2025
Merge #1042

COPYBARA_INTEGRATE_REVIEW=#1042 from Colstuwjx:chore/expose-database-args-in-fastapi 83a20cf
PiperOrigin-RevId: 785714547
@DeanChensj

Copy link
Copy Markdown
Collaborator

Merged in 6cc3d9d

@DeanChensj DeanChensj closed this Jul 22, 2025
pandasanjay pushed a commit to pandasanjay/adk-python that referenced this pull request Jul 28, 2025
…trance

Merge google#1042

COPYBARA_INTEGRATE_REVIEW=google#1042 from Colstuwjx:chore/expose-database-args-in-fastapi 83a20cf
PiperOrigin-RevId: 785714547
knaou pushed a commit to knaou/adk-python that referenced this pull request Aug 16, 2025
…trance

Merge google#1042

COPYBARA_INTEGRATE_REVIEW=google#1042 from Colstuwjx:chore/expose-database-args-in-fastapi 83a20cf
PiperOrigin-RevId: 785714547
FrigaZzz pushed a commit to FrigaZzz/adk-python that referenced this pull request Aug 11, 2026
…trance

Merge google#1042

COPYBARA_INTEGRATE_REVIEW=google#1042 from Colstuwjx:chore/expose-database-args-in-fastapi 83a20cf
PiperOrigin-RevId: 785714547
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready to pull [Status] This PR is ready to be imported back to Google services [Component] This issue is related to runtime services, e.g. sessions, memory, artifacts, etc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants