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

carrot-ai

v1.2.1

Published

Agentic AI SDK for Llama via AWS Bedrock with built-in retries and fallbacks.

Readme

🥕 Carrot AI

npm version License: MIT

Carrot AI is a premium, agentic AI SDK designed for high-performance Llama applications. It seamlessly bridges AWS Bedrock and Ollama, providing a unified, carrot-themed interface for streaming, parallel tool execution, and advanced memory management.

✨ Features

  • 🌊 Real-time Streaming: Use crunchStream() for ultra-low perceived latency responses.
  • Parallel Tooling: Execute multiple tool calls simultaneously via harvest() for zero-delay automation.
  • 🧠 Smart Memory: Built-in ConversationHistory for automatic context pruning and sliding-window memory.
  • 🛡️ Type Safety: Native Zod validation for tool parameters and full TypeScript support.
  • 📊 Audit Ready: Integrated token usage tracking (onUsage) for cost and performance monitoring.
  • 🌍 Cloud & Local: Switch between AWS Bedrock (Cloud) and Ollama (Local) with zero code changes.

🚀 Installation

npm install carrot-ai

🛠️ Quick Start

Basic Chat (Themed as Crunch)

import { CarrotAI } from 'carrot-ai';

const carrot = new CarrotAI({
  provider: 'bedrock',
  bedrock: { region: 'us-east-1' }
});

const response = await carrot.crunch({
  messages: [{ role: 'user', content: 'What is the most nutritious vegetable?' }],
  systemInstruction: 'Highlight carrots in your answer.'
});

console.log(response.content);

Local Dev (Ollama)

const carrot = new CarrotAI({
  provider: 'ollama' 
});

const response = await carrot.crunch({
  messages: [{ role: 'user', content: 'Hello from local Llama!' }],
  model: 'llama3'
});

🛠️ Local Setup (Ollama)

  1. Install Ollama: Download from ollama.com.
  2. Download Model: Run ollama pull llama3 in your terminal.
  3. Run: Ensure Ollama is running on your machine (it starts automatically on port 11434).

Real-time Streaming

for await (const chunk of carrot.crunchStream({
  messages: [{ role: 'user', content: 'Tell me a long story about a golden carrot.' }]
})) {
  if (chunk.type === 'content') {
    process.stdout.write(chunk.content);
  }
}

🧠 Advanced: Agents & Memory

Carrot AI Agents are autonomous and can use tools to perform complex tasks.

import { CarrotAgent, tool, ConversationHistory } from 'carrot-ai';
import { z } from 'zod';

const weatherTool = tool({
  name: 'get_weather',
  description: 'Get weather for a city',
  parameters: z.object({ city: z.string() }),
  execute: async ({ city }) => ({ temp: '24°C', city }),
});

const agent = new CarrotAgent({
  tools: [weatherTool],
  memory: new ConversationHistory({ maxMessages: 20 }),
  systemPrompt: 'You are a helpful travel assistant.'
});

const result = await agent.harvest('What is the weather in Paris?');
console.log(result);

📊 Observability & Auditing

Track your token usage in real-time:

const carrot = new CarrotAI({
  provider: 'bedrock',
  onUsage: (usage) => {
    console.log(`Input: ${usage.inputTokens}, Output: ${usage.outputTokens}`);
  }
});

🛡️ Error Handling

We provide specific error classes for robust application building:

import { CarrotAuthError, CarrotRateLimitError } from 'carrot-ai';

try {
  await carrot.crunch({ ... });
} catch (error) {
  if (error instanceof CarrotAuthError) {
    console.error('Invalid AWS Credentials');
  } else if (error instanceof CarrotRateLimitError) {
    console.error('Slow down! Rate limit reached.');
  }
}

📜 License

MIT © Himanshu Mamgain