{
  "id": 5997733,
  "title": "Your Google ADK Agent Has Four Places to Put Context. Choose Carefully.",
  "url": "https://urgent.news/2026/09/06/your-google-adk-agent-has-four-places-to-put-context-choose-carefully",
  "topic": "ai",
  "section": "AI",
  "published": "2026-09-06T16:07:57.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/raju_dandigam/your-google-adk-agent-has-four-places-to-put-context-choose-carefully-5c9i"
  },
  "original_language": "en",
  "account": "Google's Agent Development Kit (ADK) provides four distinct storage options for context in TypeScript applications: session events, session state, long-term memory, and artifacts. While these options offer flexibility, deciding where to store information is crucial for the agent's performance and reliability. A single context bucket can create several bugs that impact the agent's functionality.\n\nImagine a travel agent assisting a user in comparing hotels. After receiving the user's preference for quiet rooms, the agent generates a spreadsheet with 40 hotel options. If the agent later resumes the conversation for a different trip, issues may arise due to the agent's inability to distinguish between relevant and irrelevant data. A bug could be that the agent repeats the 40 raw hotel results in the next conversation, or the agent fails to delete stale data, leading to budgeting difficulties for the new trip. Another bug could be that the agent permanently stores the preference to \"prefer quiet rooms,\" which should ideally be a temporary constraint shared across sessions.\n\nTo avoid such issues, ADK offers four storage options:\n\n1. Session Events: These represent one conversation thread and provide a chronological record of user messages, agent responses, tool activity, state changes, and errors. Session events are ideal for storing information that is relevant to the current conversation, such as the user's hotel preferences.\n\n2. Session State: This holds dynamic values that the agent needs while working on a task. State can be updated using a context object and has different lifetimes. For example, a temporary value like the number of hotels fetched could be scoped as temp:hotel_count, while a shared user preference like \"prefer quiet rooms\" could be stored with no prefix, making it accessible across sessions.\n\n3. Long-Term Memory: This service allows the agent to search for useful knowledge that may come from earlier sessions or external sources. Long-term memory is useful for storing preferences that should be available across multiple conversations, such as \"usually prefers hotels near public transit.\" However, policies must be in place to determine what knowledge is eligible for retrieval, how retrieval is scoped, and when facts expire.\n\n4. Artifacts: These are binary files such as generated reports, images, or PDFs. Unlike chat messages, artifacts have a lifecycle and can be accessed by the agent across sessions. For example, a hotel comparison report could be stored as hotel-comparison.csv version 2, with version control ensuring cleaner data management.\n\nThe Gemini Interactions API allows for continuity by passing a previous_interaction_id, but this feature does not decide where data should be stored or how long it should be retained. The responsibility of determining context storage and retention policies still lies with the agent developer.",
  "summary": "The first version of an agent usually has one place for context: the prompt. The user request goes in. Conversation history goes in. Tool results, preferences, account details, retrieved documents, and generated files follow. The agent appears to “remember” because every useful fact is repeatedly placed in front of the model. That design works until the context becomes expensive, stale, difficult…",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}