/** * AgentProbe SDK — Clean programmatic API for using AgentProbe as a library. * * @example * ```typescript * import { AgentProbe } from '@neuzhou/agentprobe'; * * const probe = new AgentProbe({ adapter: 'openai', model: 'gpt-4' }); * const trace = await probe.record('What is the weather?'); * const result = await probe.test(trace, { tool_called: 'get_weather' }); * const results = await probe.runSuite('tests.yaml'); * const diff = await probe.diff(trace1, trace2); * ``` */ import { Recorder } from './recorder'; import type { AgentTrace, Expectations, AssertionResult, SuiteResult } from './types'; import type { TraceDiff } from './diff'; export type AdapterType = 'openai' | 'anthropic' | 'gemini' | 'azure-openai' | 'ollama' | 'custom'; export interface AgentProbeOptions { /** LLM provider adapter */ adapter?: AdapterType; /** Model name (e.g. 'gpt-4', 'claude-3-opus') */ model?: string; /** API key (defaults to env vars) */ apiKey?: string; /** Base URL for API */ baseUrl?: string; /** Default timeout per test in ms */ timeoutMs?: number; /** Maximum cost per test in USD */ maxCostPerTest?: number; /** Maximum cost per suite run in USD */ maxCostPerSuite?: number; /** Custom metadata attached to all traces */ metadata?: Record; } export interface TestOptions extends Expectations { /** Timeout override for this test */ timeout_ms?: number; } export interface RecordOptions { /** Additional context/system prompt */ systemPrompt?: string; /** Mock tool responses */ mocks?: Record; /** Maximum steps before stopping */ maxSteps?: number; } export interface DiffResult { diff: TraceDiff; formatted: string; hasDrift: boolean; } export interface BatchTestResult { suiteResult: SuiteResult; passed: boolean; summary: string; } export declare class AgentProbe { private options; constructor(options?: AgentProbeOptions); /** * Get the configured adapter type. */ get adapter(): AdapterType; /** * Get the configured model name. */ get model(): string | undefined; /** * Record an agent interaction and return the trace. * In non-live mode, creates a trace stub for the given input. */ record(input: string, options?: RecordOptions): Promise; /** * Test a trace against expectations. Returns assertion results. */ test(trace: AgentTrace, expectations: TestOptions): Promise<{ passed: boolean; assertions: AssertionResult[]; duration_ms: number; }>; /** * Run a full test suite from a YAML file. */ runSuite(suitePath: string, options?: { tags?: string[]; updateSnapshots?: boolean; coverage?: boolean; declaredTools?: string[]; }): Promise; /** * Compare two traces and return structured diff. */ diff(oldTrace: AgentTrace, newTrace: AgentTrace): Promise; /** * Load a trace from a JSON file. */ loadTrace(tracePath: string): AgentTrace; /** * Create a new Recorder instance with SDK defaults. */ createRecorder(metadata?: Record): Recorder; /** * Patch an LLM SDK for automatic recording. */ patchAdapter(sdkModule: any): Recorder; } //# sourceMappingURL=sdk.d.ts.map