@agentage/core
v0.1.0
Published
Core types and interfaces for AgentKit - the simple SDK for building AI agents in Node.js
Downloads
111
Readme
@agentage/core
Core types and interfaces for AgentKit - the simple SDK for building AI agents in Node.js.
Installation
npm install @agentage/coreUsage
import type {
Agent,
AgentConfig,
AgentResponse,
Tool,
ModelConfig,
ModelProvider,
Model,
SupportedModel,
Message,
Result,
ConfigEntry,
RuntimeConfig,
EnvironmentConfig
} from '@agentage/core';
// Example: Result type usage
const divide = (a: number, b: number): Result<number, string> => {
if (b === 0) {
return { ok: false, error: 'Division by zero' };
}
return { ok: true, data: a / b };
};
// Example: ModelProvider implementation
const myProvider: ModelProvider = {
name: 'my-provider',
getSupportedModels: () => [
{
name: 'my-model',
capabilities: { streaming: true, functionCalling: true }
}
],
getModel: (name, config) => ({
name,
send: async (request) => ({ content: 'response' })
}),
supportsModel: (name) => name === 'my-model'
};Included Types
Agent Types
Agent- Agent interface with builder patternAgentConfig- Agent configuration objectAgentResponse- Agent execution response
Message Types
Message- Union of all message typesSystemMessage- System instructionsUserMessage- User inputAssistantMessage- Assistant responseToolMessage- Tool execution result
Tool Types
Tool<TParams, TResult>- Tool definition with type inferenceToolSchema<T>- Schema validator (Zod-compatible)InferSchemaType<TSchema>- Automatic type inference from schema
Model Types
ModelConfig- Model configuration optionsModelDefinition- Model with configurationModelProvider- Model provider adapter interfaceModel- Model interface for send/stream operationsSupportedModel- Model information with capabilitiesModelRequest- Request to model providerModelResponse- Response from model provider
Config Types
ConfigEntry- Configuration entry with key, value, and optional scopeRuntimeConfig- Runtime configuration with entriesEnvironmentConfig- Environment and API configuration
Result Types
Result<T, E>- Functional error handling union typeSuccess<T>- Success result withok: trueanddata: TFailure<E>- Failure result withok: falseanderror: E
Utility Types
InferSchemaType<TSchema>- Automatic type inference from schema
Philosophy
- Type-safe: Zero
anytypes, all explicit - Functional: Composable, immutable types
- Simple: Easy to understand and extend
- Powerful: Type inference from schemas
Related Packages
@agentage/sdk- Main SDK implementation@agentage/cli- CLI tool for managing agents
License
MIT
