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

arcananex-synapse

v0.1.1

Published

Agentic AI framework

Readme

Arcananex Synapse

Arcananex Synapse is a TypeScript library for building agentic AI systems and orchestrators. It provides abstractions for agent management, LLM (Large Language Model) integration, command execution, and AWS Bedrock connectivity, enabling rapid development of advanced AI-driven applications.

Features

  • Agent Routing: Route user input to the correct agent using LLM-based task routing.
  • Agent Abstraction: Define, register, and manage agents with custom logic (agent.ts).
  • Command Pattern: Encapsulate operations as commands for flexible scheduling and execution (command.ts).
  • Always-Run Agents: Register agents that execute on every input, in parallel.
  • LLM Integration: Connect to AWS Bedrock and other LLM providers via adapters (adapters).
  • Builders: Utilities for constructing memory and message objects for LLMs (builders).
  • TypeScript-first: Strong typing and modern developer experience.
  • Test Coverage: Comprehensive tests for core modules (src/*.test.ts).

Getting Started

Prerequisites

  • Node.js (v18+ recommended)
  • TypeScript (4.x or later)
  • AWS credentials (for Bedrock integration, if used)

Installation

npm install <path-to-arcananex-synapse>
# or if published
npm install arcananex-synapse

Configuration

Set environment variables in a .env file to configure the AI model and inference parameters:

AI_MODEL=amazon.nova-lite-v1:0
INFERENCE_CONFIG={"maxTokens":5000,"topP":0.9,"topK":20,"temperature":0.7}
  • AI_MODEL: The model identifier (e.g., for Bedrock or other LLMs)
  • INFERENCE_CONFIG: JSON string with inference parameters

Usage

1. Routing User Input to Agents

The framework uses an LLM prompt to route user input to the correct agent. The routing prompt is only used for this step.

import { agent, command } from 'arcananex-synapse';

const config = {
  defaultMemory: [/* business logic memory for default agent */]
};
const main = new agent.Agent(llmInvoker, config); // llmInvoker: your LLM client instance

// Define agent command functions
const emailCommand = new command.Command('email');
emailCommand.setTask(async (task) => {
  // Your email logic here
  return { message: { content: `Email sent: ${task.command}` } };
});

main.registerAgent('email', emailCommand);

// Register always running agents
const analyticCommand = new command.Command('analytic');
analyticCommand.setTask(async (task) => {
  // Analytics logic here
  return { message: { content: 'Analytics processed.' } };
});
main.registerAlwaysRunAgent('analytic', analyticCommand);

// Process input (routing will occur automatically)
const result = await main.processInput([
  { role: 'user', content: 'Send onboarding email to new users' }
]);
console.log(result);

2. Custom Agent Logic

You can implement custom agent logic by extending the Command or using your own handler:

const customCommand = new command.Command('custom');
customCommand.setTask(async (task) => {
  // Custom logic here
  return { message: { content: `Handled by custom agent: ${task.command}` } };
});
main.registerAgent('custom', customCommand);

3. Chaining Agent Tasks

Chain multiple tasks using ChainCommand:

const chain = new command.ChainCommand<agent.AgentTask, unknown>()
  .addTask(async (task) => {
    // Task 1
    return { step: 1 };
  })
  .addTask(async (task) => {
    // Task 2
    return { step: 2 };
  });
main.registerAgent('chain', chain);

4. Always-Run Agents

Always-run agents execute in parallel with the routed agent:

const loggerCommand = new command.Command('logger');
loggerCommand.setTask(async (task) => {
  // Log every input
  console.log('Logging:', task.originalInput);
  return { message: { content: 'Logged.' } };
});
main.registerAlwaysRunAgent('logger', loggerCommand);

5. Use with AWS Bedrock

Adapters and utilities for AWS Bedrock are provided. Set up your AWS credentials and use the provided Bedrock client and adapters:

import { bedrock } from 'arcananex-synapse/clients/bedrock';
const llmInvoker = new bedrock.BedrockLLMInvoker(/* config */);
const main = new agent.Agent(llmInvoker, config);

Advanced Topics

  • Command Pattern: Encapsulate operations as commands for scheduling and concurrency control.
  • Adapters: Integrate with other LLM providers by implementing adapter interfaces.
  • Builders: Use provided builders for constructing memory and message objects for LLMs.
  • Testing: Run tests with npm test. Test files are in src/*.test.ts.
  • Extending: Add new agents, commands, or adapters by following the patterns in src.

Project Structure

esbuild.config.ts
jest.config.ts
LICENSE
package.json
README.md
tsconfig.json
src/
  agent.ts
  command.ts
  index.ts
  llm-invoker.ts
  adapters/
    bedrock-llm-client-adapter.ts
    llm-response-adapter.ts
  builders/
    agent-builder.ts
    memory-builder.ts
    message-builder.ts
  clients/
    bedrock.ts
    chatgpt.ts
  utils/
    aws-credential.ts
    bedrock-response.ts
  *.test.ts

Development & Contribution

  1. Clone the monorepo and install dependencies:
    git clone <your-repo-url>
    cd arcananex-synapse
    npm install
  2. Build the framework:
    npm run build
  3. Run tests:
    npm test

Pull requests and issues are welcome! Please open an issue to discuss your ideas or report bugs.

License

MIT