Hi Gemini team,
I’m building a conversational app using the Gemini API and wanted to ask about the recommended way to inject dynamic contextual information that is not part of the conversation itself.
Examples of this context:
-
User profile information (e.g. name, preferences)
-
App or session state
-
Other dynamic data that can change over time and should be treated as current facts, not chat history
This context:
-
Needs to be provided on every prompt
-
Can change between turns
-
Should help the model reason correctly during the conversation
-
Should not be treated as conversational dialogue
I’m currently integrating Gemini via Flutter / Firebase AI, but this question is API-level and applies regardless of client SDK.
At the moment, the API supports systemInstruction and a list of Content, but there doesn’t seem to be a documented, first-class way to provide dynamic, non-conversational state.
Using systemInstruction doesn’t feel ideal since this data changes frequently, and injecting it as regular Content means it’s treated conversationally unless carefully labeled.
Questions:
-
Is there an official or recommended pattern for injecting dynamic, non-conversational context (e.g. “current state”) into Gemini prompts?
-
Is using labeled sections inside
Contentthe intended approach today? -
Are there any best practices for keeping this context authoritative without polluting conversation history?
Any guidance would be appreciated — this seems like a common requirement for stateful or agent-style applications.
Thanks!