AgentSea

Getting started

Getting started

Install the AgentSea packages, then run an agent against a cloud model or a local model served by Ollama.

01Install

The core package holds the Agent, provider, tool and memory classes. The CLI package installs a command named sea.

AgentSea needs Node.js 20 or later. TypeScript 5.0 or later is recommended.

BASH
pnpm add @lov3kaizen/agentsea-core
pnpm add -g @lov3kaizen/agentsea-cli

Note

The installed command is sea. Use sea in every command.

02Cloud quick start (Anthropic)

Set ANTHROPIC_API_KEY in your environment. AnthropicProvider uses it when no key is passed to the constructor.

Save the file as hello.ts and run it with npx tsx hello.ts.

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

const agent = new Agent(
  { name: 'assistant', description: 'General assistant', model: 'claude-opus-4-8', provider: 'anthropic' },
  new AnthropicProvider(process.env.ANTHROPIC_API_KEY),
  new ToolRegistry(),
);

const response = await agent.execute('Hello!', { conversationId: 'user-123', sessionData: {}, history: [] });
console.log(response.content);

03Local quick start (Ollama)

Install Ollama, start its server, and pull a model. The sea CLI can also pull models with sea model pull llama2.

OllamaProvider reads OLLAMA_BASE_URL. When that variable is not set, it uses http://localhost:11434.

BASH
# Terminal 1
ollama serve

# Terminal 2
ollama pull llama2

04Local agent

Pass the provider to the Agent constructor. The model name must match a model that Ollama has pulled.

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

const agent = new Agent(
  { name: 'local-assistant', description: 'Local assistant', model: 'llama2', provider: 'ollama' },
  new OllamaProvider({ baseUrl: 'http://localhost:11434' }),
  new ToolRegistry(),
);

const response = await agent.execute('What are three benefits of running models locally?', { conversationId: 'conv-1', sessionData: {}, history: [] });
console.log(response.content);

Warning

Do not call agent.registerProvider. Pass the provider to the Agent constructor, as shown here.

05First agent with a tool

A tool has a name, a description, a Zod schema for its parameters, and an execute function.

Register the tool in a ToolRegistry so the agent can run it. List the tool in config.tools so the model is told that it exists.

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

const tools = new ToolRegistry();
tools.register(calculatorTool);

const agent = new Agent(
  { name: 'math', description: 'Arithmetic helper', model: 'claude-opus-4-8', provider: 'anthropic', tools: [calculatorTool] },
  new AnthropicProvider(process.env.ANTHROPIC_API_KEY),
  tools,
);

const response = await agent.execute('What is 42 * 58?', { conversationId: 'math-1', sessionData: {}, history: [] });
console.log(response.content);

06Next steps

Run sea code for an interactive coding session. It uses 13 built-in coding tools and accepts --provider, --model and --verbose.

  • Concepts: agents, providers, tools, memory, crews, guardrails and observability.
  • Changelog: the v0.6.0 release notes.
  • Providers: setup for each supported provider.
  • Local models: running agents on Ollama and other local servers.
  • CLI reference: all sea commands and options.