--- title: "Oracle Agent Memory" description: "Define an agent once in Oracle Agent Spec, run it on LangGraph over AG-UI, give it long-term memory on Oracle AI Database, and render it in CopilotKit with human-in-the-loop." icon: "custom/oracle-agent-spec" showIcon: true doc_type: how-to --- [Oracle Agent Spec](https://github.com/oracle/agent-spec) is an open, framework-agnostic way to describe an agent as portable JSON — define it once, run it on any supported runtime. This recipe wires three things together: an Agent Spec agent running on **LangGraph**, served over the open [AG-UI](https://docs.ag-ui.com/) protocol, rendered in a [CopilotKit](https://www.copilotkit.ai/) chat, with **long-term memory** on Oracle AI Database so it remembers you across sessions. The example is a personal **travel concierge**: it remembers your preferences across sessions, searches flights, and books them with a **human-in-the-loop** confirmation card rendered by CopilotKit's generative UI. ## How it works - The agent is defined declaratively with `pyagentspec` and serialized to Agent Spec JSON. - The [`ag_ui_agentspec`](https://github.com/ag-ui-protocol/ag-ui) adapter loads that JSON and serves it as a FastAPI AG-UI endpoint on the LangGraph runtime. - CopilotKit consumes the AG-UI endpoint with an `HttpAgent` — the same protocol as any AG-UI agent. - Memory is the glue: a `recall_memory` tool reads durable preferences from Oracle Agent Memory, and each turn is persisted after the response streams — then a small reconcile pass supersedes outdated facts so an updated preference wins next time. ```text CopilotKit (Next.js, V2) ──/api/copilotkit──▶ CopilotRuntime (HttpAgent) │ AG-UI (SSE) ▼ Agent Spec JSON → ag_ui_agentspec (LangGraph) recall_memory · search_flights · book_flight (HITL ClientTool) │ recall + persist ▼ oracleagentmemory → Oracle AI Database ``` ## Memory: what's CopilotKit, what's Oracle Memory ownership across the stack: CopilotKit owns the chat UI and threads, the AG-UI transport, and the generative UI; your agent code is the seam — Agent Spec on LangGraph, the recall_memory tool, and persist + reconcile; Oracle Agent Memory owns the Oracle AI Database, fact extraction, and vector recall. Oracle does the remembering, CopilotKit does the conversing, and your agent code is the seam between them. CopilotKit never touches the database — to it, `recall_memory` is just a tool that returns text — and Oracle never sees the chat protocol. Swap Oracle for another store and the frontend doesn't change a line. ## Try it live Talk to the concierge below. Tell it a travel preference, then open a **new thread** with **"+ New thread"** and ask about your preferences again — it recalls what you told it from memory persisted in Oracle AI Database, not from the current conversation.