Skip to content

Unite and orchestrate AI agents. A production-ready ADK for building full-stack, agentic AI solutions with multi-provider support.

License

Notifications You must be signed in to change notification settings

lovekaizen/agentsea

Repository files navigation

AgentSea

Unite and orchestrate AI agents - A production-ready ADK for building agentic AI applications in Node.js.

AgentSea ADK unites AI agents and services to create powerful, intelligent applications and integrations.

npm version License: MIT TypeScript Node.js Version

✨ Features

  • πŸ€– Multi-Provider Support - Anthropic Claude, OpenAI GPT, Google Gemini
  • 🎯 Per-Model Type Safety - Compile-time validation of model-specific options
  • 🏠 Local & Open Source Models - Ollama, LM Studio, LocalAI, Text Generation WebUI, vLLM
  • πŸŽ™οΈ Voice Support (TTS/STT) - OpenAI Whisper, ElevenLabs, Piper TTS, Local Whisper
  • πŸ”— MCP Protocol - First-class Model Context Protocol integration
  • πŸ›’ ACP Protocol - Agentic Commerce Protocol for e-commerce integration
  • πŸ”„ Multi-Agent Crews - Role-based coordination with delegation strategies
  • πŸ’¬ Conversation Schemas - Structured conversational experiences with validation
  • 🧠 Advanced Memory - Episodic, semantic, and working memory with multi-agent sharing
  • πŸ”§ Built-in Tools - 8 production-ready tools + custom tool support
  • πŸ›‘οΈ Guardrails - Content safety, prompt injection detection, PII filtering, and validation
  • πŸ“Š LLM Evaluation - Metrics, LLM-as-Judge, human feedback, and continuous monitoring
  • 🌐 LLM Gateway - OpenAI-compatible API with intelligent routing, caching, and cost optimization
  • πŸ” Embeddings - Multi-provider embeddings with caching and quality metrics
  • πŸ“ Structured Output - TypeScript-native Zod schema enforcement for LLM responses
  • πŸ“₯ Document Ingestion - Flexible pipeline with parsers, chunkers, and transformers
  • 🌐 Browser Automation - Web agents with Playwright, Puppeteer, and native backends
  • πŸ“ˆ Full Observability - Logging, metrics, distributed tracing, and cost tracking
  • 🎯 NestJS Integration - Decorators, modules, and dependency injection
  • 🌐 REST API & Streaming - HTTP endpoints, SSE streaming, WebSocket support
  • πŸš€ Production Ready - Rate limiting, caching, error handling, retries
  • πŸ“˜ TypeScript - Fully typed with comprehensive definitions

πŸš€ Quick Start

Installation

# Core package (framework-agnostic)
pnpm add @lov3kaizen/agentsea-core

# NestJS integration
pnpm add @lov3kaizen/agentsea-nestjs

Basic Agent

import {
  Agent,
  AnthropicProvider,
  ToolRegistry,
  BufferMemory,
  calculatorTool,
} from '@lov3kaizen/agentsea-core';

// Create agent
const agent = new Agent(
  {
    name: 'assistant',
    model: 'claude-sonnet-4-20250514',
    provider: 'anthropic',
    systemPrompt: 'You are a helpful assistant.',
    tools: [calculatorTool],
  },
  new AnthropicProvider(process.env.ANTHROPIC_API_KEY),
  new ToolRegistry(),
  new BufferMemory(50),
);

// Execute
const response = await agent.execute('What is 42 * 58?', {
  conversationId: 'user-123',
  sessionData: {},
  history: [],
});

console.log(response.content);

Multi-Provider Support

import {
  Agent,
  GeminiProvider,
  OpenAIProvider,
  AnthropicProvider,
  OllamaProvider,
  LMStudioProvider,
  LocalAIProvider,
} from '@lov3kaizen/agentsea-core';

// Use Gemini
const geminiAgent = new Agent(
  { model: 'gemini-pro', provider: 'gemini' },
  new GeminiProvider(process.env.GEMINI_API_KEY),
  toolRegistry,
);

// Use OpenAI
const openaiAgent = new Agent(
  { model: 'gpt-4-turbo-preview', provider: 'openai' },
  new OpenAIProvider(process.env.OPENAI_API_KEY),
  toolRegistry,
);

