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

@astrive-ai/sdk

v1.0.53

Published

AstriveAI - Universal AI Agent Framework

Readme

@astrive-ai/sdk

Astrive AI is a powerful, universal, and highly adaptable Agentic AI SDK designed for developers. Build autonomous AI agents that can seamlessly integrate into your CLI, Web Server (Express/Next.js), or messaging platforms (Telegram, WhatsApp, Discord).

With built-in native capabilities like dynamic code execution (RuntimeEvalTool) and media delivery (SendMediaTool), Astrive AI breaks the boundaries of traditional chatbots, allowing the AI to interact directly with your host application to perform tasks automatically.


🚀 Installation

npm install @astrive-ai/sdk

🌟 Key Features

  1. Autonomous Tooling System: Includes pre-built tools (Web Search, Filesystem, Terminal, Media Downloader, Vision, and more).
  2. Universal Event Emitter: Agent can emit events (e.g. media:send) to communicate media intent directly to your app.
  3. Runtime Execution (The Bridge): Expose your platform's API (e.g., Express res, Telegram bot) to the agent so it can dynamically write and execute code inside your Node.js runtime!
  4. Memory & Planner: Built-in context memory and multi-step execution planning.
  5. Provider Agnostic: Easily plug in your own models (Gemini, OpenAI, Anthropic, etc.).

🛠️ Quick Start (Basic Agent)

import { createAgent } from '@astrive-ai/sdk';

const agent = createAgent({
  providers: { /* Your Provider Setup */ }
});

async function run() {
  await agent.init();
  const response = await agent.chat({ message: "Hello! Tell me a joke." });
  console.log(response.content);
}

run();

🤯 The Magic: RuntimeEvalTool (Universal Bridge)

The RuntimeEvalTool allows the AI to literally write and execute Javascript code within your host environment. This is the ultimate abstraction for Bots, Apps, and Web Servers.

Instead of hardcoding hundreds of conditions in your code, just inject your framework's instance (e.g., res in Express or bot in Telegram) into the Agent. The AI will analyze the object and dynamically call the right methods!

Example 1: Web Server (Express.js)

import express from 'express';
import { createAgent } from '@astrive-ai/sdk';

const app = express();
const agent = createAgent();

app.post('/api/chat', async (req, res) => {
  const { message } = req.body;
  
  // 1. Inject the Express response object into the AI's runtime!
  const runtimeTool = agent.getTool('runtime_eval');
  runtimeTool.injectContext({ res });
  
  // 2. The AI can now choose to answer normally OR execute code like `res.json(...)`
  const response = await agent.chat({ 
    message: message + "\n[System: You can use 'runtime_eval' to call res.json({ data }) directly.]" 
  });
  
  // 3. Fallback if the AI just returns text instead of executing code
  if (!res.headersSent && response.content) {
    res.send(response.content);
  }
});

Example 2: Telegram Bot Integration

Give the AI full control over your Telegram Bot to send complex media and documents seamlessly!

import TelegramBot from 'node-telegram-bot-api';
import { createAgent } from '@astrive-ai/sdk';

const bot = new TelegramBot('YOUR_TOKEN', { polling: true });
const agent = createAgent();

// Inject the global bot instance
const runtimeTool = agent.getTool('runtime_eval');
if (runtimeTool) runtimeTool.injectContext({ bot });

bot.on('message', async (msg) => {
  const chatId = msg.chat.id;
  
  // Inject the specific chat session context
  if (runtimeTool) runtimeTool.injectContext({ currentChatId: chatId });
  
  const response = await agent.chat({ 
    message: msg.text + `\n[System: You can use 'runtime_eval' and variables 'bot' and 'currentChatId'. Example: await bot.sendVideo(currentChatId, 'url')]`,
    sessionId: `tg-user-${msg.from.id}`
  });
  
  if (response.content) bot.sendMessage(chatId, response.content);
});

🎨 Event-Driven Media with SendMediaTool

Don't want to give the AI execution access? No problem. Use the built-in SendMediaTool combined with Astrive's Event Emitter to capture AI media intent.

// The AI will automatically trigger this event when it wants to deliver media (like downloaded videos/images)
agent.events.on('media:send', async (data) => {
  // data contains: { sessionId, mediaType, url, caption }
  
  // You just handle the delivery for your specific platform!
  if (data.mediaType === 'video') {
     await myPlatform.sendVideo(data.sessionId, data.url, data.caption);
  }
});

📦 Extending the SDK (Plugins)

You can build plugins to extend the capabilities of Astrive AI.

import { IPlugin, AstriveAI } from '@astrive-ai/sdk';

class MyCustomPlugin implements IPlugin {
  name = 'my-custom-plugin';
  version = '1.0.0';

  async install(agent: AstriveAI): Promise<void> {
    // Add custom tools, modify configurations, or listen to events
    agent.tool(new MyCustomTool());
  }
}

agent.addPlugin(new MyCustomPlugin());

📝 License

MIT License