Provides canonical TypeScript types, Zod schemas, and custom error classes for the Agent-to-Agent (A2A) protocol. It serves as a shared library for validating agent cards, tasks, messages, and artifacts at runtime.
Status: Pre-1.0 — APIs may change in minor versions. Pin to a specific version in production.
Canonical TypeScript types, Zod schemas, and error classes for the Agent-to-Agent (A2A) protocol. This package is the single source of truth for all A2A protocol shapes used throughout the @reaatech/a2a-reference-* ecosystem.
All errors extend A2AError which includes code: string, message: string, and optional details?: unknown.
Class
Code
When
A2AError
(custom)
Base class for all A2A errors
TaskNotFoundError
TaskNotFoundError
Requested task does not exist
TaskNotCancelableError
TaskNotCancelableError
Task is in a terminal state
PushNotificationNotSupportedError
PushNotificationNotSupportedError
Agent lacks push notification capability
UnsupportedOperationError
UnsupportedOperationError
Operation not implemented by agent
ContentTypeNotSupportedError
ContentTypeNotSupportedError
Content type not accepted
InvalidAgentResponseError
InvalidAgentResponseError
Downstream agent returned invalid response
ExtendedAgentCardNotConfiguredError
ExtendedAgentCardNotConfiguredError
Extended card retrieval not configured
ExtensionSupportRequiredError
ExtensionSupportRequiredError
Required protocol extension not supported
VersionNotSupportedError
VersionNotSupportedError
Unsupported protocol version
Usage Pattern
Every schema export has a matching type export. Use the schema for runtime validation and the type for compile-time checking:
typescript
import { TaskSchema, type Task } from "@reaatech/a2a-reference-core";function handleResponse(raw: unknown): Task { // Parse at the boundary — throws ZodError on invalid data return TaskSchema.parse(raw);}