// Use Anthropic
const claudeAgent = new Agent(
  { model: 'claude-sonnet-4-20250514', provider: 'anthropic' },
  new AnthropicProvider(process.env.ANTHROPIC_API_KEY),
  toolRegistry,
);

// Use Ollama (local)
const ollamaAgent = new Agent(
  { model: 'llama2', provider: 'ollama' },
  new OllamaProvider(),
  toolRegistry,
);

// Use LM Studio (local)
const lmstudioAgent = new Agent(
  { model: 'local-model', provider: 'openai-compatible' },
  new LMStudioProvider(),
  toolRegistry,
);

// Use LocalAI (local)
const localaiAgent = new Agent(
  { model: 'gpt-3.5-turbo', provider: 'openai-compatible' },
  new LocalAIProvider(),
  toolRegistry,
);

Per-Model Type Safety

Get compile-time validation for model-specific options. Inspired by TanStack AI:

import { anthropic, openai, createProvider } from '@lov3kaizen/agentsea-core';

// βœ… Valid: Claude 3.5 Sonnet supports tools, system prompts, and extended thinking
const claudeConfig = anthropic('claude-3-5-sonnet-20241022', {
  tools: [myTool],
  systemPrompt: 'You are a helpful assistant',
  thinking: { type: 'enabled', budgetTokens: 10000 },
  temperature: 0.7,
});

// βœ… Valid: o1 supports tools but NOT system prompts
const o1Config = openai('o1', {
  tools: [myTool],
  reasoningEffort: 'high',
  // systemPrompt: '...' // ❌ TypeScript error - o1 doesn't support system prompts
});

// ❌ TypeScript error: o1-mini doesn't support tools
const o1MiniConfig = openai('o1-mini', {
  // tools: [myTool], // Error: 'tools' does not exist in type
  reasoningEffort: 'medium',
});

// Create type-safe providers
const provider = createProvider(claudeConfig);
console.log('Supports vision:', provider.supportsCapability('vision')); // true

Key Benefits:

  • Zero runtime overhead - All validation at compile time
  • IDE autocomplete - Only valid options appear per model
  • Model capability registry - Query what each model supports

See full per-model type safety documentation β†’

Local Models & Open Source

Run AI models on your own hardware with complete privacy:

import { Agent, OllamaProvider } from '@lov3kaizen/agentsea-core';

// Create Ollama provider
const provider = new OllamaProvider({
  baseUrl: 'http://localhost:11434',
});

// Pull a model (if not already available)
await provider.pullModel('llama2');

// List available models
const models = await provider.listModels();
console.log('Available models:', models);

// Create agent with local model
const agent = new Agent({
  name: 'local-assistant',
  description: 'AI assistant running locally',
  model: 'llama2',
  provider: 'ollama',
  systemPrompt: 'You are a helpful assistant.',
});

agent.registerProvider('ollama', provider);

// Use the agent
const response = await agent.execute('Hello!', {
  conversationId: 'conv-1',
  sessionData: {},
  history: [],
});

Supported local providers:

  • Ollama - Easy local LLM execution
  • LM Studio - User-friendly GUI for local models
  • LocalAI - OpenAI-compatible local API
  • Text Generation WebUI - Feature-rich web interface
  • vLLM - High-performance inference engine
  • Any OpenAI-compatible endpoint

See full local models documentation β†’

Voice Capabilities

Add voice interaction with Text-to-Speech and Speech-to-Text:

import {
  Agent,
  AnthropicProvider,
  ToolRegistry,
  VoiceAgent,
  OpenAIWhisperProvider,
  OpenAITTSProvider,
} from '@lov3kaizen/agentsea-core';

// Create base agent
const provider = new AnthropicProvider(process.env.ANTHROPIC_API_KEY);
const toolRegistry = new ToolRegistry();

const agent = new Agent(
  {
    name: 'voice-assistant',
    model: 'claude-sonnet-4-20250514',
    provider: 'anthropic',
    systemPrompt: 'You are a helpful voice assistant.',
    description: 'Voice assistant',
  },
  provider,
  toolRegistry,
);

// Create voice agent with STT and TTS
const sttProvider = new OpenAIWhisperProvider(process.env.OPENAI_API_KEY);
const ttsProvider = new OpenAITTSProvider(process.env.OPENAI_API_KEY);

