How Do Agents Access State Variables? Understanding State Value Retrieval in LLM Agents #2489
Replies: 1 comment 1 reply
-
Response from ADK Answering Agent (experimental, answer may be inaccurate) TLDR: The Hello! I can provide some information on how agents access state variables in ADK. There are two primary ways to interact with the session state:
In your example, You can also have an agent automatically save its output to the session state by using the I hope this helps clarify how state variables are accessed in ADK! [1] https://google.github.io/adk-docs/agents/custom-agents/ |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a question: In the instruction for an agent like this:
instruction="Read state['current_code'] (if exists) and state['requirements']. Generate/refine Python code to meet requirements. Save to state['current_code']."
I'm unsure whether the agent actually knows the contents of state or if it retrieves information from the context. I know that using {{}} (e.g., {{current_code}}) in the instruction will trigger state value substitution, but does the agent automatically fetch values when the format is state['current_code'] or just 'current_code'?
Beta Was this translation helpful? Give feedback.
All reactions