JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 17
  • Score
    100M100P100Q70436F
  • License MIT

Core functionality for AgentDAO

Package Exports

  • @agentdao/core
  • @agentdao/core/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@agentdao/core) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@agentdao/core

Core functionality for AgentDAO.

Installation

npm install @agentdao/core
# or
yarn add @agentdao/core
# or
pnpm add @agentdao/core

Usage

import { Agent } from '@developersagentdao/core';

// Create a new agent
const agent = new Agent({
  name: 'my-agent',
  description: 'A custom agent',
  version: '1.0.0',
  handler: async (input) => {
    // Process the input
    return { result: 'success' };
  },
});

// Execute the agent
try {
  const result = await agent.execute({ query: 'test' });
  console.log(result);
} catch (error) {
  console.error('Agent execution failed:', error);
}

Features

  • Type-safe agent creation and execution
  • Input and output validation
  • Error handling with standardized error types
  • Metadata tracking
  • Extensible architecture

API Reference

Agent

The main class for creating and executing agents.

Constructor

new Agent(config: AgentConfig)

Configuration

interface AgentConfig {
  name: string;
  handler: (input: AgentInput) => Promise<AgentOutput>;
  description?: string;
  version?: string;
  validateInput?: (input: AgentInput) => boolean;
  validateOutput?: (output: AgentOutput) => boolean;
}

Methods

  • execute(input: AgentInput): Promise<AgentOutput>
  • getName(): string
  • getDescription(): string | undefined
  • getVersion(): string | undefined
  • getMetadata(): AgentMetadata

Types

  • AgentInput: The input type for agent execution
  • AgentOutput: The output type for agent execution
  • AgentError: Standardized error type
  • AgentMetadata: Agent metadata including creation and update timestamps

Development

# Install dependencies
pnpm install

# Run tests
pnpm test

# Build the package
pnpm build

# Run linting
pnpm lint

# Format code
pnpm format

License

MIT