const voiceAgent = new VoiceAgent(agent, {
  sttProvider,
  ttsProvider,
  ttsConfig: { voice: 'nova' },
});

// Process voice input
const result = await voiceAgent.processVoice(audioBuffer, context);
console.log('User said:', result.text);
console.log('Assistant response:', result.response.content);

// Save audio response
fs.writeFileSync('./response.mp3', result.audio!);

Supported providers:

  • STT: OpenAI Whisper, Local Whisper
  • TTS: OpenAI TTS, ElevenLabs, Piper TTS

See full voice documentation β†’

MCP Integration

import { MCPRegistry } from '@lov3kaizen/agentsea-core';

// Connect to MCP servers
const mcpRegistry = new MCPRegistry();

await mcpRegistry.addServer({
  name: 'filesystem',
  command: 'npx',
  args: ['-y', '@modelcontextprotocol/server-filesystem', '/tmp'],
  transport: 'stdio',
});

// Get MCP tools (automatically converted)
const mcpTools = mcpRegistry.getTools();

// Use with agent
const agent = new Agent({ tools: mcpTools }, provider, toolRegistry);

ACP Commerce Integration

Add e-commerce capabilities to your agents with the Agentic Commerce Protocol:

import { ACPClient, createACPTools, Agent } from '@lov3kaizen/agentsea-core';

// Setup ACP client
const acpClient = new ACPClient({
  baseUrl: 'https://api.yourcommerce.com/v1',
  apiKey: process.env.ACP_API_KEY,
  merchantId: process.env.ACP_MERCHANT_ID,
});

// Create commerce tools
const acpTools = createACPTools(acpClient);

// Create shopping agent
const shoppingAgent = new Agent(
  {
    name: 'shopping-assistant',
    model: 'claude-sonnet-4-20250514',
    provider: 'anthropic',
    systemPrompt: 'You are a helpful shopping assistant.',
    tools: acpTools, // Includes 14 commerce tools
  },
  provider,
  toolRegistry,
);

// Start shopping
const response = await shoppingAgent.execute(
  'I need wireless headphones under $100',
  context,
);

Available Commerce Operations:

  • Product search and discovery
  • Shopping cart management
  • Checkout and payment processing
  • Delegated payments (Stripe, PayPal, etc.)
  • Order tracking and management

See full ACP documentation β†’

Conversation Schemas

import { ConversationSchema } from '@lov3kaizen/agentsea-core';
import { z } from 'zod';

const schema = new ConversationSchema({
  name: 'booking',
  startStep: 'destination',
  steps: [
    {
      id: 'destination',
      prompt: 'Where would you like to go?',
      schema: z.object({ city: z.string() }),
      next: 'dates',
    },
    {
      id: 'dates',
      prompt: 'What dates?',
      schema: z.object({
        checkIn: z.string(),
        checkOut: z.string(),
      }),
      next: 'confirm',
    },
  ],
});

With CLI

# Install CLI globally
npm install -g @lov3kaizen/agentsea-cli

# Initialize configuration
sea init

# Start chatting
sea chat

# Run an agent
sea agent run default "What is the capital of France?"

# Manage models (Ollama)
sea model pull llama2
sea model list

See CLI documentation β†’

With NestJS

import { Module } from '@nestjs/common';
import { AgenticModule } from '@lov3kaizen/agentsea-nestjs';
import { AnthropicProvider } from '@lov3kaizen/agentsea-core';

@Module({
  imports: [
    AgenticModule.forRoot({
      provider: new AnthropicProvider(),
      defaultConfig: {
        model: 'claude-sonnet-4-20250514',
        provider: 'anthropic',
      },
      enableRestApi: true, // Enable REST API endpoints
      enableWebSocket: true, // Enable WebSocket gateway
    }),
  ],
})
export class AppModule {}

REST API Endpoints:

  • GET /agents - List all agents
  • GET /agents/:name - Get agent details
  • POST /agents/:name/execute - Execute agent
  • POST /agents/:name/stream - Stream agent response (SSE)

WebSocket Events:

  • execute - Execute an agent
  • stream - Real-time streaming events
  • listAgents - Get available agents
  • getAgent - Get agent info

See API documentation β†’

πŸ“¦ Packages

Core Packages

Agent Orchestration

Memory & Retrieval

Data Processing

