AgentSea

Concept

Local and open source providers

Run AgentSea agents against models on your own machine or server, for privacy, cost control, offline use or development.

01Why local providers

  • Privacy: data stays on your infrastructure.
  • Cost: no per-token API charges.
  • Latency: no network round trip to a hosted API.
  • Offline use: works without an internet connection once the model is installed.
  • Control: choose the model, the version and where it runs.

02Ollama

The simplest way to run local models. Install Ollama, start the server and pull a model:

BASH
# Start the server
ollama serve

# Pull a model
ollama pull llama3.2
TS
import { Agent, OllamaProvider, ToolRegistry } from '@lov3kaizen/agentsea-core';

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

const toolRegistry = new ToolRegistry();

const agent = new Agent(
  {
    name: 'local-assistant',
    description: 'Runs locally on Ollama',
    model: 'llama3.2',
    provider: 'ollama',
    systemPrompt: 'You are a helpful AI assistant running locally.',
    temperature: 0.7,
  },
  provider,
  toolRegistry,
);

const response = await agent.execute('What are the benefits of running AI models locally?', {
  conversationId: 'local-demo',
  sessionData: {},
  history: [],
});

console.log(response.content);

Popular models include llama3.2, llama3, mistral, gemma2, qwen2.5, codellama and phi3.

The provider also exposes listModels() and pullModel(name).

03LM Studio

A desktop app with a model browser and a built-in OpenAI-compatible server. Download a model in the app, start the local server, then point AgentSea at it.

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

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

const agent = new Agent(
  {
    name: 'lm-studio-agent',
    description: 'Runs on LM Studio',
    model: 'local-model', // the model you loaded in LM Studio
    provider: 'openai-compatible',
    systemPrompt: 'You are a helpful assistant.',
  },
  provider,
  new ToolRegistry(),
);

04LocalAI

A self-hosted, OpenAI-compatible server.

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

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

05Text Generation WebUI

A web interface for running models, with an OpenAI-compatible API.

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

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

06vLLM

An inference engine for serving models at higher request volume. Start a vLLM OpenAI-compatible server by following the vLLM documentation, then connect to it:

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

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

07Other OpenAI-compatible servers

Any server that implements the OpenAI chat API can be used through OpenAICompatibleProvider. This includes Jan. baseUrl is required, and apiKey is optional.

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

const provider = new OpenAICompatibleProvider({
  baseUrl: 'http://localhost:1337/v1', // your server's base URL
  apiKey: process.env.LOCAL_API_KEY, // only if the server requires one
});

08Provider reference

OllamaProvider({ baseUrl?, timeout? })
Default http://localhost:11434. Reads OLLAMA_BASE_URL when no base URL is passed.
LMStudioProvider({ baseUrl? })
Default http://localhost:1234/v1.
LocalAIProvider({ baseUrl? })
Default http://localhost:8080/v1.
TextGenerationWebUIProvider({ baseUrl? })
Default http://localhost:5000/v1.
VLLMProvider({ baseUrl? })
Default http://localhost:8000/v1.
OpenAICompatibleProvider({ baseUrl, apiKey? })
Any OpenAI-compatible server. baseUrl is required.

Note

The other providers take their base URL from the constructor only. Pass baseUrl explicitly so the target is clear in your code.

09Troubleshooting

  • Connection refused: check that the server is running and that the port in baseUrl matches it. For Ollama, run curl http://localhost:11434.
  • Model not found: the model field must match a model the server has loaded or pulled.
  • Slow responses: try a smaller or more heavily quantized model, and check that the server is using your GPU.

10Next steps