npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@atomicmemory/openai-agents

v0.1.2

Published

AtomicMemory adapter for the OpenAI Agents SDK — pre-run memory retrieval, post-run ingest, and function tools.

Readme

AtomicMemory for OpenAI Agents SDK

Adapter for the OpenAI Agents SDK for TypeScript. It wires AtomicMemory into agent runs without replacing the SDK's own Session implementations.

Install

This package is intended to publish as @atomicmemory/openai-agents. Until @atomicmemory/sdk is published and pinned to a registry version, build it from the monorepo:

pnpm --filter @atomicmemory/openai-agents build

In a local workspace, import from the package once it is linked by pnpm-workspace.yaml:

import { MemoryClient } from '@atomicmemory/sdk';
import { Agent, run } from '@openai/agents';
import { runWithMemory } from '@atomicmemory/openai-agents';

const memory = new MemoryClient({
  providers: {
    atomicmemory: {
      apiUrl: process.env.ATOMICMEMORY_API_URL!,
      apiKey: process.env.ATOMICMEMORY_API_KEY,
    },
  },
  defaultProvider: 'atomicmemory',
});
await memory.initialize();

const agent = new Agent({
  name: 'Assistant',
  instructions: 'You are a helpful assistant.',
});

const { result, retrieved } = await runWithMemory({
  client: memory,
  scope: { user: 'user-123', namespace: 'support' },
  input: 'What did we decide about billing retries?',
  run: (input) => run(agent, input),
});

console.log(result.finalOutput, retrieved.length);

Primitives

augmentInputWithMemory(client, options)

Searches AtomicMemory before an agent run and prepends a system() message containing retrieved context when matches exist.

const { input, retrieved } = await augmentInputWithMemory(memory, {
  scope: { user: 'user-123' },
  input: 'What should I remember?',
});

const result = await run(agent, input);

ingestAgentTurn(client, options)

Persists completed turns after run(). System messages are excluded by default; the assistant output is appended as the final assistant message.

await ingestAgentTurn(memory, {
  scope: { user: 'user-123' },
  input,
  result,
  metadata: { source: 'openai-agents', event: 'run_completed' },
});

For streamed results, wait for completed and pass explicit output text if needed:

const stream = await run(agent, input, { stream: true });
await stream.completed;

await ingestAgentTurn(memory, {
  scope,
  input,
  output: String(stream.finalOutput ?? ''),
});

createMemoryTools(client, options)

Creates two OpenAI Agents SDK function tools:

  • memory_search - search AtomicMemory during a run.
  • memory_ingest - store durable preferences, decisions, conventions, or facts.
const agent = new Agent({
  name: 'Assistant',
  instructions: 'Use memory tools when prior context or durable learning matters.',
  tools: createMemoryTools(memory, {
    scope: { user: 'user-123', namespace: 'support' },
    metadata: { source: 'openai-agents-tool' },
  }),
});

Verify

Run local adapter checks:

pnpm --filter @atomicmemory/openai-agents test
pnpm --filter @atomicmemory/openai-agents typecheck
pnpm --filter @atomicmemory/openai-agents build

Run the backend smoke test without making an OpenAI API call:

export ATOMICMEMORY_API_URL="http://localhost:17350"
export ATOMICMEMORY_API_KEY="..."
export ATOMICMEMORY_PROVIDER="atomicmemory"
export ATOMICMEMORY_SCOPE_USER="$USER"
export ATOMICMEMORY_SCOPE_NAMESPACE="openai-agents-sdk-smoke"

pnpm --filter @atomicmemory/openai-agents smoke:backend

The smoke test writes a unique marker, verifies augmentInputWithMemory() retrieves it, then runs runWithMemory() with a fake runner and reports the post-run ingest AUDN-SC outcome.

Set OPENAI_API_KEY only when you want to test the real Agent + run() path from the install example.

Notes

  • AtomicMemory is long-term semantic memory. The OpenAI Agents SDK Session surface is still useful for short-term conversation state.
  • Retrieved memories are injected as reference context only. The adapter's default prompt explicitly tells the model not to follow instructions embedded in retrieved memories.
  • ingestAgentTurn requires text output. For structured outputs, it serializes finalOutput as JSON unless you pass an explicit output.

License

Apache-2.0.