/** * Base agent interface and implementation for the POLARIS framework */ import { Identifiable, Cloneable } from "../../types/common"; import { EvaluationResult } from "../../types/evaluation"; import { GameState } from "../../domains/base/game-state"; import { Action } from "../../domains/base/action"; import { AgentParameters, AgentStatistics } from "./parameters"; import { AgentOutput, AgentPerformanceMetrics } from "../../types/agent-output"; import { PolarisEngineTask, AgentRole, DomainConfig } from "../../types/task"; /** * Core interface that all agents must implement */ export interface Agent extends Identifiable, Cloneable { /** Human-readable name for the agent */ readonly name: string; /** Agent configuration parameters */ readonly parameters: AgentParameters; /** Type identifier for this agent */ readonly type: string; /** Role this agent is playing */ readonly role: AgentRole; /** Task context this agent is operating in */ readonly task: PolarisEngineTask; /** Domain configuration for this agent */ readonly domain: DomainConfig; /** Evaluate a game state and return unified agent output */ evaluate(state: GameState, actions?: Action[]): Promise; /** Legacy evaluation method (for backwards compatibility) */ evaluateLegacy?(state: GameState): Promise; /** Select the best action from available options */ selectAction(state: GameState, actions: Action[]): Promise; /** Initialize the agent (optional setup) */ initialize?(): Promise; /** Clean up resources (optional cleanup) */ cleanup?(): Promise; /** Get current performance statistics */ getStatistics(): AgentStatistics; /** Reset all statistics */ resetStatistics(): void; /** Check if agent is currently available/ready */ isReady(): boolean; /** Get agent metadata */ getMetadata(): Record; } /** * Abstract base implementation providing common functionality */ export declare abstract class BaseAgent implements Agent { readonly id: string; readonly name: string; readonly parameters: AgentParameters; readonly type: string; readonly role: AgentRole; readonly task: PolarisEngineTask; readonly domain: DomainConfig; protected statistics: AgentStatistics; protected initialized: boolean; protected ready: boolean; protected constructor(params: { id: string; name: string; type: string; role: AgentRole; task: PolarisEngineTask; parameters: AgentParameters; }); abstract evaluate(state: GameState, actions?: Action[]): Promise; abstract selectAction(state: GameState, actions: Action[]): Promise; abstract clone(): Agent; getStatistics(): AgentStatistics; resetStatistics(): void; isReady(): boolean; getMetadata(): Record; initialize(): Promise; cleanup(): Promise; toString(): string; /** * Build a prompt using the role, task, and domain */ protected buildPrompt(state: GameState, actions?: Action[]): string; /** * Update statistics after an evaluation */ protected updateStatistics(evaluation: EvaluationResult): void; /** * Update statistics from agent output */ protected updateStatisticsFromOutput(output: AgentOutput): void; /** * Handle errors and update error statistics */ protected handleError(error: Error): void; /** * Legacy evaluation method for backwards compatibility */ evaluateLegacy(state: GameState): Promise; /** * Create agent output from evaluation result */ protected createAgentOutput(evaluation: EvaluationResult, processingTime: number, model?: string, tokensUsed?: number, error?: { hasError: boolean; message?: string; type?: string; }): AgentOutput; /** * Convert agent statistics to performance metrics */ protected convertToPerformanceMetrics(): AgentPerformanceMetrics; /** * Generate a unique agent ID */ protected static generateAgentId(type: string): string; /** * Validate evaluation result */ protected validateEvaluation(evaluation: EvaluationResult): boolean; /** * Apply temperature to scores for randomization */ protected applyTemperature(scores: number[], temperature?: number): number[]; } //# sourceMappingURL=agent.d.ts.map