JSPM

  • Created
  • Published
  • Downloads 1008
  • Score
    100M100P100Q101434F
  • License MIT

Minimal TypeScript agent framework inspired by Claude Code architecture

Package Exports

  • @alexnetrebskii/hive-agent

Readme

Hive Agent

npm version CI license TypeScript Discord

Claude Code-like AI agent for your own application. Add a few lines — get a multi-agent system that asks clarifying questions, plans tasks, and works with your data.

Claude Code is impressive: you open a terminal, ask it to code something, and it plans, clarifies, executes. But it's locked to the terminal and local filesystem. What if you need that same intelligence inside your SaaS product, web app, or serverless function — working with your database, your blob storage, your users' data?

Hive gives you exactly that. A powerful, multi-agent framework you plug into your application. Your users get an AI that feels custom-built. You get a library that handles the hard parts.

You Need Hive Agent If

  • You want your own AI agent in your app that codes, manages documents, or works with any workspace you share with it
  • You're building on Firebase, Vercel, AWS Lambda, or any serverless platform — Hive is stateless by design
  • You're building a SaaS and want to give users a smart AI chat without building an agent framework from scratch
  • Your data lives in databases, blob storage, or APIs — not just the local filesystem
  • You want Claude Code-level intelligence but inside a web application, without VMs or infrastructure to manage
  • You don't want to spend time teaching AI how to work well — Hive handles planning, task tracking, clarifying questions, and tool use out of the box

Features

Agent Intelligence

  • Built-in planning & exploration sub-agents — AI plans its work before executing, just like Claude Code
  • Task generation & tracking — AI generates tasks and follows them, showing progress in real time
  • Clarifying questions — AI asks one question or a series of questions when it needs more context
  • Interruption mode — Correct the AI mid-execution if it goes in the wrong direction, just like Claude Code
  • Optimized built-in prompts — Carefully tuned prompts for better results across all providers

Built-in Capabilities

  • Workspace — Like projects in Claude Code. Hive works with workspace files (virtual or real) the same way Claude Code works with your project
  • Large file processing — AI reads files >256KB in chunks, just like Claude Code does
  • Web browsing — Navigate websites, extract data, interact with pages
  • API requests with authentication — Make HTTP requests to external services

Multi-Provider

  • Claude (Anthropic) — First-class support with caching and extended thinking
  • OpenAI — GPT-4o and other models
  • OpenRouter — Access to 100+ models via openrouter.ai, with optimized prompts so non-Claude models use built-in tools effectively
  • Custom providers — Implement the LLMProvider interface to use any AI model

Cost & Performance

  • Prompt caching — Up to 90% cost reduction with Claude's prompt caching
  • Chat history summarization — Automatic summarization of long conversations to stay within context limits
  • Execution tracing — Full cost breakdown per request, per model, per sub-agent

Production-Ready

  • Stateless design — Works in Firebase Functions, AWS Lambda, any serverless environment
  • Conversation history management — Automatic load/save with pluggable repository providers
  • Secrets management — Keep credentials for external systems outside AI context. AI can use them without seeing actual values
  • Interruption & cancellation — AbortController support, Firestore-based stop signals, graceful partial results

Extensibility

  • Custom tools — Define any tool with typed parameters and execution logic
  • Custom sub-agents — Spawn specialized agents with their own tools, prompts, and even different LLM providers
  • Pluggable storage — Bring your own chat history provider (Firestore, Redis, Postgres, anything)
  • Pluggable logging & tracing — Integrate with Datadog, custom dashboards, or any observability platform
  • Pluggable workspaces — Virtual file systems, database-backed storage, or real file system

Hive Agent vs LangChain.js

Hive Agent LangChain.js
Runtime dependencies 1 11+ (core) + per-provider packages
Setup new Hive({ tools, llm }) — one object, done Chains, Runnables, LCEL, Memory, Agents — multiple abstractions to learn
Planning & task tracking Built-in, works out of the box Requires separate @langchain/langgraph package
Clarifying questions Built-in Not included — build your own
Serverless Stateless by design — drop into Lambda/Firebase as-is Requires external state management and architectural changes
Multi-provider Claude, OpenAI, OpenRouter (100+ models), custom 50+ providers via separate packages
Prompt caching Built-in for Claude (up to 90% cost savings) Not built-in
Best for Production apps that need an embedded AI agent Prototyping, RAG pipelines, complex LLM orchestration

When to choose LangChain: You need a massive ecosystem of integrations (vector stores, retrievers, 50+ providers) or are building complex RAG pipelines with many data sources.

When to choose Hive: You want a production-ready agent in your app without the abstraction overhead. One dependency, stateless, works in serverless — and your users get planning, task tracking, and clarifying questions out of the box.

Installation

npm install @alexnetrebskii/hive-agent
pnpm add @alexnetrebskii/hive-agent

Quick Start

import { Hive, ClaudeProvider } from '@alexnetrebskii/hive-agent'

const agent = new Hive({
  systemPrompt: 'You are a helpful assistant.',
  tools: [myTool],
  llm: new ClaudeProvider({ apiKey: process.env.ANTHROPIC_API_KEY })
})

const result = await agent.run('Hello!')
console.log(result.response)

Examples

  • Coder — AI software developer that creates projects from scratch using built-in shell, workspace, planning, and task tracking. Zero custom tools.
  • Eating Consultant — Nutrition assistant with custom tools (OpenFoodFacts API), sub-agents (meal planner), workspace persistence, and run recording.

Documentation

License

MIT