Installation
Get started with AgentSea in your project
Prerequisites
Before installing AgentSea, ensure you have the following:
- Node.js: Version 18.0.0 or higher
- Package Manager: npm, pnpm, or yarn
- TypeScript: Version 5.0.0 or higher (recommended)
Core Package
Install the core AgentSea package using your preferred package manager:
bash
# Using pnpm (recommended)
pnpm add @lov3kaizen/agentsea-core
# Using npm
npm install @lov3kaizen/agentsea-core
# Using yarn
yarn add @lov3kaizen/agentsea-coreTypes Package
Types are re-exported from @lov3kaizen/agentsea-core, but you can also install the dedicated types package for direct imports: pnpm add @lov3kaizen/agentsea-types
NestJS Integration
If you're using NestJS, install the NestJS integration package:
bash
# Install core and NestJS packages
pnpm add @lov3kaizen/agentsea-core @lov3kaizen/agentsea-nestjs
# Install peer dependencies
pnpm add @nestjs/common @nestjs/core reflect-metadata rxjsAPI Keys
You'll need API keys from your chosen LLM provider:
Anthropic Claude
- Sign up at console.anthropic.com
- Navigate to API Keys section
- Create a new API key
- Set the environment variable:
bash
export ANTHROPIC_API_KEY=your_api_key_hereOpenAI
- Sign up at platform.openai.com
- Navigate to API Keys section
- Create a new API key
- Set the environment variable:
bash
export OPENAI_API_KEY=your_api_key_hereEnvironment Variables
Create a .env file in your project root:
env
# LLM Provider API Keys
ANTHROPIC_API_KEY=your_anthropic_key
OPENAI_API_KEY=your_openai_key
# Optional: Redis for persistent memory
REDIS_URL=redis://localhost:6379
# Optional: Observability
LOG_LEVEL=info
ENABLE_TRACING=trueVerify Installation
Create a simple test file to verify your installation:
typescript
import { Agent, AnthropicProvider, ToolRegistry } from '@lov3kaizen/agentsea-core';
import type { AgentConfig, AgentContext } from '@lov3kaizen/agentsea-types';
const agent = new Agent(
{
name: 'test-agent',
model: 'claude-sonnet-4-20250514',
provider: 'anthropic',
systemPrompt: 'You are a helpful assistant.',
},
new AnthropicProvider(process.env.ANTHROPIC_API_KEY),
new ToolRegistry(),
);
const response = await agent.execute('Hello!', {
conversationId: 'test-123',
sessionData: {},
history: [],
});
console.log(response.content);Run the file:
bash
# If using TypeScript
tsx test.ts
# If using Node.js with ES modules
node test.jsTypeScript Configuration
For TypeScript projects, update your tsconfig.json:
json
{
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "node",
"esModuleInterop": true,
"strict": true,
"skipLibCheck": true,
"resolveJsonModule": true
}
}Next Steps
Important
Never commit API keys to version control. Always use environment variables and add .env to your .gitignore file.