/** * Agent Contract Testing — Define and verify agent behavioral contracts * * @example * ```yaml * contract: * name: "customer-support-agent" * version: "2.0" * capabilities: * - tool: search_knowledge_base * required: true * behaviors: * - always_greets: true * - max_response_time_ms: 10000 * safety: * - no_pii_in_responses: true * ``` */ import type { AgentTrace } from './types'; export interface CapabilitySpec { tool: string; required: boolean; max_amount?: number; max_calls?: number; args_schema?: Record; } export interface BehaviorSpec { [key: string]: any; } export interface SafetySpec { [key: string]: any; } export interface GuaranteeSpec { always_responds_within?: string; never_calls?: string[]; always_calls_before_action?: string[]; max_cost_per_interaction?: string | number; maintains_context_for?: string | number; language?: string[]; } export interface BehaviorGuarantee { name: string; must_call?: string[]; must_not_call?: string[]; must_output?: string[]; must_not_output?: string[]; } export interface AgentContract { name: string; version: string; description?: string; capabilities?: CapabilitySpec[]; behaviors?: BehaviorSpec[]; safety?: SafetySpec[]; guarantees?: GuaranteeSpec; named_behaviors?: Record; } export interface ContractViolation { type: 'capability' | 'behavior' | 'safety'; rule: string; message: string; severity: 'error' | 'warning'; step?: number; } export interface ContractResult { contract: string; version: string; passed: boolean; violations: ContractViolation[]; checked: number; timestamp: string; } /** * Parse a contract from a YAML-parsed object. */ export declare function parseContract(obj: any): AgentContract | null; /** * Check capability requirements against a trace. */ export declare function checkCapabilities(trace: AgentTrace, capabilities: CapabilitySpec[]): ContractViolation[]; /** * Check behavior requirements against a trace. */ export declare function checkBehaviors(trace: AgentTrace, behaviors: BehaviorSpec[]): ContractViolation[]; /** * Check safety requirements against a trace. */ export declare function checkSafety(trace: AgentTrace, safety: SafetySpec[]): ContractViolation[]; /** * Verify a trace against a full contract. */ export declare function verifyContract(trace: AgentTrace, contract: AgentContract): ContractResult; /** * Check guarantee requirements against a trace. */ export declare function checkGuarantees(trace: AgentTrace, guarantees: GuaranteeSpec): ContractViolation[]; /** * Check named behavior requirements (must_call, must_not_call patterns). */ export declare function checkNamedBehavior(trace: AgentTrace, name: string, behavior: BehaviorGuarantee): ContractViolation[]; /** * Format contract result for display. */ export declare function formatContractResult(result: ContractResult): string; //# sourceMappingURL=contract.d.ts.map