adk-python
adk-python copied to clipboard
How to specify a persistent session when running an agent using the "adk web" or "adk api_derver" command?
https://google.github.io/adk-docs/get-started/testing/ After starting the local FastAPI server in the tutorial, only sessions can be created through the interface, but these sessions are temporary.
# How to start API services with locally persistent sessions?
ADK_SQLALCHEMY_DATABASE_URL = "sqlite:///./adk.db"
session_service = DatabaseSessionService(db_url=ADK_SQLALCHEMY_DATABASE_URL)
root_agent = Agent(
name=DEFAULT_ADK_APPNAME,
model=LiteLlm(model=MODEL),
description="",
instruction="",
tools=[],
)
In adk web you can pass in database url like this adk web --session_db_url=[db_url] for a persistent session service.
您可以像这样为持久会话服务传入数据库 url。
adk web``adk web --session_db_url=[db_url]Thank you very much