PROMPT CANVAS CANVAS
# Role & Context
You are a Principal AI Architect specializing in OpenAI Agents and Enterprise Vector Databases (specifically Oracle Database 23ai). Your task is to design and implement a Long-Term Memory module that allows an AI Agent to persistently store and retrieve conversational context across multiple sessions.

# Input Data
- Agent Persona/Goal: {{agent_persona}}
- Memory Schema/Focus: {{memory_schema}}

## Step-by-Step Instructions
1. Analyze the `agent_persona` to understand what kind of information is critical for this agent to remember long-term.
2. Review the `memory_schema` to determine the specific entities or conversational artifacts that must be vectorized and stored.
3. Within a dedicated thinking block, outline the architecture for the memory loop: 
   - How incoming messages are summarized or evaluated for memory retention.
   - How the text is embedded using OpenAI's embedding models.
   - How the embeddings are stored in Oracle 23ai.
   - How semantic search is performed prior to the agent generating a response.
4. Output the technical blueprint, including the necessary Python code to connect to Oracle 23ai, generate embeddings, and execute the vector search.

## Constraints
- The database queries must utilize Oracle 23ai's native `VECTOR` data type and vector search syntax (e.g., `VECTOR_DISTANCE`).
- The code must be production-ready, including error handling for database connection failures.
- Emphasize efficient token usage; the retrieval mechanism should only pull the top-K most relevant memories.

Role & Context

You are a Principal AI Architect specializing in OpenAI Agents and Enterprise Vector Databases (specifically Oracle Database 23ai). Your task is to design and implement a Long-Term Memory module that allows an AI Agent to persistently store and retrieve conversational context across multiple sessions.

Input Data

  • Agent Persona/Goal: {{agent_persona}}
  • Memory Schema/Focus: {{memory_schema}}

Step-by-Step Instructions

  1. Analyze the agent_persona to understand what kind of information is critical for this agent to remember long-term.
  2. Review the memory_schema to determine the specific entities or conversational artifacts that must be vectorized and stored.
  3. Within a dedicated thinking block, outline the architecture for the memory loop:
    • How incoming messages are summarized or evaluated for memory retention.
    • How the text is embedded using OpenAI's embedding models.
    • How the embeddings are stored in Oracle 23ai.
    • How semantic search is performed prior to the agent generating a response.
  4. Output the technical blueprint, including the necessary Python code to connect to Oracle 23ai, generate embeddings, and execute the vector search.

Constraints

  • The database queries must utilize Oracle 23ai's native VECTOR data type and vector search syntax (e.g., VECTOR_DISTANCE).
  • The code must be production-ready, including error handling for database connection failures.
  • Emphasize efficient token usage; the retrieval mechanism should only pull the top-K most relevant memories.

Enabling Long-Term Agent Memory with Oracle AI Agent Memory

Coding 2026-08-08T00:00:00Z
đŸ‘ī¸ 0

Key Capabilities

  • Persistent Context Retention: Construct agents that remember past user interactions indefinitely by mapping conversation history to Oracle 23ai Vector Database.
  • Optimized Retrieval-Augmented Generation (RAG): Standardize your memory retrieval pipeline to dynamically inject relevant historical context into the prompt, reducing token overhead while maintaining deep personalization.
  • Enterprise-Grade Data Management: Leverage Oracle's robust database architecture for secure, scalable, and highly available agent memory storage.

Underlying Mechanism

This prompt utilizes a Markdown-structured Chain of Thought (CoT) to guide the LLM in designing a specialized memory management module. It explicitly constraints the architecture to use OpenAI's Embeddings API alongside Oracle 23ai Vector Search, ensuring the resulting code handles semantic memory retrieval accurately rather than relying on naive keyword matching or volatile in-memory storage.

Ideal Use Cases

  • Building personalized AI assistants that need to remember user preferences over long periods.
  • Developing enterprise-grade customer support bots that can recall past ticket histories.
  • Creating "Deep Research" agents that aggregate knowledge across multiple, disparate research sessions.

When NOT to Use (Anti-Patterns)

  • For stateless, single-turn query applications where historical context is irrelevant.
  • If you do not have access to an Oracle Database 23ai environment or a similar vector-capable persistent store.

Pro Tip

When defining the {{memory_schema}}, be specific about what attributes of the conversation are most valuable to retain (e.g., "User Preferences", "Factual Statements", "Completed Tasks") so the agent learns to prioritize indexing those specific entities.

Source Reference: Enabling Long-Term Agent Memory with Oracle AI Agent Memory

📋 How to Use This Prompt

1

Copy or Save to Vault

Click Copy Prompt for quick access, or hit the ⭐ star button to save to your Vault to edit templates, customize values, and auto-fill variables.

2

Fill in Variables

Replace double-bracket placeholders {{variable}} with your own values, context, or specific inputs.

3

Run in AI Model

Paste directly into ChatGPT, Claude, DeepSeek, or Gemini for structured, high-accuracy outputs.