/** * A2A (Agent-to-Agent) Protocol Test Adapter * * Google's A2A protocol enables agent-to-agent communication via a standard HTTP API. * This adapter provides first-class testing support for A2A-compatible agents, * including task lifecycle management, streaming, and agent card discovery. * * @see https://github.com/google/A2A */ import type { AssertionResult } from '../types'; export interface AgentCard { name: string; description?: string; url: string; version?: string; capabilities?: AgentCapability[]; authentication?: AuthenticationInfo; provider?: ProviderInfo; skills?: AgentSkill[]; defaultInputModes?: string[]; defaultOutputModes?: string[]; supportsStreaming?: boolean; supportsPushNotifications?: boolean; } export interface AgentCapability { name: string; description?: string; } export interface AuthenticationInfo { schemes: string[]; credentials?: string; } export interface ProviderInfo { organization: string; url?: string; } export interface AgentSkill { id: string; name: string; description?: string; tags?: string[]; inputModes?: string[]; outputModes?: string[]; } export interface A2ATask { id: string; sessionId?: string; status: TaskStatus; messages: A2AMessage[]; artifacts?: TaskArtifact[]; metadata?: Record; } export interface TaskStatus { state: 'submitted' | 'working' | 'input-required' | 'completed' | 'canceled' | 'failed'; message?: string; timestamp?: string; } export interface A2AMessage { role: 'user' | 'agent'; parts: MessagePart[]; metadata?: Record; } export type MessagePart = { type: 'text'; text: string; } | { type: 'file'; file: { name: string; mimeType: string; bytes?: string; uri?: string; }; } | { type: 'data'; data: Record; }; export interface TaskArtifact { name?: string; description?: string; parts: MessagePart[]; index?: number; } export interface A2AResponse { id: string; jsonrpc: '2.0'; result?: any; error?: { code: number; message: string; data?: any; }; } export interface A2AAdapterConfig { agentUrl: string; capabilities?: string[]; timeout_ms?: number; auth?: { type: 'bearer'; token: string; } | { type: 'api-key'; key: string; header?: string; }; headers?: Record; } export interface A2ATestCase { name: string; message: string; sessionId?: string; expectedState?: TaskStatus['state']; expectedOutput?: string | string[]; expectedArtifacts?: number; maxRoundtrips?: number; timeout_ms?: number; streaming?: boolean; } export interface A2ATestResult { name: string; passed: boolean; task?: A2ATask; assertions: AssertionResult[]; duration_ms: number; error?: string; roundtrips?: number; } export declare class A2AAdapter { private config; private agentCard; constructor(config: A2AAdapterConfig); private getHeaders; /** * Fetch the agent card from /.well-known/agent.json */ getAgentCard(): Promise; /** * Send a JSON-RPC request to the A2A agent */ private rpc; /** * Create and send a task (tasks/send) */ send(message: string, sessionId?: string): Promise; /** * Send a task with streaming (tasks/sendSubscribe) */ sendStream(message: string, sessionId?: string): AsyncGenerator; /** * Get task status */ getTask(taskId: string): Promise; /** * Cancel a task */ cancelTask(taskId: string): Promise; /** * Run an A2A test case */ runTest(tc: A2ATestCase): Promise; /** * Run multiple A2A test cases */ runTests(cases: A2ATestCase[]): Promise; } /** * Validate an agent card structure */ export declare function validateAgentCard(card: any): AssertionResult[]; //# sourceMappingURL=a2a.d.ts.map