AgentSea

Concept

Providers

AgentSea talks to cloud APIs and local model servers through one provider interface. Mix and match providers per agent.

v1.2.1

01Overview

A provider is the object an agent calls to generate a response. You create it once and pass it to the Agent constructor. The agent's provider config field names the provider it uses.

  • Cloud providers: hosted APIs with pay-per-token pricing. Anthropic, OpenAI, Google Gemini, Mistral, DeepSeek and xAI.
  • Local providers: self-hosted model servers. Ollama, LM Studio, LocalAI, Text Generation WebUI, vLLM, or any OpenAI-compatible endpoint. Data stays on your infrastructure and there are no API costs.
  • Voice providers: speech-to-text and text-to-speech for voice agents.

02Cloud providers

Anthropic (Claude)

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

const provider = new AnthropicProvider(process.env.ANTHROPIC_API_KEY);
const toolRegistry = new ToolRegistry();

const agent = new Agent(
  {
    name: 'claude-agent',
    description: 'Claude-backed assistant',
    model: 'claude-sonnet-4-6',
    provider: 'anthropic',
    temperature: 0.7,
    maxTokens: 4096,
  },
  provider,
  toolRegistry,
);

Models include claude-opus-4-8, claude-opus-4-7, claude-opus-4-6, claude-sonnet-4-6, claude-haiku-4-5 and claude-fable-5. Older generations remain supported. Environment variable: ANTHROPIC_API_KEY.

OpenAI (GPT)

TS
import { Agent, OpenAIProvider, ToolRegistry } from '@lov3kaizen/agentsea-core';

const provider = new OpenAIProvider(process.env.OPENAI_API_KEY);
const toolRegistry = new ToolRegistry();

const agent = new Agent(
  {
    name: 'gpt-agent',
    description: 'OpenAI-backed assistant',
    model: 'gpt-4.1',
    provider: 'openai',
    temperature: 0.8,
    maxTokens: 2048,
  },
  provider,
  toolRegistry,
);

Models include gpt-5, gpt-4.1, gpt-4o, gpt-4o-mini, o3 and o4-mini. Environment variable: OPENAI_API_KEY.

Note

Reasoning models such as o3 and o4-mini accept different options. Per-model type safety checks at compile time which options each model supports.

Google (Gemini)

TS
import { Agent, GeminiProvider, ToolRegistry } from '@lov3kaizen/agentsea-core';

const provider = new GeminiProvider(process.env.GEMINI_API_KEY);
const toolRegistry = new ToolRegistry();

const agent = new Agent(
  {
    name: 'gemini-agent',
    description: 'Gemini-backed assistant',
    model: 'gemini-2.5-flash',
    provider: 'gemini',
    temperature: 0.7,
  },
  provider,
  toolRegistry,
);

Models include gemini-2.5-pro, gemini-2.5-flash, gemini-2.0-flash, gemini-3.5-flash and gemini-3.1-pro-preview. The provider reads GEMINI_API_KEY, or GOOGLE_API_KEY if that is unset, and throws if neither is set.

Mistral, DeepSeek and xAI

Mistral, DeepSeek and xAI (Grok) are part of the provider registry. Each one is created with a config builder and runs over the OpenAI-compatible transport, using its own API key variable.

TS
import { createProvider, mistral, deepseek, xai } from '@lov3kaizen/agentsea-core';

// Mistral: reads MISTRAL_API_KEY
const mistralProvider = createProvider(
  mistral('mistral-large-latest', { tools: [myTool] }),
);

// DeepSeek: reads DEEPSEEK_API_KEY
const deepseekProvider = createProvider(deepseek('deepseek-reasoner'));

// xAI (Grok): reads XAI_API_KEY
const grokProvider = createProvider(xai('grok-3'));
mistral-*
mistral-large-latest, mistral-small-latest, codestral-latest
deepseek-*
deepseek-chat, deepseek-reasoner
grok-*
grok-3, grok-3-fast, grok-3-mini

The config builders are anthropic(), openai(), gemini(), mistral(), deepseek() and xai(). They share one shape, so options are checked against the model you pick. See per-model type safety.

03Local providers

Local providers run models on your own machine or server. They keep data private, have no per-token cost and work offline.

Ollama (recommended)

The simplest way to run models locally. Ollama exposes model listing and pulling through the provider.

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

const provider = new OllamaProvider({
  baseUrl: 'http://localhost:11434', // default
  timeout: 60000, // default
});

// Pull a model, then list what is available
await provider.pullModel('llama3.2');
const models = await provider.listModels();

