Skip to content

feat(examples): add oracle-agent-memory showcase - #5563

Merged
jerelvelarde merged 9 commits into
CopilotKit:mainfrom
jerelvelarde:showcase/oracle-agent-memory
Jun 30, 2026
Merged

jerelvelarde merged 9 commits into
CopilotKit:mainfrom
jerelvelarde:showcase/oracle-agent-memory

Conversation

@jerelvelarde

@jerelvelarde jerelvelarde commented Jun 18, 2026 •

Copy link
Copy Markdown
Contributor

Runnable companion to the #5521 cookbook recipe — a portable Oracle Agent Spec agent on LangGraph over AG-UI, long-term memory on Oracle AI Database, and a CopilotKit V2 frontend (generative UI + HITL booking). Lives beside daytona-runcode.

  • agent/ — Python (uv) Agent Spec agent + FastAPI AG-UI server
  • frontend/ — Next.js CopilotKit V2 chat (flight cards, recall chip, HITL booking)
  • db/ — Oracle AI Database (Free image) + cookbook-user init
  • docker-compose.yml (local Oracle) + per-service railway.json

✅ Live cross-session recall verified working on the hosted demo (a preference taught in one thread is recalled in a fresh thread).

Pre-merge follow-ups — resolved ✅

  • Workspace deps — the frontend builds standalone (npm ci + next build ✓ inside the monorepo). It ships its own package-lock.json and is intentionally excluded from the pnpm workspace (the daytona-runcode / shell-dashboard convention), so the published prerelease @copilotkit/* resolve and no workspace:*/catalog: is needed.
  • Promote SSOT — the live demo is hosted independently (not part of CopilotKit's Railway promote fleet), so no showcase/scripts/railway-envs.ts entry is required.
  • db/build-and-push.sh — default image namespace genericized to an OWNER placeholder (still IMAGE-overridable).
  • Oracle license — db/Dockerfile and build-and-push.sh both document that the built image must stay in a PRIVATE registry (re-publishing the Oracle base image violates the license).

The Vercel preview deploys and fork-pr-monitor fail because this is a cross-fork PR (forks can't access deploy secrets) — not code issues. config-allowlist is fixed.

Docs: #5521.

Runnable companion to the "Build an Agentic Travel App with Oracle Agent
Memory, Agent Spec, and CopilotKit" cookbook recipe: a portable Oracle Agent
Spec agent on LangGraph over AG-UI, long-term memory on Oracle AI Database,
and a CopilotKit V2 frontend with generative UI + human-in-the-loop.

- agent/    Python (uv) Agent Spec agent + FastAPI AG-UI server
- frontend/ Next.js CopilotKit V2 chat (flight cards, recall chip, HITL booking)
- db/       Oracle AI Database (Free image) + cookbook-user init
- docker-compose.yml for local Oracle; per-service railway.json for deploy

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@vercel

vercel Bot commented Jun 18, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Jun 19, 2026 1:55am

Request Review

@vercel

vercel Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

@jerelvelarde is attempting to deploy a commit to the CopilotKit Team on Vercel.

A member of the Team first needs to authorize it.

The check-config-files gate requires new build-config files to be listed in
.github/config-allowlist.txt. Registers the new showcase's frontend config.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…itling

Synced from the cookbook dev repo (verified live on Railway + Playwright):

- db/init/01-create-user.sql: create the `cookbook` user on a dedicated
  ASSM tablespace (cookbook_ts) as its DEFAULT, instead of inheriting
  SYSTEM/MSSM (FREEPDB1's default on the Free :latest-lite image). JSON and
  VECTOR columns are SecureFile-backed and cannot live in an MSSM
  tablespace, so the old user failed schema creation with ORA-43853 and
  memory never persisted. Self-heals a user stranded on SYSTEM
  (drop+recreate); leaves a working ASSM user (local :latest USERS) alone.

- frontend: a new thread is named from its OWN first message, not the
  previous thread's. ThreadTitler now titles off the agent's message/run
  events gated on agent.threadId === activeThreadId, replacing a useEffect
  keyed on activeThreadId that read the shared, agentId-scoped transcript
  while it still held the prior thread's messages during a switch. Adds a
  Playwright regression test (e2e/thread-title.spec.ts).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
build-and-push.sh defaulted IMAGE to a personal GHCR namespace; use an
OWNER placeholder (still IMAGE-overridable) so the showcase ships no
personal/private registry path. Resolves the pre-merge follow-up.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@jerelvelarde

Copy link
Copy Markdown
Contributor Author

Security: Fork PR Alert — false positive on this PR.

It flags frontend/package-lock.json (~16.6k lines) under its "large added file → possible bundled payload" heuristic. That's just the standard auto-generated npm lockfile the standalone-showcase convention requires — these flat example apps ship their own package-lock.json and build with npm ci (same as daytona-runcode/shell-dashboard). Not a bundled payload.

The job also hard-fails (rather than only warning) because fork PRs get a read-only GITHUB_TOKEN, so the monitor's own alert comment POST …/issues/5563/comments returns 403 Resource not accessible by integration and the step throws — which is why this note is posted manually.

No code change warranted; safe to clear on review.

tylerslaton
tylerslaton previously approved these changes Jun 19, 2026
tylerslaton added a commit that referenced this pull request Jun 19, 2026
## What

Adds the **"Build an Agentic Travel App with Oracle Agent Memory, Agent
Spec, and CopilotKit"** cookbook recipe, alongside `daytona.mdx` and
following the same section pattern (Try it live → Prerequisites → setup
→ Try it → key code → Going further → coding-agent prompt).

It wires together:
- **Oracle Agent Spec** — define the agent once as portable JSON
(`pyagentspec`)
- **LangGraph + AG-UI** — run that spec via the `ag_ui_agentspec`
adapter, served over AG-UI (SSE)
- **Oracle AI Database** — long-term memory (`oracleagentmemory`) so the
agent remembers across sessions
- **CopilotKit V2** — the chat frontend (generative UI +
human-in-the-loop), consuming the AG-UI endpoint with `HttpAgent`

The example is a travel concierge that recalls your preferences across
sessions, searches flights, and books them with a human-in-the-loop
confirmation card that stamps into a boarding pass.

## Try it live

Embeds the hosted demo as a live `<iframe>` — **cross-session recall
verified working end-to-end** (teach a preference in one thread, open a
new thread, it recalls from Oracle AI Database).

## Files
- `cookbook/oracle-agent-spec-memory.mdx` (new)
- `cookbook/meta.json` — sidebar entry
- `cookbook/index.mdx` — overview card

## Companion code
**#5563** adds the runnable demo at
`examples/showcases/oracle-agent-memory` (Python agent + Next.js
frontend + Oracle AI Database), beside `daytona-runcode`. The recipe's
"Get the code" links point there.

## No external asset dependencies
- "Try it live" is a live `<iframe>` — no CDN video to upload.
- The architecture diagram is an inline base64 data-URI SVG — no CDN
image to upload.

## Caveat kept honest in the doc
- **Recall is eventually consistent** — memory is
extracted/embedded/indexed asynchronously, so a just-taught fact becomes
recallable after a short delay.

## Verified
- `book_flight` is a CopilotKit **ClientTool** (`useHumanInTheLoop`) —
the confirm→book HITL resolves in a single agent run. Multi-turn
follow-ups work via a server-side full-history replace that sidesteps an
upstream Agent Spec × AG-UI `tool_call_id` correlation bug (documented
inline + in #5563's known-issues).
- Playwright E2E covers cross-session recall, flight search, and the
booking HITL (3/3 green).
- All CI green; ready for review.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
The standalone showcase installs with `npm install` (Nixpacks does this
automatically when there's no lockfile; the README already uses npm install).
Removing the 16.6k-line lockfile also clears the fork-pr-monitor security
alert, which flagged it as a "large added file." Verified: a fresh
`npm install` + `next build` succeeds with no committed lockfile.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
jerelvelarde and others added 3 commits June 24, 2026 23:03
…ient-side booking

Sync the three travel-concierge UX fixes from the source repo
(jerelvelarde/oracle-cookbook#3) into the showcase:

- agent/concierge/server.py: persist memory in a serialized background task so
  the SSE stream closes at RUN_FINISHED instead of blocking ~2-13s on memory
  extraction + reconciliation (the post-generation loading lag). Adds a FastAPI
  lifespan drain + background-task failure surfacing.
- frontend/.../FlightOptions.tsx: "Select this flight" now drives confirm -> book
  entirely client-side, so the booking confirm card renders inline in view
  instead of off-screen via a fresh agent turn. The conversational book_flight
  HITL path is unchanged.
- frontend/e2e: add a covering test for the inline booking flow; rename
  sendAndPersist -> sendAndAwaitRun (stream-close is no longer a "memory written"
  signal now that persistence is backgrounded).

oxfmt --check + tsc --noEmit clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@jerelvelarde

Copy link
Copy Markdown
Contributor Author

Hi @tylerslaton — added in the fixes from your feedback here now. Also rebased on main so it's up to date + conflict-free. Will open a separate PR for the Oracle DB request after this one's merged 🙏

…ted memory in oracle showcase

Ports two fixes from the canonical oracle-cookbook demo into the oracle-agent-memory
showcase agent (server.py was byte-identical to the demo's pre-fix version):

1. Dangling tool-calls: booking conversationally calls the book_flight HITL tool,
   which interrupts and emits an assistant tool_call awaiting the UI's Confirm/Cancel.
   If the traveler sends another chat message instead, the unanswered tool_call made
   the next turn 400 ("tool_call_ids did not have response messages"). _repair_dangling_tool_calls
   synthesizes a "not completed" tool result for any dangling call before the history
   reaches the graph. (Inverse of the duplicate-tool-block issue the history-replace
   already handled — documented in docs/known-issues/agentspec-multiturn-toolcall-correlation.md.)

2. HTML-escaped persistence: the agentspec exporter HTML-escapes streamed deltas
   (& < > -> &amp; &lt; &gt;); the SSE generator persisted them raw, so assistant
   replies were stored in Oracle Agent Memory as e.g. "fares &lt; $700".
   _clean_assistant_text html.unescapes the assembled text before persisting.

Both are reproduced + verified in oracle-cookbook (unit tests + in-browser); the ported
functions are byte-identical to the verified demo code.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

@contextablemark contextablemark left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@jerelvelarde
jerelvelarde merged commit c34dab9 into CopilotKit:main Jun 30, 2026
22 checks passed
jerelvelarde added a commit that referenced this pull request Jun 30, 2026
…agent-memory showcase

Flag-gated (LANGGRAPH_CHECKPOINTER=oracle, default memory) AsyncOracleSaver from
langgraph-oracledb for durable per-thread LangGraph graph state in Oracle,
complementing oracleagentmemory. Default-safe (in-memory fallback). Mirrors
jerelvelarde/oracle-cookbook#4. Draft, stacked on #5563.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
jerelvelarde added a commit that referenced this pull request Jun 30, 2026
…agent-memory showcase (#5762)

## ⚠️ Draft — stacked on #5563

This builds on #5563 (the `oracle-agent-memory` showcase). Since the
showcase isn't on `main` yet, **this PR's diff currently includes
#5563's files** — once #5563 merges, it auto-reduces to just the
checkpointer change below. Keeping it as a **draft** until then; opening
early to stage the work.

## What this adds
An **optional, flag-gated** durable LangGraph checkpointer for the
showcase agent, using Oracle's
[`langgraph-oracledb`](https://github.com/oracle/langchain-oracle/tree/main/libs/langgraph-oracledb)
`AsyncOracleSaver` — so per-thread LangGraph graph state persists in
**Oracle**, **complementing** (not replacing) `oracleagentmemory`. That
rounds out the "whole stack on Oracle" story: durable *memory* **and**
durable *graph checkpoints*.

**Default-safe:** gated behind `LANGGRAPH_CHECKPOINTER` (default
`memory` → behavior unchanged; `oracle` is opt-in), with graceful
fallback to in-memory on any Oracle error — so CI and the default run
path never touch a DB.

## The actual delta (just these agent files)
- `agent/concierge/checkpointer.py` *(new)* — flag-gated resolver:
builds a dedicated async Oracle pool + `AsyncOracleSaver`, runs `await
setup()`, degrades to `MemorySaver` on failure.
- `agent/concierge/server.py` — an import-time monkeypatch injects the
resolved checkpointer past `ag_ui_agentspec`'s hardcoded `MemorySaver`;
the FastAPI lifespan inits/closes it.
- `agent/pyproject.toml` — adds `langgraph-oracledb>=1.0.1`, bumps
`oracledb>=2.2.0`, adds dev `pytest`/`pytest-asyncio`.
- `agent/.env.example` — documents `LANGGRAPH_CHECKPOINTER`.
- `agent/tests/test_oracle_checkpointer.py` *(new)* — a durability
round-trip test (skipped unless `LANGGRAPH_CHECKPOINTER=oracle`).

Mirrors
[jerelvelarde/oracle-cookbook#4](jerelvelarde/oracle-cookbook#4),
where it's reviewed + verified — the durability round-trip passes
against a live Oracle DB, and 5/5 e2e pass with the flag off (no
regression on the default path).

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants