Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@ jobs:
- name: Verify OpenAI adapter package contents
run: pnpm --filter @agent-memory/openai pack --dry-run

- name: Verify Anthropic adapter package contents
run: pnpm --filter @agent-memory/anthropic pack --dry-run

- name: Verify Gemini adapter package contents
run: pnpm --filter @agent-memory/gemini pack --dry-run

- name: Verify xAI adapter package contents
run: pnpm --filter @agent-memory/xai pack --dry-run

- name: Verify public package contents
run: pnpm --filter agent-memory pack --dry-run

Expand Down Expand Up @@ -88,6 +97,21 @@ jobs:
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish Anthropic adapter
run: pnpm --filter @agent-memory/anthropic publish --access public --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish Gemini adapter
run: pnpm --filter @agent-memory/gemini publish --access public --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish xAI adapter
run: pnpm --filter @agent-memory/xai publish --access public --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish public package
run: pnpm --filter agent-memory publish --access public --no-git-checks
env:
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,14 @@ jobs:
- name: Verify OpenAI adapter package contents
run: pnpm --filter @agent-memory/openai pack --dry-run

- name: Verify Anthropic adapter package contents
run: pnpm --filter @agent-memory/anthropic pack --dry-run

- name: Verify Gemini adapter package contents
run: pnpm --filter @agent-memory/gemini pack --dry-run

- name: Verify xAI adapter package contents
run: pnpm --filter @agent-memory/xai pack --dry-run

- name: Verify public package contents
run: pnpm --filter agent-memory pack --dry-run
3 changes: 3 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ This repo is a TypeScript-first pnpm workspace for the `agent-memory` SDK.
- `packages/sqlite` (`@agent-memory/sqlite`) owns real SQLite `.memory/memory.sqlite` persistence.
- `packages/postgres` (`@agent-memory/postgres`) owns Postgres persistence, automatic migrations, and pgvector search.
- `packages/openai` (`@agent-memory/openai`) owns OpenAI model calls through the official `openai` SDK, plus compatible custom endpoint support.
- `packages/anthropic` (`@agent-memory/anthropic`) owns Anthropic model calls through the official `@anthropic-ai/sdk` package.
- `packages/gemini` (`@agent-memory/gemini`) owns Gemini model calls through the official `@google/genai` package.
- `packages/xai` (`@agent-memory/xai`) owns xAI model calls through the documented OpenAI SDK-compatible client path with xAI defaults.
- `packages/agent-memory` is the public convenience package. It should keep `createAgent({ model })` easy and automatic.
- `apps/playground` is private and must never ship in npm packages.

Expand Down
24 changes: 21 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ TypeScript SDK for building AI agents with automatic, scoped, persistent memory.

`agent-memory` wraps model calls with memory recall and learning so apps can keep useful user, thread, and operation context without manually stuffing long chat histories into every prompt.

Repository: [github.com/gharibyan/agent-memory](https://github.com/gharibyan/agent-memory)

## Install

```sh
Expand Down Expand Up @@ -101,14 +99,31 @@ The Postgres adapter runs migrations automatically before the first memory opera

## Model Providers

First-party provider integrations should use official SDKs. The OpenAI adapter depends on the official `openai` TypeScript SDK:
First-party provider integrations should use provider SDKs or documented provider client paths. The OpenAI adapter depends on the official `openai` TypeScript SDK:

```ts
import { openai } from "agent-memory"

const model = openai("gpt-5")
```

Anthropic and Gemini live in their own adapter packages and are also re-exported by `agent-memory`:

```ts
import { anthropic, gemini } from "agent-memory"

const anthropicModel = anthropic("anthropic-model")
const geminiModel = gemini("gemini-2.5-pro")
```

xAI has a first-class package too. It uses the documented OpenAI SDK-compatible client path with xAI defaults:

```ts
import { xai } from "agent-memory"

const model = xai("grok-4")
```

Use the OpenAI-compatible helper only for custom providers that expose a compatible chat completions API:

```ts
Expand All @@ -129,6 +144,9 @@ const model = openAICompatible({
- `@agent-memory/sqlite`: real SQLite persistence adapter.
- `@agent-memory/postgres`: Postgres persistence adapter with pgvector migrations.
- `@agent-memory/openai`: OpenAI official SDK adapter, plus OpenAI-compatible custom endpoint support.
- `@agent-memory/anthropic`: Anthropic official SDK adapter.
- `@agent-memory/gemini`: Gemini official SDK adapter.
- `@agent-memory/xai`: xAI adapter using the documented OpenAI SDK-compatible client path.

## Playground

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
"packages/*"
],
"scripts": {
"build": "pnpm --filter @agent-memory/core build && pnpm --filter @agent-memory/local build && pnpm --filter @agent-memory/sqlite build && pnpm --filter @agent-memory/postgres build && pnpm --filter @agent-memory/openai build && pnpm --filter agent-memory build",
"build": "pnpm --filter @agent-memory/core build && pnpm --filter @agent-memory/local build && pnpm --filter @agent-memory/sqlite build && pnpm --filter @agent-memory/postgres build && pnpm --filter @agent-memory/openai build && pnpm --filter @agent-memory/anthropic build && pnpm --filter @agent-memory/gemini build && pnpm --filter @agent-memory/xai build && pnpm --filter agent-memory build",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"test": "pnpm build && node --test packages/agent-memory/test/*.test.mjs test/*.test.mjs",
"pack:check": "pnpm --filter @agent-memory/core pack --dry-run && pnpm --filter @agent-memory/local pack --dry-run && pnpm --filter @agent-memory/sqlite pack --dry-run && pnpm --filter @agent-memory/postgres pack --dry-run && pnpm --filter @agent-memory/openai pack --dry-run && pnpm --filter agent-memory pack --dry-run",
"pack:check": "pnpm --filter @agent-memory/core pack --dry-run && pnpm --filter @agent-memory/local pack --dry-run && pnpm --filter @agent-memory/sqlite pack --dry-run && pnpm --filter @agent-memory/postgres pack --dry-run && pnpm --filter @agent-memory/openai pack --dry-run && pnpm --filter @agent-memory/anthropic pack --dry-run && pnpm --filter @agent-memory/gemini pack --dry-run && pnpm --filter @agent-memory/xai pack --dry-run && pnpm --filter agent-memory pack --dry-run",
"version:from-tag": "node scripts/sync-package-version-from-tag.mjs"
},
"devDependencies": {
Expand Down
10 changes: 4 additions & 6 deletions packages/agent-memory/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,10 @@ TypeScript SDK for building AI agents with automatic, scoped, persistent memory.
Full project documentation: [github.com/gharibyan/agent-memory](https://github.com/gharibyan/agent-memory).

```ts
import { createAgent, openAICompatible } from "agent-memory"
import { createAgent, openai } from "agent-memory"

const agent = createAgent({
model: openAICompatible({
model: "deepseek-chat",
baseURL: "https://api.deepseek.com/v1",
apiKey: process.env.DEEPSEEK_API_KEY
})
model: openai("gpt-5")
})

const result = await agent.generate({
Expand All @@ -27,4 +23,6 @@ const result = await agent.generate({
console.log(result.text)
```

First-party helpers include `openai()`, `anthropic()`, `gemini()`, and `xai()`. Use `openAICompatible()` for custom chat-completions endpoints.

If `userId` is omitted, memory is stored in the shared default scope. Local memory defaults to `.memory/memory.json`; use `sqliteMemory()` for `.memory/memory.sqlite` or `postgresMemory()` for Postgres with automatic pgvector migrations.
5 changes: 4 additions & 1 deletion packages/agent-memory/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,14 @@
"test": "pnpm build && node --test test/*.test.mjs"
},
"dependencies": {
"@agent-memory/anthropic": "workspace:*",
"@agent-memory/core": "workspace:*",
"@agent-memory/gemini": "workspace:*",
"@agent-memory/local": "workspace:*",
"@agent-memory/openai": "workspace:*",
"@agent-memory/postgres": "workspace:*",
"@agent-memory/sqlite": "workspace:*"
"@agent-memory/sqlite": "workspace:*",
"@agent-memory/xai": "workspace:*"
},
"engines": {
"node": ">=20.12"
Expand Down
6 changes: 6 additions & 0 deletions packages/agent-memory/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
export { createAgent } from "./agent.js"
export * from "@agent-memory/core"
export { anthropic } from "@agent-memory/anthropic"
export { gemini } from "@agent-memory/gemini"
export { localMemory } from "@agent-memory/local"
export { sqliteMemory } from "@agent-memory/sqlite"
export { postgresMemory } from "@agent-memory/postgres"
export { openAICompatible, openai } from "@agent-memory/openai"
export { xai } from "@agent-memory/xai"
export type { AgentConfig, AgentMemoryConfig } from "@agent-memory/core"
export type { AnthropicOptions } from "@agent-memory/anthropic"
export type { GeminiOptions } from "@agent-memory/gemini"
export type { OpenAICompatibleOptions } from "@agent-memory/openai"
export type { PostgresMemoryOptions, PgPoolLike } from "@agent-memory/postgres"
export type { XAIOptions } from "@agent-memory/xai"
14 changes: 14 additions & 0 deletions packages/anthropic/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# @agent-memory/anthropic

Anthropic model provider adapter for `agent-memory`, backed by the official `@anthropic-ai/sdk` TypeScript SDK.

```ts
import { createAgent } from "agent-memory"
import { anthropic } from "@agent-memory/anthropic"

const agent = createAgent({
model: anthropic("anthropic-model")
})
```

Set `ANTHROPIC_API_KEY` in the environment, or pass `apiKey` explicitly.
47 changes: 47 additions & 0 deletions packages/anthropic/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"name": "@agent-memory/anthropic",
"version": "0.0.0",
"description": "Anthropic official SDK model provider adapter for agent-memory.",
"type": "module",
"author": "Gharibyan",
"homepage": "https://github.com/gharibyan/agent-memory#readme",
"bugs": {
"url": "https://github.com/gharibyan/agent-memory/issues"
},
"repository": {
"type": "git",
"url": "git+https://github.com/gharibyan/agent-memory.git",
"directory": "packages/anthropic"
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"files": [
"dist",
"README.md",
"package.json"
],
"scripts": {
"build": "node ../../scripts/clean-dist.mjs && tsc -p tsconfig.json"
},
"dependencies": {
"@agent-memory/core": "workspace:*",
"@anthropic-ai/sdk": "^0.104.1"
},
"engines": {
"node": ">=20.12"
},
"keywords": [
"ai",
"agent",
"memory",
"anthropic",
"llm"
],
"license": "MIT"
}
Loading
Loading