const toolRegistry = new ToolRegistry();
const agent = new Agent(
  {
    name: 'local-agent',
    description: 'Runs on a local Ollama server',
    model: 'llama3.2',
    provider: 'ollama',
  },
  provider,
  toolRegistry,
);

The base URL can also come from OLLAMA_BASE_URL.

LM Studio

A desktop app with a model browser and a built-in OpenAI-compatible server.

TS
import { Agent, LMStudioProvider, ToolRegistry } from '@lov3kaizen/agentsea-core';

const provider = new LMStudioProvider({
  baseUrl: 'http://localhost:1234/v1', // default
});

const toolRegistry = new ToolRegistry();
const agent = new Agent(
  {
    name: 'lmstudio-agent',
    description: 'Runs on LM Studio',
    model: 'local-model', // the model you loaded in LM Studio
    provider: 'openai-compatible',
  },
  provider,
  toolRegistry,
);

LocalAI

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

const provider = new LocalAIProvider({
  baseUrl: 'http://localhost:8080/v1', // default
});

Text Generation WebUI

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

const provider = new TextGenerationWebUIProvider({
  baseUrl: 'http://localhost:5000/v1', // default
});

vLLM

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

const provider = new VLLMProvider({
  baseUrl: 'http://localhost:8000/v1', // default
});

Jan and other OpenAI-compatible servers

Any server that speaks the OpenAI chat API can be used through OpenAICompatibleProvider. baseUrl is required.

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

// Jan serves an OpenAI-compatible API. Point baseUrl at your Jan server.
const provider = new OpenAICompatibleProvider({
  baseUrl: 'http://localhost:1337/v1',
});

Note

Jan has no dedicated provider class in AgentSea. Use OpenAICompatibleProvider with the server's base URL.

04Voice providers

Speech-to-text and text-to-speech providers for voice-enabled agents:

  • Speech-to-text: OpenAI Whisper, LemonFox STT, Local Whisper
  • Text-to-speech: OpenAI TTS, LemonFox TTS, ElevenLabs, Piper TTS

See the voice guide for setup.

05Provider reference

AnthropicProvider(apiKey?)
Claude. Reads ANTHROPIC_API_KEY when no key is passed.
OpenAIProvider(apiKey?)
GPT and o-series. Reads OPENAI_API_KEY.
GeminiProvider(apiKey?)
Gemini. Reads GEMINI_API_KEY or GOOGLE_API_KEY.
OllamaProvider({ baseUrl?, timeout? })
Ollama. Default http://localhost:11434. Also listModels() and pullModel(name).
LMStudioProvider({ baseUrl? })
LM Studio. Default http://localhost:1234/v1.
LocalAIProvider({ baseUrl? })
LocalAI. Default http://localhost:8080/v1.
TextGenerationWebUIProvider({ baseUrl? })
Text Generation WebUI. Default http://localhost:5000/v1.
VLLMProvider({ baseUrl? })
vLLM. Default http://localhost:8000/v1.
OpenAICompatibleProvider({ baseUrl, apiKey?, timeout? })
Any OpenAI-compatible server. baseUrl is required.
createProvider(config)
Builds a provider from a config builder such as mistral() or xai().

06Choosing a provider

  • Getting started: start with a cloud provider such as Anthropic or OpenAI for quality and easy setup. Use Ollama with llama3.2 for the simplest local setup.
  • Privacy: keep data on your infrastructure with a local provider.
  • Production scale: vLLM serves self-hosted models at high request volume.

Because every provider implements the same interface, you can start on a cloud provider and move to a local one later without changing agent code. Swap the provider instance and the model name.

07Multi-provider setup

Use different providers for different tasks:

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

const toolRegistry = new ToolRegistry();
const context = { conversationId: 'demo', sessionData: {}, history: [] };

// Cloud provider for complex tasks
const researchAgent = new Agent(
  {
    name: 'researcher',
    description: 'Research assistant',
    model: 'claude-sonnet-4-6',
    provider: 'anthropic',
    systemPrompt: 'You are a research assistant.',
  },
  new AnthropicProvider(process.env.ANTHROPIC_API_KEY),
  toolRegistry,
);

// Local provider for simple tasks
const helperAgent = new Agent(
  {
    name: 'helper',
    description: 'Simple local helper',
    model: 'llama3.2',
    provider: 'ollama',
    systemPrompt: 'You are a helpful assistant.',
  },
  new OllamaProvider(),
  toolRegistry,
);

const complexResult = await researchAgent.execute('Analyze this...', context);
const simpleResult = await helperAgent.execute('What is 2+2?', context);

08Next steps