Skip to content

Commit bcc58c1

Browse files
committed
Minor fixes to Redis integration page
1 parent 485cee1 commit bcc58c1

1 file changed

Lines changed: 24 additions & 8 deletions

File tree

docs/integrations/redis.md

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@ catalog_icon: /integrations/assets/redis.png
55
catalog_tags: ["data","mcp"]
66
---
77

8-
# Redis for ADK
8+
# Redis integration for ADK
99

1010
<div class="language-support-tag">
1111
<span class="lst-supported">Supported in ADK</span><span class="lst-python">Python</span>
1212
</div>
1313

14-
[`adk-redis`](https://github.com/redis-developer/adk-redis) connects your ADK
15-
agent to [Redis](https://redis.io/), giving it RedisVL-backed search tools
14+
The [adk-redis integration](https://github.com/redis-developer/adk-redis)
15+
connects your ADK agent to [Redis](https://redis.io/), giving it
16+
RedisVL-backed search tools
1617
over a Redis index, persistent sessions and long-term memory via
1718
[Redis Agent Memory Server](https://github.com/redis/agent-memory-server),
1819
and semantic caching for LLM responses and tool results. Redis runs as a
@@ -101,6 +102,7 @@ pip install 'adk-redis[all]' # everything above
101102

102103
```python
103104
from google.adk.agents import Agent
105+
from google.adk.runners import Runner
104106

105107
from adk_redis import (
106108
RedisLongTermMemoryService,
@@ -127,7 +129,12 @@ pip install 'adk-redis[all]' # everything above
127129
instruction="Use long-term memory to personalize responses.",
128130
)
129131

130-
# Pass session_service and memory_service to your ADK Runner.
132+
runner = Runner(
133+
app_name="redis_memory_app",
134+
agent=root_agent,
135+
session_service=session_service,
136+
memory_service=memory_service,
137+
)
131138
```
132139

133140
=== "MCP toolset"
@@ -156,12 +163,15 @@ pip install 'adk-redis[all]' # everything above
156163
=== "Semantic cache"
157164

158165
```python
166+
from google.adk.agents import Agent
167+
from redisvl.utils.vectorize import HFTextVectorizer
168+
159169
from adk_redis import (
160170
LLMResponseCache,
161171
RedisVLCacheProvider,
162172
RedisVLCacheProviderConfig,
173+
create_llm_cache_callbacks,
163174
)
164-
from redisvl.utils.vectorize import HFTextVectorizer
165175

166176
provider = RedisVLCacheProvider(
167177
config=RedisVLCacheProviderConfig(
@@ -175,9 +185,15 @@ pip install 'adk-redis[all]' # everything above
175185
)
176186

177187
llm_cache = LLMResponseCache(provider=provider)
188+
before_model_cb, after_model_cb = create_llm_cache_callbacks(llm_cache)
178189

179-
# Register llm_cache.before_model_callback and llm_cache.after_model_callback
180-
# on your ADK agent to skip repeat LLM calls for semantically similar prompts.
190+
root_agent = Agent(
191+
model="gemini-flash-latest",
192+
name="cached_agent",
193+
instruction="You are a helpful assistant with semantic caching enabled.",
194+
before_model_callback=before_model_cb,
195+
after_model_callback=after_model_cb,
196+
)
181197
```
182198

183199
## Available tools
@@ -229,7 +245,7 @@ Provider | Description
229245
- [adk-redis on GitHub](https://github.com/redis-developer/adk-redis)
230246
- [adk-redis on PyPI](https://pypi.org/project/adk-redis/)
231247
- [adk-redis documentation](https://redis.io/docs/latest/integrate/google-adk/)
248+
- [Runnable examples](https://github.com/redis-developer/adk-redis/tree/main/examples)
232249
- [Redis Agent Memory Server](https://github.com/redis/agent-memory-server)
233250
- [RedisVL documentation](https://docs.redisvl.com)
234251
- [Redis LangCache](https://redis.io/langcache)
235-
- [Runnable examples](https://github.com/redis-developer/adk-redis/tree/main/examples)

0 commit comments

Comments
 (0)