{
  "schema_version": 2,
  "id": "integrate/google-adk/integration-patterns",
  "title": "Memory integration patterns",
  "url": "https://redis.io/docs/latest/integrate/google-adk/integration-patterns/",
  "summary": "Approaches for connecting Google ADK agents to Redis memory.",
  "tags": [
    "docs",
    "integrate",
    "oss",
    "rs",
    "rc"
  ],
  "last_updated": "2026-09-17T14:55:03+01:00",
  "page_type": "content",
  "content_hash": "41f7269f1d4d7def191508d580d36c8e0704af46ae1712ca95e9193bc71e46bf",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "adk-redis offers two approaches for connecting agents to memory. Each has different tradeoffs around control and complexity."
    },
    {
      "id": "comparison",
      "title": "Comparison",
      "role": "content",
      "text": "| Approach | Control | Complexity | Protocol | Best for |\n|----------|---------|-----------|----------|----------|\n| **ADK services** | Framework | Low | HTTP | Invisible infrastructure |\n| **REST tools** | LLM | Medium | HTTP | Explicit memory management |\n\nBoth use `backend=\"redis-agent-memory\"`, the default, on Redis Cloud or\nself-managed. See\n[Redis Agent Memory](https://redis.io/docs/latest/integrate/google-adk/redis-agent-memory#choose-a-deployment)\nfor the deployment options.\n\n> [!NOTE]\n> A third approach, MCP memory tools, is only available on the deprecated\n> [Agent Memory Server](https://redis.io/docs/latest/integrate/google-adk/agent-memory-server)\n> backend."
    },
    {
      "id": "1-adk-services-framework-managed",
      "title": "1. ADK services (framework-managed)",
      "role": "content",
      "text": "Configure `RedisSessionMemoryService` and `RedisLongTermMemoryService`, pass them to the `Runner`, and the framework handles everything automatically. Memory extraction happens in the background. Search happens before each agent turn. The agent code never directly interacts with memory.\n\n[code example]\n\n**Tradeoffs:** Simplest to implement, hardest to customize. The agent has no explicit control over what gets stored or when it searches."
    },
    {
      "id": "2-rest-tools-llm-controlled",
      "title": "2. REST tools (LLM-controlled)",
      "role": "content",
      "text": "Give the agent explicit memory tools that the LLM calls like any other function. The LLM decides when to search memory, what to store, and what to update.\n\n[code example]\n\n**Tradeoffs:** Requires prompt engineering to teach the LLM memory management strategy, but gives the agent genuine autonomy over its own memory."
    },
    {
      "id": "hybrid-approach",
      "title": "Hybrid approach",
      "role": "content",
      "text": "The most powerful configuration combines framework services with REST tools. Framework services handle session persistence and automatic background extraction. REST tools give the LLM explicit CRUD control on top.\n\n[code example]\n\nThe pattern works on `redis-agent-memory`. The\nexample that demonstrates it,\n[travel_agent_memory_hybrid](https://github.com/redis-developer/adk-redis/tree/main/examples/travel_agent_memory_hybrid),\nis currently written against the deprecated backend; see\n[Agent Memory Server (deprecated)](https://redis.io/docs/latest/integrate/google-adk/agent-memory-server#examples-still-on-this-backend)."
    },
    {
      "id": "more-info",
      "title": "More info",
      "role": "content",
      "text": "- [managed_memory_quickstart](https://github.com/redis-developer/adk-redis/tree/main/examples/managed_memory_quickstart): Framework services on Redis Agent Memory\n- [travel_agent_memory_tools](https://github.com/redis-developer/adk-redis/tree/main/examples/travel_agent_memory_tools): REST tools only\n- [Agent Memory Server (deprecated)](https://redis.io/docs/latest/integrate/google-adk/agent-memory-server): MCP tools and other deprecated-backend patterns\n- [Car dealership tutorial](https://redis.io/tutorials/build-a-car-dealership-agent-with-google-adk-and-redis-agent-memory/)"
    }
  ],
  "examples": [
    {
      "id": "1-adk-services-framework-managed-ex0",
      "language": "python",
      "code": "from google.adk.runners import Runner\nfrom adk_redis.sessions import (\n    RedisSessionMemoryService,\n    RedisSessionMemoryServiceConfig,\n)\nfrom adk_redis.memory import (\n    RedisLongTermMemoryService,\n    RedisLongTermMemoryServiceConfig,\n)\n\nrunner = Runner(\n    agent=agent,\n    app_name=\"my_app\",\n    session_service=RedisSessionMemoryService(\n        config=RedisSessionMemoryServiceConfig(\n            backend=\"redis-agent-memory\",\n            api_base_url=\"https://your-endpoint.redis.io\",\n            api_key=\"your-api-key\",\n            store_id=\"your-store-id\",\n            default_namespace=\"my_app\",\n        )\n    ),\n    memory_service=RedisLongTermMemoryService(\n        config=RedisLongTermMemoryServiceConfig(\n            backend=\"redis-agent-memory\",\n            api_base_url=\"https://your-endpoint.redis.io\",\n            api_key=\"your-api-key\",\n            store_id=\"your-store-id\",\n            default_namespace=\"my_app\",\n        )\n    ),\n)",
      "section_id": "1-adk-services-framework-managed"
    },
    {
      "id": "2-rest-tools-llm-controlled-ex0",
      "language": "python",
      "code": "from adk_redis.tools.memory import (\n    SearchMemoryTool,\n    CreateMemoryTool,\n    UpdateMemoryTool,\n    DeleteMemoryTool,\n    MemoryToolConfig,\n)\n\nconfig = MemoryToolConfig(\n    backend=\"redis-agent-memory\",\n    api_base_url=\"https://your-endpoint.redis.io\",\n    api_key=\"your-api-key\",\n    store_id=\"your-store-id\",\n    default_namespace=\"my_app\",\n)\n\nagent = Agent(\n    model=\"gemini-2.5-flash\",\n    name=\"memory_agent\",\n    tools=[\n        SearchMemoryTool(config=config),\n        CreateMemoryTool(config=config),\n        UpdateMemoryTool(config=config),\n        DeleteMemoryTool(config=config),\n    ],\n)",
      "section_id": "2-rest-tools-llm-controlled"
    },
    {
      "id": "hybrid-approach-ex0",
      "language": "python",
      "code": "# LLM-controlled tools on the Agent\nagent = Agent(\n    model=\"gemini-2.5-flash\",\n    name=\"hybrid_agent\",\n    tools=[\n        SearchMemoryTool(config=config),\n        CreateMemoryTool(config=config),\n        UpdateMemoryTool(config=config),\n        DeleteMemoryTool(config=config),\n    ],\n)\n\n# Framework-managed services on the Runner\nrunner = Runner(\n    agent=agent,\n    app_name=\"my_app\",\n    session_service=session_service,   # Auto session management\n    memory_service=memory_service,     # Auto memory search\n)",
      "section_id": "hybrid-approach"
    }
  ]
}
