UNPKG

@dexwox-labs/a2a-client

Version:

TypeScript client implementation for Google's Agent-to-Agent (A2A) protocol - includes HTTP/WebSocket communication, circuit breakers and error handling

60 lines 2.53 kB
"use strict"; /** * @module Client * @description Client SDK for interacting with A2A protocol servers * * This package provides client classes for interacting with Agent-to-Agent (A2A) protocol servers. * It includes clients for sending messages, managing tasks, and discovering agents, along with * utilities for error handling and stream management. * * @example * ```typescript * import { MessageClient, TaskClient, AgentClient } from '@dexwox-labs/a2a-client'; * * // Create clients * const messageClient = new MessageClient({ baseUrl: 'https://a2a-server.example.com' }); * const taskClient = new TaskClient({ baseUrl: 'https://a2a-server.example.com' }); * const agentClient = new AgentClient({ baseUrl: 'https://a2a-server.example.com' }); * * // Use clients * const agents = await agentClient.resolveAgents(); * console.log('Available agents:', agents); * * const messageId = await messageClient.sendMessage( * [{ type: 'text', content: 'Hello, agent!' }], * agents[0].id * ); * console.log('Message sent with ID:', messageId); * ``` */ Object.defineProperty(exports, "__esModule", { value: true }); exports.normalizeError = exports.AgentClient = exports.TaskClient = exports.MessageClient = void 0; /** * Client for sending messages to agents * * The MessageClient handles sending messages to agents and streaming real-time * communication with agents. */ var message_client_1 = require("./message-client"); Object.defineProperty(exports, "MessageClient", { enumerable: true, get: function () { return message_client_1.MessageClient; } }); /** * Client for managing tasks * * The TaskClient handles task creation, status updates, and push notification * configurations for task events. */ var task_client_1 = require("./task-client"); Object.defineProperty(exports, "TaskClient", { enumerable: true, get: function () { return task_client_1.TaskClient; } }); /** * Client for discovering and interacting with agents * * The AgentClient handles resolving agent cards and retrieving agent information. */ var agent_client_1 = require("./agent-client"); Object.defineProperty(exports, "AgentClient", { enumerable: true, get: function () { return agent_client_1.AgentClient; } }); /** * Utility for normalizing different error types into A2AError instances */ var error_handler_1 = require("./utils/error-handler"); Object.defineProperty(exports, "normalizeError", { enumerable: true, get: function () { return error_handler_1.normalizeError; } }); //# sourceMappingURL=index.js.map