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/coreUsage
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(): stringgetDescription(): string | undefinedgetVersion(): string | undefinedgetMetadata(): AgentMetadata
Types
AgentInput: The input type for agent executionAgentOutput: The output type for agent executionAgentError: Standardized error typeAgentMetadata: 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 formatLicense
MIT