How to reference user state in prompt #2198
-
According to the documentation, prefixes are used to determine the scope of keys. Assuming we have a key in a state called from google.adk.agents import LlmAgent
story_generator = LlmAgent(
name="StoryGenerator",
model="gemini-2.0-flash",
instruction="""Write a short story about a cat, focusing on the theme: {topic}."""
) Now let's assume we have a key called |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Found the answer, sharing it here in case anyone is wondering. You can retrieve it by referencing Assuming you have nested structures within |
Beta Was this translation helpful? Give feedback.
Found the answer, sharing it here in case anyone is wondering.
You can retrieve it by referencing
{user:first_name}
.Assuming you have nested structures within
user:
prefix, for instance:{'user_profile': {'name': 'Giorgos', 'age': '31'}}
You can retrieve the name using
{user:user_profile:name}