Setting Session variables when testing it out through ADK Web
I built a custom root agent that would require setting some custom session variables when I run the entire application.
How do I set session variables when im using adk web ?
Im positive, i reviewed the entire docs but I couldnt find anything for this specifically
Currently all my agents are running with api_server command and I've built a custom streamlit UI (common to all agents), Where I can set the state before Creating the session and asking Questions.
would Love to have this feature with "ADK Web" Command. If there's a "Fallback" state when no state is initialized, especially when using "adk web", that would be awesome.
The ADK documentation doesn't mention anything about state initialization when using adk web. This is inconvenient, but it is possible to initialize it using the following method. You can try setting up an initial session using --session_db_url.
1. Create a session db with sqlite
adk web --session_db_url 'sqlite:///session.db'
2. Modify session.db. Session information is stored in the sessions table. Add the state value here.
[Table] sessions / [Field] state = {"your state": "state value"}
3. Always run it with the --session_db_url option like this
adk web --session_db_url 'sqlite:///session.db'
4. Go to http://localhost:8000/ and select the session id that saved the state in [Sessions].
5. In the [State] menu, you can see the state you saved.
Currently state is read only from adk web's perspective. We are aware of this and it's on the roadmap, stay tuned.
For cases where I create a Runner (to keep the session persistent, for example), is it not possible to debug with the ADK Web?
The ADK documentation doesn't mention anything about state initialization when using adk web. This is inconvenient, but it is possible to initialize it using the following method. You can try setting up an initial session using --session_db_url.
1. Create a session db with sqlite adk web --session_db_url 'sqlite:///session.db' 2. Modify session.db. Session information is stored in the sessions table. Add the state value here. [Table] sessions / [Field] state = {"your state": "state value"} 3. Always run it with the --session_db_url option like this adk web --session_db_url 'sqlite:///session.db' 4. Go to http://localhost:8000/ and select the session id that saved the state in [Sessions]. 5. In the [State] menu, you can see the state you saved.
This actually works, just tested, session_db_url is going to be deprecated, you can run adk web --session_service_uri 'sqlite:///session.db'. Its going to create a session.db in your local directory if it's not already there
SOLUTION
- Run (Creates a session.db in your local directory if it's not already there) adk web --session_service_uri 'sqlite:///session.db'
- Modify session.db.(Session information is stored in the sessions table. Add the state value here.) [Table] sessions / [Field] state = {"your state": "state value"}
- Always run it with the --session_service_uri option like this adk web --session_service_uri 'sqlite:///session.db'
- Go to http://localhost:8000/ and select the session id that saved the state in [Sessions].
- In the [State] menu, you can see the state you saved.
I am developing a new Datastore session component. How can I try out in ADK web?