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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@anaplian/core

v1.17.0

Published

Anaplian core library for long running AI agent development

Downloads

105

Readme

@anaplian/core

Long-running AI Agents

What

Anaplian is an AI agent framework written in TypeScript and designed to interop with LangChain.js.

Why

Anaplian is specifically built for long-running AI agents.

Do you need an agent that:

  • Has a long life cycle?
  • Has an open-ended objective?
  • Is completely customizable?

Then Anaplian might be a good framework in which to build your agent! If your agents are short-lived, finite state machines, chatbots, or need partitioned memories, you might want to consider another framework.

Anaplian was written according to the following basic tenets:

  1. Everything is an action! Every time the model is invoked, it must select an action.
  2. No special treatment! There is no "core" library of actions always available to an agent. The agent may only exercise the actions that you provide. The same goes for items in the context. Don't like the agent history that ships with Anaplian? Feel free to substitute your own that does exactly what need.
  3. Come as you are! Anaplian is designed to be agnostic to the underlying model that is invoked. As long as it implements LangChain's BaseLlm or BaseChatModel, it will run. If it doesn't, that's a bug! However, models with a context window size of at least 100,000 tokens are recommended.
  4. No templating! Anaplian will handle all prompt formatting so that developers can write code instead of prompt templates.

Anaplian is written in TypeScript and supported in Node.js 18.x, 20.x, and 22.x.

Intended use cases include:

  • Research and report preparation
  • System monitoring
  • Automated incident response
  • Web crawlers

Getting Started

npm install --save @anaplian/core

@anaplian/core contains the base runtime and a very small number of basic actions and context providers.

This code builds a very basic model then runs it. See packages/djan-seriy for a full example agent.

const modelName = 'gpt-4o-mini';
new AgentBuilder({
  modelName,
  roleAssignmentDirective:
    'You are a poet writing a sonnet. Brainstorm several topics using the "think" action and refine your idea. Then use the "think" action to write your sonnet. After have written your sonnet, use the "nop" action.',
  model: new ChatOpenAI({
    apiKey: 'your-api-key',
    model: modelName,
    streaming: false,
    temperature: 0,
  }),
})
  .addAction(new NopAction())
  .addAction(new ThinkAction())
  .addContextProvider(new HistoryContextProvider({}), 99.5) // 99.5% of the available context window will be allocated to history
  .addContextProvider(new DateContextProvider(), 0.5) // 0.5% of the available context window will be allocated to the current date
  .setOn('fatalError', (error) => console.error(error)) // if a fatal error occurs, log it to the console
  .build()
  .then((agent) => agent.run());

Concepts

The two primary components to an Anaplian agent are Actions and Context Providers.

Context Providers

Before the model is invoked, its context is constructed from a set of providers. The context informs the agent about how it will act. The HistoryContextProvider is arguably the most important provider as without it, the agent will have no knowledge about what it has done.

Actions

After the context has been rendered, the agent must select an action to execute. These are actions are selected from a list of actions provided when the agent was built. The Action interface includes documentation that is provided to the agent about what the action does, how to use it, and examples.