Safety & Evaluation

Observability & Operations

Automation

UI

Examples

πŸ—οΈ Architecture

AgentSea follows a clean, layered architecture:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚         Application Layer               β”‚
β”‚  (Your NestJS/Node.js Application)      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                    β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚         AgentSea ADK Layer               β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚  β”‚  Multi-Agent Orchestration      β”‚    β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚  β”‚  Conversation Management        β”‚    β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚  β”‚  Agent Runtime & Tools          β”‚    β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚  β”‚  Multi-Provider Adapters        β”‚    β”‚
β”‚  β”‚  (Claude, GPT, Gemini, MCP)     β”‚    β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚  β”‚  Observability & Utils          β”‚    β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                    β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚         Infrastructure Layer            β”‚
β”‚  (LLM APIs, Storage, Monitoring)        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

🎯 Core Concepts

Agents

Autonomous AI entities that can reason, use tools, and maintain conversation context.

Crews

Multi-agent teams with defined roles, delegation strategies, and coordinated task execution.

Tools

Functions that agents can call to perform specific tasks (API calls, calculations, etc.).

Memory

Hierarchical memory system with episodic, semantic, and working memory structures. Supports multi-agent sharing with access control.

Guardrails

Input validation, output filtering, and safety checks to ensure responsible AI behavior.

Evaluation

LLM-as-Judge, human feedback collection, and continuous monitoring for quality assurance.

Gateway

OpenAI-compatible API gateway with intelligent routing, load balancing, and fallback handling.

MCP

Model Context Protocol integration for seamless tool and resource integration.

Conversation Schemas

Define structured conversation flows with validation and dynamic routing.

πŸ“š Documentation

Full documentation available at agentsea.dev

Getting Started

Core Concepts

Package Documentation

Integrations

Operations

πŸ› οΈ Development

# Install dependencies
pnpm install

# Build all packages
pnpm build

# Run tests
pnpm test

# Run tests with coverage
pnpm test:cov

# Development mode (watch)
pnpm dev

# Lint
pnpm lint

# Type check
pnpm type-check

βœ… Feature Status

βœ… Completed

  • Multi-provider support (Claude, GPT, Gemini)
  • Local & open source model support (Ollama, LM Studio, LocalAI, etc.)
  • Voice support (TTS/STT) with multiple providers
  • Command-line interface (CLI)
  • MCP protocol integration
  • Multi-agent crews with role-based coordination
  • Delegation strategies (round-robin, best-match, auction, hierarchical)
  • Conversation schema system
  • Advanced memory stores (Buffer, Redis, PostgreSQL, SQLite, Pinecone)
  • Memory structures (Episodic, Semantic, Working)
  • Multi-agent memory sharing with access control
  • LLM Gateway with OpenAI-compatible API, caching, and cost optimization
  • Intelligent routing (round-robin, least-latency, cost-based)
  • Structured output with Zod schema enforcement
  • Document ingestion pipeline with parsers and chunkers
  • Guardrails for content safety, prompt injection, and PII detection
  • Content filtering and validation
  • LLM evaluation metrics and LLM-as-Judge
  • Human feedback collection and preference learning
  • Continuous evaluation monitoring
  • Red teaming and adversarial testing
  • Embeddings with multi-provider support
  • Browser automation (Playwright, Puppeteer, native)
  • Built-in tools (8 tools + custom support)
  • Observability (logging, metrics, tracing)
  • Cost tracking and analytics
  • NestJS integration for all packages
  • React components for agent interfaces
  • Rate limiting and caching
  • Comprehensive test suite
  • TypeScript definitions with strict type safety
  • CI/CD workflows with automated releases

🚧 In Progress

  • Admin UI dashboard improvements
  • Additional MCP tools/servers
  • Enhanced computer use agent capabilities

🀝 Contributing

We welcome contributions! Please see CONTRIBUTING.md for guidelines.

  • πŸ’¬ Discussions - Ask questions and share ideas
  • πŸ› Issues - Report bugs and request features
  • πŸ“– Documentation - Read the full documentation

πŸ“„ License

MIT License - see LICENSE for details

πŸ™ Credits

Built with ❀️ by lovekaizen

Special thanks to:


Website β€’ Documentation β€’ Examples β€’ API Reference

Made with TypeScript and AI πŸ€–