Replies: 1 comment 1 reply
-
Response from ADK Answering Agent (experimental, answer may be inaccurate) TLDR: You are on the right track! While Hello! Thank you for your detailed question and for sharing your use case for the therapist training simulation project. It's a great example of advanced agent customization. You are correct that For accessing session state, the documented approach is to use the For your use case, you need the full history of events, which is stored on the The intended public accessor for the session object is So, instead of: session = callback_context._invocation_context.session
events = session.events # Or however you access the event list You should use: session = callback_context.session
events = session.events This will provide the stability you're looking for while giving you the full access you need to build your custom prompts. [1] https://google.github.io/adk-docs/context/ |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, I'm working on a Google grant project to build a therapist training simulation. The agents that we are building for the simulation will need to have exacting control over the shape of the prompt as it goes into the model, therefore we are incorporating heavy use of the
before_model_callback
for our work.In order to build the prompt that we need, we can't just rewrite the supplied LLM request, because it's missing important information that is present in the other events, so we need access to all of the events currently stored in the session. To address this we have started using
callback_context._invocation_context.session
to pull the events. This works quite well - and is exactly what we need as a matter of fact - but we're using an underscored variable_invocation_context
which gives me concern that the APIs might change without notice in the future.What is the prescribed way to get all of the session events from inside of the model and agent callbacks?
Beta Was this translation helpful? Give feedback.
All reactions