/** * Agent - Core agent implementation for NeuroLink * * An Agent wraps a NeuroLink instance with specialized behavior, instructions, * and tool restrictions. Agents can be composed into networks for multi-agent * orchestration using the agents-as-tools pattern. */ import type { z } from "zod"; import type { NeuroLink } from "../neurolink.js"; import type { AgentDefinition, AgentExecutionOptions, AgentInput, AgentInstance, AgentResult, AgentStatus, AgentStreamChunk } from "../types/index.js"; /** * Agent - Wraps a NeuroLink instance with specialized behavior * * Features: * - Custom instructions and persona * - Tool restrictions per agent (via toolFilter on generate/stream) * - Input/output schema validation * - Streaming support * - Execution metrics tracking * * @example * ```typescript * const agent = new Agent({ * id: 'researcher', * name: 'Research Agent', * description: 'Searches and analyzes information', * instructions: 'You are a research assistant...', * tools: ['websearchGrounding', 'readFile'], * }, neurolink); * * const result = await agent.execute('Find information about quantum computing'); * ``` */ export declare class Agent implements AgentInstance { readonly id: string; readonly name: string; readonly description: string; readonly instructions: string; readonly provider?: string; readonly model?: string; readonly tools?: string[]; readonly inputSchema?: z.ZodSchema; readonly outputSchema?: z.ZodSchema; readonly maxSteps: number; readonly temperature: number; readonly canDelegate: boolean; readonly metadata?: Record; private neurolink; private emitter; private executionCount; private lastExecutionTime?; private totalExecutionTime; constructor(definition: AgentDefinition, neurolink: NeuroLink); /** * Execute the agent with given input * * @param input - Text input or structured data * @param options - Execution options * @returns Agent result with content and metadata */ execute(input: AgentInput, options?: AgentExecutionOptions): Promise; /** * Stream execution results * * @param input - Text input or structured data * @param options - Execution options * @yields Agent stream chunks */ stream(input: AgentInput, options?: AgentExecutionOptions): AsyncIterable; /** * Get agent status */ getStatus(): AgentStatus; /** * Get average execution time */ getAverageExecutionTime(): number; /** * Subscribe to agent events */ on(event: string, handler: (...args: unknown[]) => void): void; /** * Unsubscribe from agent events */ off(event: string, handler: (...args: unknown[]) => void): void; /** * Build prompt from input and context */ private buildPrompt; /** * Build generation options for NeuroLink.generate() * * Uses toolFilter to delegate tool restriction to BaseProvider.applyToolFiltering() * rather than pre-filtering tools manually. */ private buildGenerateOptions; /** * Build stream options for NeuroLink.stream() * * Uses toolFilter to delegate tool restriction to BaseProvider.applyToolFiltering() * rather than pre-filtering tools manually. */ private buildStreamOptions; }