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

vizvasanlya-agent-core

v1.0.0

Published

Production-ready AI agent framework with persistent memory, self-reflection, and adaptive planning

Readme

Agent Core

CI/CD Pipeline npm version License: MIT Tests

A production-ready AI agent framework with persistent memory, self-reflection, and adaptive planning capabilities.

Features

  • Persistent Long-Term Memory - Vector-based retrieval with ChromaDB/local storage
  • Self-Reflection Engine - LLM-powered critique and continuous improvement
  • Dynamic Tool Creation - Runtime tool registration and composition
  • Adaptive Planning - Goal decomposition with error recovery
  • Multi-Modal Perception - Text, image, audio, and code analysis
  • Agent Collaboration - Multi-agent communication protocol
  • Token Management - Budget tracking and message truncation
  • Rate Limiting - Request throttling with exponential backoff
  • Circuit Breaker - Fault tolerance with automatic recovery
  • Streaming Support - Real-time response streaming
  • Code Sandbox - Safe code execution environment
  • Observability - Distributed tracing and metrics collection

Installation

npm install @agent-core/framework

Quick Start

import { Agent } from '@agent-core/framework';

const agent = new Agent({
  config: {
    memory: { provider: 'local', persistence: true, embeddingModel: 'text-embedding-3-small', maxTokens: 100000 },
    reflection: { enabled: true, critiqueDepth: 'medium', learningRate: 0.1 },
    planning: { adaptive: true, maxRetries: 3, timeout: 30000 },
    tools: { dynamic: true, composition: true, learning: true },
    perception: { modalities: ['text', 'code'], uncertainty: true },
  },
  openaiApiKey: process.env.OPENAI_API_KEY,
  llmProvider: 'openai',
});

await agent.initialize();
const result = await agent.run("Help me research AI agents");
console.log(result);

Architecture

┌─────────────────────────────────────────────────────────────────┐
│                        Agent Core                               │
├─────────────────────────────────────────────────────────────────┤
│  ┌─────────────┐  ┌─────────────┐  ┌─────────────┐            │
│  │   Memory    │  │ Reflection  │  │   Tools     │            │
│  │   System    │  │   Engine    │  │   Creator   │            │
│  └─────────────┘  └─────────────┘  └─────────────┘            │
│  ┌─────────────┐  ┌─────────────┐  ┌─────────────┐            │
│  │  Planning   │  │ Perception  │  │ Collaboration│           │
│  │   System    │  │   Layer     │  │   Protocol  │            │
│  └─────────────┘  └─────────────┘  └─────────────┘            │
├─────────────────────────────────────────────────────────────────┤
│  ┌─────────────┐  ┌─────────────┐  ┌─────────────┐            │
│  │   Token     │  │    Rate     │  │   Circuit   │            │
│  │   Counter   │  │   Limiter   │  │   Breaker   │            │
│  └─────────────┘  └─────────────┘  └─────────────┘            │
│  ┌─────────────┐  ┌─────────────┐  ┌─────────────┐            │
│  │   Stream    │  │   Sandbox   │  │ Observability│           │
│  │   Handler   │  │             │  │             │            │
│  └─────────────┘  └─────────────┘  └─────────────┘            │
└─────────────────────────────────────────────────────────────────┘

Core Components

Memory System

Persistent memory with vector-based semantic search.

import { MemorySystem } from '@agent-core/framework';

const memory = new MemorySystem({
  provider: 'chromadb', // or 'local', 'pinecone'
  embeddingModel: 'text-embedding-3-small',
  persistence: true,
  maxTokens: 100000,
});

await memory.store("AI agents need persistent memory");
const results = await memory.retrieve("What do AI agents need?", 5);

Reflection Engine

Self-critique and continuous improvement.

import { ReflectionEngine } from '@agent-core/framework';

const reflection = new ReflectionEngine({
  enabled: true,
  critiqueDepth: 'deep',
  learningRate: 0.1,
});

const critique = await reflection.analyze(response, context);
const improved = await reflection.improve(plan, critique);

Tool Creator

Dynamic tool creation and composition.

import { ToolCreator } from '@agent-core/framework';

const toolCreator = new ToolCreator({ dynamic: true, composition: true, learning: true });

await toolCreator.create({
  name: "fetch_weather",
  description: "Get weather for a location",
  parameters: { location: { type: "string", description: "City name", required: true } },
  implementation: async (params) => {
    return { temp: 72, condition: "sunny", location: params.location };
  }
});

const result = await toolCreator.execute("fetch_weather", { location: "NYC" });

Adaptive Planner

Goal decomposition with error recovery.

import { AdaptivePlanner } from '@agent-core/framework';

const planner = new AdaptivePlanner({
  adaptive: true,
  maxRetries: 3,
  timeout: 30000,
});

const plan = await planner.createPlan("Build a web scraper");
const result = await planner.execute(plan);

Production Utilities

import { TokenCounter, RateLimiter, CircuitBreaker } from '@agent-core/framework';

// Token management
const tokenCounter = new TokenCounter(128000);
const budget = tokenCounter.getBudget();

// Rate limiting
const rateLimiter = new RateLimiter({ maxRequests: 60, windowMs: 60000 });
await rateLimiter.execute('api_call', async () => {
  return await fetch('https://api.example.com');
});

// Circuit breaker
const circuitBreaker = new CircuitBreaker({ failureThreshold: 5, recoveryTimeoutMs: 30000 });
const result = await circuitBreaker.execute(async () => {
  return await riskyOperation();
});

Configuration

const config = {
  memory: {
    provider: 'chromadb',
    embeddingModel: 'text-embedding-3-small',
    persistence: true,
    maxTokens: 100000,
    chromaUrl: 'http://localhost:8000',
  },
  reflection: {
    enabled: true,
    critiqueDepth: 'medium',
    learningRate: 0.05,
    llmProvider: 'openai',
    llmModel: 'gpt-4o-mini',
  },
  planning: {
    adaptive: true,
    maxRetries: 3,
    timeout: 30000,
    fallbackStrategies: true,
  },
  tools: {
    dynamic: true,
    composition: true,
    learning: true,
    sandbox: true,
    maxExecutionTime: 10000,
  },
  perception: {
    modalities: ['text', 'image', 'code'],
    uncertainty: true,
  },
};

Environment Variables

OPENAI_API_KEY=your_openai_api_key
ANTHROPIC_API_KEY=your_anthropic_api_key
CHROMA_URL=http://localhost:8000

Development

# Clone the repository
git clone https://github.com/vizvasanlya/agent-core.git
cd agent-core

# Install dependencies
npm install

# Run in development mode
npm run dev

# Run tests
npm test

# Build for production
npm run build

# Lint
npm run lint

# Type check
npm run typecheck

Testing

npm test                    # Run all tests (62 tests)
npm run test:watch         # Run tests in watch mode
npm run test:coverage      # Run tests with coverage

CI/CD

The project includes a GitHub Actions workflow that:

  • Runs tests on Node.js 18, 20, and 22
  • Builds the TypeScript project
  • Publishes to npm on main branch pushes

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

MIT License - see LICENSE for details.

Acknowledgments

  • Built with TypeScript and Node.js
  • Uses OpenAI and Anthropic APIs for LLM capabilities
  • ChromaDB for vector storage
  • Inspired by research on AI agents from Anthropic, OpenAI, and academic papers