From 61be38b429ea296276fd7977987df00c3f8e6d0e Mon Sep 17 00:00:00 2001 From: Nitin Kanukolanu Date: Tue, 19 May 2026 23:41:44 -0400 Subject: [PATCH] google-adk: bring docs to parity with adk-redis 0.0.5 adk-redis 0.0.5 shipped to PyPI today with several changes that the redis.io ADK docs were behind on. This brings the docs to parity. Drift fixed: - `_index.md`: AMS Docker command bumped from `gemini-2.0-flash` to `gemini-2.5-flash`. Added a Linux note for `host.docker.internal` (it does not resolve by default on Linux). Added the `pip install adk-redis[sql]` and `pip install redisvl[mcp]>=0.18.2` install lines. Capabilities table now mentions the SQL tool and the `rvl mcp` server, and the example count goes from seven to nine. - `search-tools.md`: page now describes FIVE search tools (the new `RedisSQLSearchTool` was missing). Added a SQL search section with a runnable snippet and the parameterized-query pattern. Added a "RedisVL MCP server" section showing ADK's native `McpToolset` wired to `rvl mcp` over stdio, following the maintainer guidance on `google/adk-docs#1777`. Bottom links now point at the two new examples (`redis_sql_search`, `redisvl_mcp_search`). - `redis-agent-memory.md`: working-memory `model_name` bumped from `gemini-2.0-flash` to `gemini-2.5-flash`. - `examples.md`: count bumped to nine; added `redis_sql_search` and `redisvl_mcp_search` entries. - `semantic-caching.md`: vectorizer model bumped from `redis/langcache-embed-v1` to `redis/langcache-embed-v2` (matches the runnable examples and the rest of adk-redis docs). Agent model bumped from `gemini-2.0-flash` to `gemini-2.5-flash`. What is intentionally NOT in this PR: - No mention of `create_redisvl_mcp_toolset(...)`. That helper was in the adk-redis main branch briefly but was removed before 0.0.5 shipped, per the catalog-page review feedback that pushed us toward using ADK's native `McpToolset` directly. The repo no longer ships it; the docs should not reference it. - No mention of the `[mcp-search]` extra. Same reason. Verified all five files pass a grep for stale references (`create_redisvl_mcp_toolset`, `mcp-search`, `gemini-2.0-flash`, `langcache-embed-v1`, "four search tools", "seven examples"). --- content/integrate/google-adk/_index.md | 17 +++- content/integrate/google-adk/examples.md | 22 ++++- .../google-adk/redis-agent-memory.md | 2 +- content/integrate/google-adk/search-tools.md | 83 ++++++++++++++++++- .../integrate/google-adk/semantic-caching.md | 4 +- 5 files changed, 116 insertions(+), 12 deletions(-) diff --git a/content/integrate/google-adk/_index.md b/content/integrate/google-adk/_index.md index fd5ba473b9..fe5bd1e57b 100644 --- a/content/integrate/google-adk/_index.md +++ b/content/integrate/google-adk/_index.md @@ -42,12 +42,17 @@ docker run -d --name redis -p 6379:6379 redis:8.4-alpine docker run -d --name agent-memory-server -p 8088:8088 \ -e REDIS_URL=redis://host.docker.internal:6379 \ -e GEMINI_API_KEY=your-key \ - -e GENERATION_MODEL=gemini/gemini-2.0-flash \ + -e GENERATION_MODEL=gemini/gemini-2.5-flash \ -e EMBEDDING_MODEL=gemini/text-embedding-004 \ redislabs/agent-memory-server:latest \ agent-memory api --host 0.0.0.0 --port 8088 --task-backend=asyncio ``` +On Linux, `host.docker.internal` does not resolve by default. Use +`--network=host` plus `REDIS_URL=redis://127.0.0.1:6379`, or point +`REDIS_URL` at the Docker bridge gateway (typically +`redis://172.17.0.1:6379`). + ## Installation ```bash @@ -57,11 +62,17 @@ pip install adk-redis[memory] # Search tools via RedisVL pip install adk-redis[search] +# SQL-style search tool (sql-redis) +pip install adk-redis[sql] + # Managed semantic caching via LangCache pip install adk-redis[langcache] # Everything pip install adk-redis[all] + +# For the RedisVL MCP server (used with ADK's native McpToolset) +pip install 'redisvl[mcp]>=0.18.2' ``` ## Quick start @@ -118,9 +129,9 @@ runner = Runner( |------------|-------------|------| | **Redis Agent Memory** | Working and long-term memory via framework services, REST tools, or MCP | [Redis Agent Memory]({{< relref "/integrate/google-adk/redis-agent-memory" >}}) | | **Integration patterns** | Framework-managed, LLM-controlled REST, and MCP tools | [Integration patterns]({{< relref "/integrate/google-adk/integration-patterns" >}}) | -| **Search tools** | Vector, hybrid, text, and range search via RedisVL | [Search tools]({{< relref "/integrate/google-adk/search-tools" >}}) | +| **Search tools** | Vector, hybrid, text, range, and SQL search via RedisVL, plus the `rvl mcp` server over `McpToolset` | [Search tools]({{< relref "/integrate/google-adk/search-tools" >}}) | | **Semantic caching** | LLM response and tool result caching | [Semantic caching]({{< relref "/integrate/google-adk/semantic-caching" >}}) | -| **Examples** | Seven complete examples covering all capabilities | [Examples]({{< relref "/integrate/google-adk/examples" >}}) | +| **Examples** | Nine complete examples covering all capabilities | [Examples]({{< relref "/integrate/google-adk/examples" >}}) | ## More info diff --git a/content/integrate/google-adk/examples.md b/content/integrate/google-adk/examples.md index ba4f9929d1..64b40239aa 100644 --- a/content/integrate/google-adk/examples.md +++ b/content/integrate/google-adk/examples.md @@ -11,13 +11,13 @@ categories: description: Complete examples for every adk-redis capability. group: ai stack: true -summary: Seven runnable examples covering Redis Agent Memory, search tools, semantic +summary: Nine runnable examples covering Redis Agent Memory, search tools, semantic caching, and MCP integration. type: integration weight: 5 --- -The [adk-redis repository](https://github.com/redis-developer/adk-redis/tree/main/examples) includes seven complete examples. Each focuses on a specific capability. +The [adk-redis repository](https://github.com/redis-developer/adk-redis/tree/main/examples) includes nine complete examples. Each focuses on a specific capability. ## Prerequisites @@ -64,10 +64,26 @@ Demonstrates MCP-based memory integration. The agent connects to the Agent Memor **Capability:** Vector, hybrid, text, and range search -All four RedisVL [search tools]({{< relref "/integrate/google-adk/search-tools" >}}) plugged into a single agent with a product catalog dataset. +Four in-process RedisVL [search tools]({{< relref "/integrate/google-adk/search-tools" >}}) plugged into a single agent with a product catalog dataset. [View on GitHub](https://github.com/redis-developer/adk-redis/tree/main/examples/redis_search_tools) +## `redis_sql_search` + +**Capability:** SQL `SELECT` search + +A 10-product catalog with the `RedisSQLSearchTool`. The agent emits parameterized SQL (`WHERE category = 'electronics' AND price < :max_price`) to answer structured catalog questions. Requires `pip install 'adk-redis[sql]'`. + +[View on GitHub](https://github.com/redis-developer/adk-redis/tree/main/examples/redis_sql_search) + +## `redisvl_mcp_search` + +**Capability:** RedisVL MCP server via ADK's `McpToolset` + +The MCP counterpart of `redis_search_tools`. A `rvl mcp` server hosts a knowledge-base index in hybrid (vector + BM25) mode and the agent connects via ADK's native `McpToolset`. No adk-redis wrapper involved; the standard `McpToolset` + `StdioConnectionParams` pattern is used. + +[View on GitHub](https://github.com/redis-developer/adk-redis/tree/main/examples/redisvl_mcp_search) + ## `semantic_cache` **Capability:** Local semantic caching (RedisVL) diff --git a/content/integrate/google-adk/redis-agent-memory.md b/content/integrate/google-adk/redis-agent-memory.md index 1c79573500..c55ac939ad 100644 --- a/content/integrate/google-adk/redis-agent-memory.md +++ b/content/integrate/google-adk/redis-agent-memory.md @@ -45,7 +45,7 @@ session_service = RedisWorkingMemorySessionService( config=RedisWorkingMemorySessionServiceConfig( api_base_url="http://localhost:8088", default_namespace="my_app", - model_name="gemini-2.0-flash", + model_name="gemini-2.5-flash", context_window_max=8000, ) ) diff --git a/content/integrate/google-adk/search-tools.md b/content/integrate/google-adk/search-tools.md index cd620f0ba0..f10ef77d33 100644 --- a/content/integrate/google-adk/search-tools.md +++ b/content/integrate/google-adk/search-tools.md @@ -8,7 +8,7 @@ categories: - oss - rs - rc -description: Vector, hybrid, text, and range search tools for Google ADK agents. +description: Vector, hybrid, text, range, and SQL search tools for Google ADK agents, plus the RedisVL MCP server. group: ai stack: true summary: Add retrieval-augmented generation (RAG) to ADK agents using RedisVL-powered @@ -17,7 +17,7 @@ type: integration weight: 3 --- -adk-redis provides four search tools that wrap [RedisVL]({{< relref "/develop/ai/redisvl" >}}) query types into ADK-compatible tools. The LLM sees each tool as a callable function with a `query` parameter and gets back structured results. +adk-redis provides five in-process search tools that wrap [RedisVL]({{< relref "/develop/ai/redisvl" >}}) query types into ADK-compatible tools. The LLM sees each tool as a callable function and gets back structured results. For multi-agent or polyglot deployments, the same RedisVL index can also be served over MCP via the `rvl mcp` server and consumed with ADK's native `McpToolset` (see the [RedisVL MCP server](#redisvl-mcp-server) section below). ## Overview @@ -27,6 +27,7 @@ adk-redis provides four search tools that wrap [RedisVL]({{< relref "/develop/ai | `RedisHybridSearchTool` | Vector + BM25 | Queries with specific terms + concepts | | `RedisTextSearchTool` | BM25 keyword | Exact terms, error messages, IDs | | `RedisRangeSearchTool` | Distance threshold | Exhaustive retrieval within a radius | +| `RedisSQLSearchTool` | SQL `SELECT` | Structured filters (`WHERE`, `BETWEEN`, parameterized) | ## Vector search @@ -106,6 +107,80 @@ range_tool = RedisRangeSearchTool( ) ``` +## SQL search + +`RedisSQLSearchTool` wraps `redisvl.query.SQLQuery`. The LLM emits a SQL `SELECT` statement (with optional `:name` parameter placeholders) and the tool translates it into the right `FT.SEARCH` or `FT.AGGREGATE` call. Best for structured filters: tag equality, numeric ranges, multi-predicate `WHERE` clauses. Requires `pip install 'adk-redis[sql]'`. + +```python +from adk_redis import RedisSQLSearchTool + +sql_tool = RedisSQLSearchTool( + index=index, + name="catalog_sql_search", + description=( + "Run a SQL SELECT against the product catalog. " + "Use :name placeholders for values." + ), +) +``` + +The LLM might emit a call like: + +```sql +SELECT title, brand, price +FROM products +WHERE category = 'electronics' AND price < :max_price +``` + +with `params={"max_price": 100}`. See the [redis_sql_search example](https://github.com/redis-developer/adk-redis/tree/main/examples/redis_sql_search) for a runnable demo. + +## RedisVL MCP server + +The five tools above run in-process against a Python `SearchIndex`. To serve one Redis index to multiple agents (Python, JS, Claude Desktop), or to put server-side guardrails like `--read-only` and bearer auth between the agent and the index, run RedisVL's MCP server (`rvl mcp`) and connect ADK's native `McpToolset` to it. + +```python +from google.adk import Agent +from google.adk.tools.mcp_tool import McpToolset +from google.adk.tools.mcp_tool.mcp_session_manager import StdioConnectionParams +from mcp import StdioServerParameters + +agent = Agent( + model="gemini-2.5-flash", + name="redis_mcp_agent", + instruction="Use the search-records tool to answer questions.", + tools=[ + McpToolset( + connection_params=StdioConnectionParams( + server_params=StdioServerParameters( + command="rvl", + args=[ + "mcp", + "--config", + "/path/to/mcp_config.yaml", + "--read-only", + ], + ), + timeout=30, + ), + tool_filter=["search-records"], + ), + ], +) +``` + +The server is configured per index via a YAML file and exposes two tools: `search-records` (vector / fulltext / hybrid, chosen at server start, with schema-aware filter and return-field hints) and `upsert-records` (suppress with `--read-only`). Supports `stdio`, `sse`, and `streamable-http` transports; bearer auth on HTTP. + +Install the CLI with `pip install 'redisvl[mcp]>=0.18.2'`. For a runnable demo, see the [redisvl_mcp_search example](https://github.com/redis-developer/adk-redis/tree/main/examples/redisvl_mcp_search). + +### When to choose in-process vs MCP + +| Path | Use when | +|------|----------| +| In-process tools (above) | Single Python agent, fast onboarding, complex Python-side `FilterExpression` composition. | +| MCP server | Multi-agent or polyglot deployments, server-side ops gates, schema-aware tool descriptions. | + +Range and SQL search have no MCP equivalent today; use the in-process tools for either. + ## Multi-tool agent Wire multiple search tools into a single agent and let the LLM choose the right one: @@ -129,5 +204,7 @@ The `name` and `description` on each tool matter: the LLM reads them to decide w ## More info -- [redis_search_tools example](https://github.com/redis-developer/adk-redis/tree/main/examples/redis_search_tools): All four search tools with a product catalog +- [redis_search_tools example](https://github.com/redis-developer/adk-redis/tree/main/examples/redis_search_tools): vector, text, and range tools with a product catalog +- [redis_sql_search example](https://github.com/redis-developer/adk-redis/tree/main/examples/redis_sql_search): SQL `SELECT` against a bound index +- [redisvl_mcp_search example](https://github.com/redis-developer/adk-redis/tree/main/examples/redisvl_mcp_search): same corpus served via `rvl mcp` + ADK `McpToolset` - [RedisVL documentation]({{< relref "/develop/ai/redisvl" >}}) diff --git a/content/integrate/google-adk/semantic-caching.md b/content/integrate/google-adk/semantic-caching.md index ee5ee31d3a..b1e841898a 100644 --- a/content/integrate/google-adk/semantic-caching.md +++ b/content/integrate/google-adk/semantic-caching.md @@ -45,7 +45,7 @@ provider = RedisVLCacheProvider( ttl=3600, distance_threshold=0.1, ), - vectorizer=HFTextVectorizer(model="redis/langcache-embed-v1"), + vectorizer=HFTextVectorizer(model="redis/langcache-embed-v2"), ) ``` @@ -89,7 +89,7 @@ before_cb, after_cb = create_llm_cache_callbacks(llm_cache) agent = Agent( name="cached_agent", - model="gemini-2.0-flash", + model="gemini-2.5-flash", instruction="You are a helpful assistant.", before_model_callback=before_cb, after_model_callback=after_cb,