mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-10-17 04:36:57 +00:00
Every integration (AI SDK, OpenAI, Mastra, VoltAgent, Claude memory) now calls v5 through `supermemory@5`. The config takes one `namespace` instead of `containerTags` or `projectId`, and `withSupermemory` takes `namespace` and `id` instead of `containerTag` and `customId`. No aliases. With no config the tools still use `sm_project_default`. Conversations are stored as one document per conversation keyed by `id` instead of `/v4/conversations`. `memoryForget` drops `reason`; forgetting by text previews with `forgetMatching` and then forgets exact matches by id. Claude memory marks its files with `metadata.source` instead of a second tag. Search keeps the 2.x defaults so results do not shift. `packages/ai-sdk` is removed: npm already deprecates it in favor of `@supermemory/tools/ai-sdk`, so its CI steps and playground wiring go too. `apps/sdk-playground` moves to the new tools API and v5 routes, including its Python server. Tested against production: add, search, profile, list and delete. 112 unit tests pass; type errors drop from 148 to 141, none new. The `supermemory` dependency pins the rc until 5.0.0 is published.
92 lines
3 KiB
Markdown
92 lines
3 KiB
Markdown
# SDK Agent Playground
|
|
|
|
Chat with a **real agent** and switch which Supermemory SDK integration powers it.
|
|
|
|
> [!WARNING]
|
|
> This is a local, single-user development tool. It makes real API calls, stores
|
|
> browser-entered keys only in memory unless you opt into tab-scoped
|
|
> `sessionStorage`, and exposes tools that can permanently delete documents. Use
|
|
> disposable development credentials and a test namespace; do not deploy it or
|
|
> point it at production data.
|
|
|
|
## Integrations
|
|
|
|
| SDK | Style | What happens |
|
|
|-----|-------|----------------|
|
|
| AI SDK + middleware | automatic | `withSupermemory` injects context + saves chat |
|
|
| OpenAI + middleware | automatic | same, via OpenAI client wrapper |
|
|
| AI SDK + tools | explicit | model calls 7 memory tools via `generateText` |
|
|
| OpenAI + tools | explicit | OpenAI function-calling loop |
|
|
| Python OpenAI middleware | automatic | `with_supermemory` |
|
|
| Python OpenAI tools | explicit | `SupermemoryTools` loop |
|
|
| Python supermemory direct | manual | `profile()` + OpenAI + `add()` |
|
|
|
|
## Setup
|
|
|
|
Prerequisites: Bun 1.3.6, Python 3.11+, and
|
|
[`uv`](https://docs.astral.sh/uv/). Portless is required only for the HTTPS
|
|
development hostname; the direct localhost commands below work without it.
|
|
|
|
From the repository root:
|
|
|
|
```bash
|
|
bun install --frozen-lockfile
|
|
|
|
cp apps/sdk-playground/.env.example apps/sdk-playground/.env.local
|
|
# Required:
|
|
# SUPERMEMORY_API_KEY=...
|
|
# OPENAI_API_KEY=...
|
|
```
|
|
|
|
The playground scripts build `@supermemory/tools` before starting, type-checking, or building the
|
|
Next.js app. Development mode also watches the workspace package.
|
|
|
|
## Run
|
|
|
|
```bash
|
|
bun run --cwd apps/sdk-playground dev
|
|
```
|
|
|
|
Opens:
|
|
|
|
- **Chat UI** — https://sdk.dev.supermemory.ai via Portless
|
|
- **Next.js server** — http://127.0.0.1:3005
|
|
- **Python server** — http://127.0.0.1:8792
|
|
|
|
To run without Portless, use two terminals:
|
|
|
|
```bash
|
|
bun run --cwd apps/sdk-playground dev:next
|
|
bun run --cwd apps/sdk-playground dev:python
|
|
```
|
|
|
|
For a production-mode local smoke check, build first and then start. `start`
|
|
runs both the built Next.js app and the Python server, and remains intended for
|
|
local use only.
|
|
|
|
```bash
|
|
bun run --cwd apps/sdk-playground build
|
|
bun run --cwd apps/sdk-playground start
|
|
```
|
|
|
|
Try:
|
|
|
|
- "Remember that I prefer oat milk in coffee"
|
|
- "What do you know about my drink preferences?"
|
|
- "Forget that I like tea" (tools mode)
|
|
|
|
## Env
|
|
|
|
| Variable | Required |
|
|
|----------|----------|
|
|
| `SUPERMEMORY_API_KEY` | yes |
|
|
| `OPENAI_API_KEY` | yes |
|
|
| `SUPERMEMORY_BASE_URL` | optional |
|
|
| `MODEL_NAME` | optional (default `gpt-4o-mini`) |
|
|
| `SDK_PLAYGROUND_PYTHON_URL` | optional (default `http://127.0.0.1:8792`) |
|
|
| `SDK_PLAYGROUND_PYTHON_PORT` | optional (default `8792`) |
|
|
| `SDK_PLAYGROUND_ALLOW_ENV_KEYS` | optional; set `true` only when a trusted non-local hostname must use server env keys |
|
|
|
|
Server environment keys are exposed to the playground routes only on loopback
|
|
hosts and `sdk.dev.supermemory.ai` by default. Browser-provided keys remain
|
|
request-scoped and are never copied into process-global environment variables.
|