AgentSea

Package

@lov3kaizen/agentsea-crews

Multi-agent orchestration for building teams of AI agents that work through a shared list of tasks.

v1.2.1On npm

01Install

Install from npm into your project.

BASH
npm install @lov3kaizen/agentsea-crews

02Example

TS
import { createCrew, type CrewConfig, type RoleConfig } from '@lov3kaizen/agentsea-crews';

const researcherRole: RoleConfig = {
  name: 'Researcher', description: 'Expert at finding and synthesizing information',
  capabilities: [{ name: 'web-search', description: 'Searches the web for sources', proficiency: 'expert' }],
  goals: ['Find accurate information'],
  systemPrompt: 'You are a skilled researcher...',
};
const config: CrewConfig = {
  name: 'my-crew',
  agents: [{ name: 'researcher', role: researcherRole, model: 'claude-sonnet-4-6', provider: 'anthropic' }],
  delegationStrategy: 'best-match',
};
const crew = createCrew(config);
crew.addTask({ description: 'Research AI trends', expectedOutput: 'Summary of AI trends', priority: 'high' });
console.log((await crew.kickoff()).finalOutput);

03Key API

createCrew(config)
Creates a crew from roles and agents.
crew.addTask({ description, expectedOutput, priority })
Adds a task for the crew to work on.
crew.kickoff(options?)
Runs the tasks and returns the final output.
CrewConfig.delegationStrategy
One of round-robin, best-match, auction, hierarchical or consensus.
createResearchCrew / createWritingCrew / createCodeReviewCrew / createCustomerSupportCrew
Prebuilt crew templates.

04Caveats

  • Default execution calls real models through @lov3kaizen/agentsea-core. Set a provider key such as ANTHROPIC_API_KEY.
  • mock: true returns fixed responses with no network calls, which suits tests.
  • With maxConcurrentTasks above 1, events from different tasks interleave. A task that fails after retries stops new tasks from starting.
  • @lov3kaizen/agentsea-core is a required peer dependency.

05Execution model

Crew agents run against a real LLM by default. The default executor loads @lov3kaizen/agentsea-core on first use and calls the provider named in each agent config. Three options change that.

mock: true
Deterministic output with no provider SDK, network access or API key. Use it in tests.
provider
A pre-built CoreLLMProvider, for dependency injection or a test double. Ignored when execute or mock is set.
execute
A custom function that receives the task input and the agent's system prompt. It takes precedence over the default executor.
TS
import { createCrew, type CoreLLMProvider } from '@lov3kaizen/agentsea-crews';

const testProvider: CoreLLMProvider = {
  async generateResponse(messages, config) {
    return { content: 'deterministic response', usage: { inputTokens: 10, outputTokens: 5 } };
  },
};

const crew = createCrew({
  name: 'my-crew',
  agents: [/* ... */],
  delegationStrategy: 'best-match',
  provider: testProvider,
});

Note

The default executor covers anthropic, openai, gemini and ollama. Any other provider needs a custom execute function.

06Delegation strategies

round-robin
Cycle through agents in turn.
best-match
Match each task to the agent whose capabilities fit best.
auction
Agents bid on tasks based on their confidence.
hierarchical
A manager delegates to workers.
consensus
Agents vote on which one takes a task.

07Roles and capabilities

A role says what an agent is and what it can do. Each capability has a name, a description and a proficiency of novice, intermediate, expert or master.

TS
import type { RoleConfig } from '@lov3kaizen/agentsea-crews';

const role: RoleConfig = {
  name: 'Security Analyst',
  description: 'Expert at identifying security vulnerabilities',
  capabilities: [
    { name: 'vulnerability-detection', description: 'Finds security flaws in code', proficiency: 'expert' },
    { name: 'secure-coding', description: 'Writes code that avoids common flaws', proficiency: 'intermediate' },
  ],
  systemPrompt: 'You are a security expert...',
  goals: ['Identify vulnerabilities', 'Ensure secure code'],
  constraints: ['Flag all security concerns'],
};

08Prebuilt templates

Each template returns a configured crew. Pass options to tune it.

createResearchCrew({ depth, includeWriter })
A research crew. depth is shallow, standard or deep. ResearchTasks.research(topic, depth) builds its task.
createWritingCrew(options)
A crew for drafting written output.
createCodeReviewCrew({ languages, includeSecurity })
A code review crew for the listed languages.
createCustomerSupportCrew({ productName, companyName })
A support crew for a named product.
TS
import { createResearchCrew, ResearchTasks } from '@lov3kaizen/agentsea-crews';

const crew = createResearchCrew({ depth: 'deep', includeWriter: true });
crew.addTask(ResearchTasks.research('electric vehicles', 'deep'));
const result = await crew.kickoff();