Back to Prompt Library
implementation

Integrate Zep for Persistent Agent Memory

Inspect the original prompt language first, then copy or adapt it once you know how it fits your workflow.

Linked challenge: Google ADK Multi-Model Inference Routing with DeepSeek R1 for Cerebras/Trainium Optimization

Format
Code-aware
Lines
6
Sections
1
Linked challenge
Google ADK Multi-Model Inference Routing with DeepSeek R1 for Cerebras/Trainium Optimization

Prompt source

Original prompt text with formatting preserved for inspection.

6 lines
1 sections
No variables
1 code block
Enhance your Google ADK agent with persistent memory using Zep. Configure Zep to store agent conversation history, past routing decisions, and user preferences. The agent should consult its Zep memory when making new routing decisions, learning from previous interactions to optimize performance and cost over time. Provide the Python code for initializing Zep and integrating it into an agent's context retrieval process. ```python
from zep_python import ZepClient
from zep_python.memory import Memory # Initialize Zep client
zep_client = ZepClient("http://localhost:8000") # Replace with your Zep server URL # Example of integrating Zep memory into an agent function
def agent_with_memory(prompt: str, user_id: str) -> str: session_id = f"user-{user_id}" # Retrieve memory for the session memory = zep_client.get_memory(session_id) # Use memory for context in routing decisions # For instance, if user prefers 'fast' over 'cheap' based on past interactions # After decision, add current interaction to memory # zep_client.add_messages(session_id, [{'role': 'human', 'content': prompt}, {'role': 'ai', 'content': 'response'}]) return "Decision based on memory and current prompt"
```

Adaptation plan

Keep the source stable, then change the prompt in a predictable order so the next run is easier to evaluate.

Keep stable

Hold the task contract and output shape stable so generated implementations remain comparable.

Tune next

Update libraries, interfaces, and environment assumptions to match the stack you actually run.

Verify after

Test failure handling, edge cases, and any code paths that depend on hidden context or secrets.