a2a

package
v1.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 11, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package a2a provides hand-transcribed Go shapes for every type defined in the vendored A2A v1 proto specification at `docs/specifications/a2a.proto` (commit `ae6a562d5d972f2c4b184f748bb32e1fa9aa7bf2`, 2026-04-23).

The types are 1:1 with the proto messages, enums and oneofs:

  • Every `message` in the proto has a Go struct counterpart.
  • Every `enum` is represented as a typed int constant set with `XxxUnspecified = 0` matching the proto's `_UNSPECIFIED = 0` rule.
  • Every `oneof` is represented as a Go interface plus one concrete type per variant; a `Kind() string` method discriminates at runtime. The interface is sealed (unexported method) so external packages cannot accidentally add variants.
  • Every type's godoc quotes the source proto comment so the transcription is auditable from inside the repo.

Phase 22 does NOT depend on `google.golang.org/protobuf` or `google.golang.org/grpc`. The Go shapes JSON-marshal cleanly via stdlib `encoding/json`. Phase 29 (A2A southbound) may use generated gRPC code for the wire binding; the resulting types will be wrapped to match this package or translated at the boundary.

JSON wire format notes (per the A2A spec + proto3 JSON mapping):

  • `Part.raw` (`bytes`) is base64-encoded on the wire. `RawPart` unmarshals from a base64 string.
  • Discriminated unions (`Part`, `SecurityScheme`, `OAuthFlows`, `StreamResponse`, `SendMessageResponse`) marshal as a flat object with the variant's fields inline; `UnmarshalJSON` probes the payload to pick the variant.
  • Timestamps use RFC 3339; durations are not used.

The package has no exported helpers that mutate state. It is a pure data-shape package.

Index

Constants

View Source
const (
	// PartKindText — proto: `string text = 1`.
	PartKindText = "text"
	// PartKindRaw — proto: `bytes raw = 2`. Base64-encoded on the wire.
	PartKindRaw = "raw"
	// PartKindURL — proto: `string url = 3`.
	PartKindURL = "url"
	// PartKindData — proto: `google.protobuf.Value data = 4`.
	PartKindData = "data"
)

PartKind values are the canonical variant discriminators.

View Source
const (
	// ProtocolBindingJSONRPC — proto: documented `"JSONRPC"` binding.
	ProtocolBindingJSONRPC = "JSONRPC"
	// ProtocolBindingGRPC — proto: documented `"GRPC"` binding.
	ProtocolBindingGRPC = "GRPC"
	// ProtocolBindingHTTPJSON — proto: documented `"HTTP+JSON"` binding.
	ProtocolBindingHTTPJSON = "HTTP+JSON"
)

Canonical protocol bindings declared by the A2A spec. Open-form string elsewhere — agents MAY declare extension bindings.

View Source
const (
	// SecurityKindAPIKey — proto: APIKeySecurityScheme.
	SecurityKindAPIKey = "apiKey"
	// SecurityKindHTTPAuth — proto: HTTPAuthSecurityScheme.
	SecurityKindHTTPAuth = "http"
	// SecurityKindOAuth2 — proto: OAuth2SecurityScheme.
	SecurityKindOAuth2 = "oauth2"
	// SecurityKindOpenIDConnect — proto: OpenIdConnectSecurityScheme.
	SecurityKindOpenIDConnect = "openIdConnect"
	// SecurityKindMutualTLS — proto: MutualTlsSecurityScheme.
	SecurityKindMutualTLS = "mutualTLS"
)

SecurityScheme kind discriminators. Names mirror the OpenAPI Security Scheme Object's `type` field so JSON producers can use the same vocabulary.

View Source
const (
	// OAuthFlowKindAuthorizationCode — proto: AuthorizationCodeOAuthFlow.
	OAuthFlowKindAuthorizationCode = "authorizationCode"
	// OAuthFlowKindClientCredentials — proto: ClientCredentialsOAuthFlow.
	OAuthFlowKindClientCredentials = "clientCredentials"
	// OAuthFlowKindImplicit — proto: ImplicitOAuthFlow (deprecated).
	OAuthFlowKindImplicit = "implicit"
	// OAuthFlowKindPassword — proto: PasswordOAuthFlow (deprecated).
	OAuthFlowKindPassword = "password"
	// OAuthFlowKindDeviceCode — proto: DeviceCodeOAuthFlow.
	OAuthFlowKindDeviceCode = "deviceCode"
)

OAuthFlow kind discriminators. Names mirror the OpenAPI 3.2 Security Scheme Object's flow names.

View Source
const (
	// SendMessageResponseKindTask — the response carries a Task.
	SendMessageResponseKindTask = "task"
	// SendMessageResponseKindMessage — the response carries a Message.
	SendMessageResponseKindMessage = "message"
)

SendMessageResponse kind discriminators.

View Source
const (
	// StreamResponseKindTask — Task variant.
	StreamResponseKindTask = "task"
	// StreamResponseKindMessage — Message variant.
	StreamResponseKindMessage = "message"
	// StreamResponseKindStatusUpdate — TaskStatusUpdateEvent variant.
	StreamResponseKindStatusUpdate = "status_update"
	// StreamResponseKindArtifactUpdate — TaskArtifactUpdateEvent variant.
	StreamResponseKindArtifactUpdate = "artifact_update"
)

StreamResponse kind discriminators.

Variables

View Source
var ErrInvalidOneof = errors.New("a2a: invalid oneof: no recognised variant")

ErrInvalidOneof is returned when a discriminated-union JSON payload matches no known variant.

View Source
var ErrInvalidPart = errors.New("a2a: invalid Part: no recognised variant")

ErrInvalidPart is returned when a Part oneof is empty / contains no recognised variant. Surfaced at unmarshal time.

Functions

func MarshalOAuthFlows

func MarshalOAuthFlows(f OAuthFlows) ([]byte, error)

MarshalOAuthFlows encodes an OAuthFlows variant.

func MarshalPart

func MarshalPart(p Part) ([]byte, error)

MarshalPart encodes any Part variant into the proto's wire form. Exposed for callers that need to marshal a `Part` interface field without an enclosing struct.

func MarshalSecurityScheme

func MarshalSecurityScheme(s SecurityScheme) ([]byte, error)

MarshalSecurityScheme encodes a SecurityScheme variant with an OpenAPI-style `"type":...` discriminator.

Types

type APIKeySecurityScheme

type APIKeySecurityScheme struct {
	// Description — proto: `string description = 1`.
	Description string `json:"description,omitempty"`
	// Location — proto: `string location = 2` (REQUIRED). "query", "header", or "cookie".
	Location string `json:"in"`
	// Name — proto: `string name = 3` (REQUIRED).
	Name string `json:"name"`
}

APIKeySecurityScheme defines a security scheme using an API key.

Proto: message APIKeySecurityScheme.

func (*APIKeySecurityScheme) Kind

func (s *APIKeySecurityScheme) Kind() string

Kind returns SecurityKindAPIKey.

type AgentCapabilities

type AgentCapabilities struct {
	// Streaming — proto: `optional bool streaming = 1`.
	Streaming *bool `json:"streaming,omitempty"`
	// PushNotifications — proto: `optional bool push_notifications = 2`.
	PushNotifications *bool `json:"push_notifications,omitempty"`
	// Extensions — proto: `repeated AgentExtension extensions = 3`.
	Extensions []AgentExtension `json:"extensions,omitempty"`
	// ExtendedAgentCard — proto: `optional bool extended_agent_card = 4`.
	ExtendedAgentCard *bool `json:"extended_agent_card,omitempty"`
}

AgentCapabilities defines optional capabilities supported by an agent.

Proto: message AgentCapabilities.

type AgentCard

type AgentCard struct {
	// Name — proto: `string name = 1` (REQUIRED).
	Name string `json:"name"`
	// Description — proto: `string description = 2` (REQUIRED).
	Description string `json:"description"`
	// SupportedInterfaces — proto: `repeated AgentInterface supported_interfaces = 3` (REQUIRED).
	SupportedInterfaces []AgentInterface `json:"supported_interfaces"`
	// Provider — proto: `AgentProvider provider = 4`.
	Provider *AgentProvider `json:"provider,omitempty"`
	// Version — proto: `string version = 5` (REQUIRED).
	Version string `json:"version"`
	// DocumentationURL — proto: `optional string documentation_url = 6`.
	DocumentationURL string `json:"documentation_url,omitempty"`
	// Capabilities — proto: `AgentCapabilities capabilities = 7` (REQUIRED).
	Capabilities AgentCapabilities `json:"capabilities"`
	// SecuritySchemes — proto: `map<string, SecurityScheme> security_schemes = 8`.
	// Use the SecuritySchemeMap typed wrapper so the discriminated-union
	// JSON round-trip dispatches automatically.
	SecuritySchemes SecuritySchemeMap `json:"security_schemes,omitempty"`
	// SecurityRequirements — proto: `repeated SecurityRequirement security_requirements = 9`.
	SecurityRequirements []SecurityRequirement `json:"security_requirements,omitempty"`
	// DefaultInputModes — proto: `repeated string default_input_modes = 10` (REQUIRED).
	DefaultInputModes []string `json:"default_input_modes"`
	// DefaultOutputModes — proto: `repeated string default_output_modes = 11` (REQUIRED).
	DefaultOutputModes []string `json:"default_output_modes"`
	// Skills — proto: `repeated AgentSkill skills = 12` (REQUIRED).
	Skills []AgentSkill `json:"skills"`
	// Signatures — proto: `repeated AgentCardSignature signatures = 13`.
	Signatures []AgentCardSignature `json:"signatures,omitempty"`
	// IconURL — proto: `optional string icon_url = 14`.
	IconURL string `json:"icon_url,omitempty"`
}

AgentCard is the self-describing manifest for an agent.

Proto: message AgentCard ("A self-describing manifest for an agent. It provides essential metadata including the agent's identity, capabilities, skills, supported communication methods, and security requirements.").

type AgentCardSignature

type AgentCardSignature struct {
	// Protected — proto: `string protected = 1` (REQUIRED). Base64url-encoded JSON object.
	Protected string `json:"protected"`
	// Signature — proto: `string signature = 2` (REQUIRED). Base64url-encoded.
	Signature string `json:"signature"`
	// Header — proto: `google.protobuf.Struct header = 3`.
	Header map[string]any `json:"header,omitempty"`
}

AgentCardSignature represents a JWS signature of an AgentCard.

Proto: message AgentCardSignature ("This follows the JSON format of an RFC 7515 JSON Web Signature (JWS).").

type AgentExtension

type AgentExtension struct {
	// URI — proto: `string uri = 1`.
	URI string `json:"uri,omitempty"`
	// Description — proto: `string description = 2`.
	Description string `json:"description,omitempty"`
	// Required — proto: `bool required = 3`.
	Required bool `json:"required,omitempty"`
	// Params — proto: `google.protobuf.Struct params = 4`.
	Params map[string]any `json:"params,omitempty"`
}

AgentExtension declares a protocol extension supported by an agent.

Proto: message AgentExtension.

type AgentInterface

type AgentInterface struct {
	// URL — proto: `string url = 1` (REQUIRED).
	URL string `json:"url"`
	// ProtocolBinding — proto: `string protocol_binding = 2` (REQUIRED).
	// Open-form; canonical values are "JSONRPC", "GRPC", "HTTP+JSON".
	ProtocolBinding string `json:"protocol_binding"`
	// Tenant — proto: `string tenant = 3`.
	Tenant string `json:"tenant,omitempty"`
	// ProtocolVersion — proto: `string protocol_version = 4` (REQUIRED).
	ProtocolVersion string `json:"protocol_version"`
}

AgentInterface declares a target URL + protocol binding + protocol version for interacting with an agent.

Proto: message AgentInterface.

type AgentProvider

type AgentProvider struct {
	// URL — proto: `string url = 1` (REQUIRED).
	URL string `json:"url"`
	// Organization — proto: `string organization = 2` (REQUIRED).
	Organization string `json:"organization"`
}

AgentProvider represents the service provider of an agent.

Proto: message AgentProvider.

type AgentSkill

type AgentSkill struct {
	// ID — proto: `string id = 1` (REQUIRED).
	ID string `json:"id"`
	// Name — proto: `string name = 2` (REQUIRED).
	Name string `json:"name"`
	// Description — proto: `string description = 3` (REQUIRED).
	Description string `json:"description"`
	// Tags — proto: `repeated string tags = 4` (REQUIRED).
	Tags []string `json:"tags"`
	// Examples — proto: `repeated string examples = 5`.
	Examples []string `json:"examples,omitempty"`
	// InputModes — proto: `repeated string input_modes = 6`.
	InputModes []string `json:"input_modes,omitempty"`
	// OutputModes — proto: `repeated string output_modes = 7`.
	OutputModes []string `json:"output_modes,omitempty"`
	// SecurityRequirements — proto: `repeated SecurityRequirement security_requirements = 8`.
	SecurityRequirements []SecurityRequirement `json:"security_requirements,omitempty"`
}

AgentSkill represents a distinct capability that an agent can perform.

Proto: message AgentSkill.

type Artifact

type Artifact struct {
	// ArtifactID — proto: `string artifact_id = 1` (REQUIRED).
	ArtifactID string `json:"artifact_id"`
	// Name — proto: `string name = 2`. Human readable name.
	Name string `json:"name,omitempty"`
	// Description — proto: `string description = 3`.
	Description string `json:"description,omitempty"`
	// Parts — proto: `repeated Part parts = 4` (REQUIRED).
	Parts Parts `json:"parts"`
	// Metadata — proto: `google.protobuf.Struct metadata = 5`.
	Metadata map[string]any `json:"metadata,omitempty"`
	// Extensions — proto: `repeated string extensions = 6`.
	Extensions []string `json:"extensions,omitempty"`
}

Artifact represents task outputs.

Proto: message Artifact ("Artifacts represent task outputs.").

type AuthenticationInfo

type AuthenticationInfo struct {
	// Scheme — proto: `string scheme = 1` (REQUIRED). HTTP auth scheme name.
	Scheme string `json:"scheme"`
	// Credentials — proto: `string credentials = 2`.
	Credentials string `json:"credentials,omitempty"`
}

AuthenticationInfo defines authentication details for push notifications.

Proto: message AuthenticationInfo ("Defines authentication details, used for push notifications.").

type AuthorizationCodeOAuthFlow

type AuthorizationCodeOAuthFlow struct {
	// AuthorizationURL — proto: `string authorization_url = 1` (REQUIRED).
	AuthorizationURL string `json:"authorizationUrl"`
	// TokenURL — proto: `string token_url = 2` (REQUIRED).
	TokenURL string `json:"tokenUrl"`
	// RefreshURL — proto: `string refresh_url = 3`.
	RefreshURL string `json:"refreshUrl,omitempty"`
	// Scopes — proto: `map<string, string> scopes = 4` (REQUIRED).
	Scopes map[string]string `json:"scopes"`
	// PKCERequired — proto: `bool pkce_required = 5`.
	PKCERequired bool `json:"pkceRequired,omitempty"`
}

AuthorizationCodeOAuthFlow is the Authorization Code flow.

Proto: message AuthorizationCodeOAuthFlow.

func (*AuthorizationCodeOAuthFlow) Kind

Kind returns OAuthFlowKindAuthorizationCode.

type CancelTaskRequest

type CancelTaskRequest struct {
	// Tenant — proto: `string tenant = 1`.
	Tenant string `json:"tenant,omitempty"`
	// ID — proto: `string id = 2` (REQUIRED).
	ID string `json:"id"`
	// Metadata — proto: `google.protobuf.Struct metadata = 3`.
	Metadata map[string]any `json:"metadata,omitempty"`
}

CancelTaskRequest represents a request for the CancelTask method.

Proto: message CancelTaskRequest.

type ClientCredentialsOAuthFlow

type ClientCredentialsOAuthFlow struct {
	// TokenURL — proto: `string token_url = 1` (REQUIRED).
	TokenURL string `json:"tokenUrl"`
	// RefreshURL — proto: `string refresh_url = 2`.
	RefreshURL string `json:"refreshUrl,omitempty"`
	// Scopes — proto: `map<string, string> scopes = 3` (REQUIRED).
	Scopes map[string]string `json:"scopes"`
}

ClientCredentialsOAuthFlow is the Client Credentials flow.

Proto: message ClientCredentialsOAuthFlow.

func (*ClientCredentialsOAuthFlow) Kind

Kind returns OAuthFlowKindClientCredentials.

type DataPart

type DataPart struct {
	// Data is the structured JSON value. Any Go value that marshals to JSON.
	Data any `json:"data"`
	// contains filtered or unexported fields
}

DataPart is the `data` variant of Part.

Proto: `google.protobuf.Value data = 4` ("Arbitrary structured data as a JSON value (object, array, string, number, boolean, or null).").

func (*DataPart) Kind

func (p *DataPart) Kind() string

Kind returns PartKindData.

type DeleteTaskPushNotificationConfigRequest

type DeleteTaskPushNotificationConfigRequest struct {
	// Tenant — proto: `string tenant = 1`.
	Tenant string `json:"tenant,omitempty"`
	// TaskID — proto: `string task_id = 2` (REQUIRED).
	TaskID string `json:"task_id"`
	// ID — proto: `string id = 3` (REQUIRED).
	ID string `json:"id"`
}

DeleteTaskPushNotificationConfigRequest represents a request for the DeleteTaskPushNotificationConfig method.

Proto: message DeleteTaskPushNotificationConfigRequest.

type DeviceCodeOAuthFlow

type DeviceCodeOAuthFlow struct {
	// DeviceAuthorizationURL — proto: `string device_authorization_url = 1` (REQUIRED).
	DeviceAuthorizationURL string `json:"deviceAuthorizationUrl"`
	// TokenURL — proto: `string token_url = 2` (REQUIRED).
	TokenURL string `json:"tokenUrl"`
	// RefreshURL — proto: `string refresh_url = 3`.
	RefreshURL string `json:"refreshUrl,omitempty"`
	// Scopes — proto: `map<string, string> scopes = 4` (REQUIRED).
	Scopes map[string]string `json:"scopes"`
}

DeviceCodeOAuthFlow is the OAuth 2.0 Device Code flow (RFC 8628).

Proto: message DeviceCodeOAuthFlow.

func (*DeviceCodeOAuthFlow) Kind

func (f *DeviceCodeOAuthFlow) Kind() string

Kind returns OAuthFlowKindDeviceCode.

type GetExtendedAgentCardRequest

type GetExtendedAgentCardRequest struct {
	// Tenant — proto: `string tenant = 1`.
	Tenant string `json:"tenant,omitempty"`
}

GetExtendedAgentCardRequest represents a request for the GetExtendedAgentCard method.

Proto: message GetExtendedAgentCardRequest.

type GetTaskPushNotificationConfigRequest

type GetTaskPushNotificationConfigRequest struct {
	// Tenant — proto: `string tenant = 1`.
	Tenant string `json:"tenant,omitempty"`
	// TaskID — proto: `string task_id = 2` (REQUIRED).
	TaskID string `json:"task_id"`
	// ID — proto: `string id = 3` (REQUIRED).
	ID string `json:"id"`
}

GetTaskPushNotificationConfigRequest represents a request for the GetTaskPushNotificationConfig method.

Proto: message GetTaskPushNotificationConfigRequest.

type GetTaskRequest

type GetTaskRequest struct {
	// Tenant — proto: `string tenant = 1`.
	Tenant string `json:"tenant,omitempty"`
	// ID — proto: `string id = 2` (REQUIRED). Resource ID of the task.
	ID string `json:"id"`
	// HistoryLength — proto: `optional int32 history_length = 3`.
	HistoryLength *int32 `json:"history_length,omitempty"`
}

GetTaskRequest represents a request for the GetTask method.

Proto: message GetTaskRequest.

type HTTPAuthSecurityScheme

type HTTPAuthSecurityScheme struct {
	// Description — proto: `string description = 1`.
	Description string `json:"description,omitempty"`
	// Scheme — proto: `string scheme = 2` (REQUIRED). e.g. "Bearer".
	Scheme string `json:"scheme"`
	// BearerFormat — proto: `string bearer_format = 3`. e.g. "JWT".
	BearerFormat string `json:"bearerFormat,omitempty"`
}

HTTPAuthSecurityScheme defines a security scheme using HTTP authentication.

Proto: message HTTPAuthSecurityScheme.

func (*HTTPAuthSecurityScheme) Kind

func (s *HTTPAuthSecurityScheme) Kind() string

Kind returns SecurityKindHTTPAuth.

type ImplicitOAuthFlow deprecated

type ImplicitOAuthFlow struct {
	// AuthorizationURL — proto: `string authorization_url = 1`.
	AuthorizationURL string `json:"authorizationUrl,omitempty"`
	// RefreshURL — proto: `string refresh_url = 2`.
	RefreshURL string `json:"refreshUrl,omitempty"`
	// Scopes — proto: `map<string, string> scopes = 3`.
	Scopes map[string]string `json:"scopes,omitempty"`
}

ImplicitOAuthFlow is the (deprecated) Implicit flow. Included for spec parity per the vendored proto.

Proto: message ImplicitOAuthFlow ("Deprecated: Use Authorization Code + PKCE instead.").

Deprecated: use AuthorizationCodeOAuthFlow with PKCE.

func (*ImplicitOAuthFlow) Kind

func (f *ImplicitOAuthFlow) Kind() string

Kind returns OAuthFlowKindImplicit.

type ListTaskPushNotificationConfigsRequest

type ListTaskPushNotificationConfigsRequest struct {
	// Tenant — proto: `string tenant = 4`.
	Tenant string `json:"tenant,omitempty"`
	// TaskID — proto: `string task_id = 1` (REQUIRED).
	TaskID string `json:"task_id"`
	// PageSize — proto: `int32 page_size = 2`.
	PageSize int32 `json:"page_size,omitempty"`
	// PageToken — proto: `string page_token = 3`.
	PageToken string `json:"page_token,omitempty"`
}

ListTaskPushNotificationConfigsRequest represents a request for the ListTaskPushNotificationConfigs method.

Proto: message ListTaskPushNotificationConfigsRequest.

type ListTaskPushNotificationConfigsResponse

type ListTaskPushNotificationConfigsResponse struct {
	// Configs — proto: `repeated TaskPushNotificationConfig configs = 1`.
	Configs []TaskPushNotificationConfig `json:"configs,omitempty"`
	// NextPageToken — proto: `string next_page_token = 2`.
	NextPageToken string `json:"next_page_token,omitempty"`
}

ListTaskPushNotificationConfigsResponse is the successful response for ListTaskPushNotificationConfigs.

Proto: message ListTaskPushNotificationConfigsResponse.

type ListTasksRequest

type ListTasksRequest struct {
	// Tenant — proto: `string tenant = 1`.
	Tenant string `json:"tenant,omitempty"`
	// ContextID — proto: `string context_id = 2`. Filter by context.
	ContextID string `json:"context_id,omitempty"`
	// Status — proto: `TaskState status = 3`. Filter by status.
	Status TaskState `json:"status,omitempty"`
	// PageSize — proto: `optional int32 page_size = 4`. Max 100; default 50.
	PageSize *int32 `json:"page_size,omitempty"`
	// PageToken — proto: `string page_token = 5`.
	PageToken string `json:"page_token,omitempty"`
	// HistoryLength — proto: `optional int32 history_length = 6`.
	HistoryLength *int32 `json:"history_length,omitempty"`
	// StatusTimestampAfter — proto: `google.protobuf.Timestamp status_timestamp_after = 7`.
	StatusTimestampAfter time.Time `json:"status_timestamp_after,omitempty"`
	// IncludeArtifacts — proto: `optional bool include_artifacts = 8`.
	IncludeArtifacts *bool `json:"include_artifacts,omitempty"`
}

ListTasksRequest is the parameters for listing tasks with optional filters.

Proto: message ListTasksRequest.

type ListTasksResponse

type ListTasksResponse struct {
	// Tasks — proto: `repeated Task tasks = 1` (REQUIRED).
	Tasks []Task `json:"tasks"`
	// NextPageToken — proto: `string next_page_token = 2` (REQUIRED).
	NextPageToken string `json:"next_page_token"`
	// PageSize — proto: `int32 page_size = 3` (REQUIRED).
	PageSize int32 `json:"page_size"`
	// TotalSize — proto: `int32 total_size = 4` (REQUIRED).
	TotalSize int32 `json:"total_size"`
}

ListTasksResponse is the result object for ListTasks.

Proto: message ListTasksResponse.

type Message

type Message struct {
	// MessageID — proto: `string message_id = 1` (REQUIRED).
	MessageID string `json:"message_id"`
	// ContextID — proto: `string context_id = 2`.
	ContextID string `json:"context_id,omitempty"`
	// TaskID — proto: `string task_id = 3`.
	TaskID string `json:"task_id,omitempty"`
	// Role — proto: `Role role = 4` (REQUIRED).
	Role Role `json:"role"`
	// Parts — proto: `repeated Part parts = 5` (REQUIRED).
	Parts Parts `json:"parts"`
	// Metadata — proto: `google.protobuf.Struct metadata = 6`.
	Metadata map[string]any `json:"metadata,omitempty"`
	// Extensions — proto: `repeated string extensions = 7`.
	Extensions []string `json:"extensions,omitempty"`
	// ReferenceTaskIDs — proto: `repeated string reference_task_ids = 8`.
	ReferenceTaskIDs []string `json:"reference_task_ids,omitempty"`
}

Message is one unit of communication between client and server.

Proto: message Message ("`Message` is one unit of communication between client and server. It can be associated with a context and/or a task.").

type MutualTlsSecurityScheme

type MutualTlsSecurityScheme struct {
	// Description — proto: `string description = 1`.
	Description string `json:"description,omitempty"`
}

MutualTlsSecurityScheme defines a security scheme using mTLS.

Proto: message MutualTlsSecurityScheme.

func (*MutualTlsSecurityScheme) Kind

func (s *MutualTlsSecurityScheme) Kind() string

Kind returns SecurityKindMutualTLS.

type OAuth2SecurityScheme

type OAuth2SecurityScheme struct {
	// Description — proto: `string description = 1`.
	Description string `json:"description,omitempty"`
	// Flows — proto: `OAuthFlows flows = 2` (REQUIRED).
	Flows OAuthFlows `json:"flows"`
	// OAuth2MetadataURL — proto: `string oauth2_metadata_url = 3`. RFC 8414 metadata URL.
	OAuth2MetadataURL string `json:"oauth2MetadataUrl,omitempty"`
}

OAuth2SecurityScheme defines a security scheme using OAuth 2.0.

Proto: message OAuth2SecurityScheme.

func (*OAuth2SecurityScheme) Kind

func (s *OAuth2SecurityScheme) Kind() string

Kind returns SecurityKindOAuth2.

func (*OAuth2SecurityScheme) MarshalJSON

func (s *OAuth2SecurityScheme) MarshalJSON() ([]byte, error)

MarshalJSON encodes OAuth2SecurityScheme with the OAuthFlows oneof represented as the OpenAPI flow-keyed object.

func (*OAuth2SecurityScheme) UnmarshalJSON

func (s *OAuth2SecurityScheme) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes OAuth2SecurityScheme, dispatching the OAuthFlows variant via flowsFromWire.

type OAuthFlows

type OAuthFlows interface {
	// Kind returns the variant discriminator.
	Kind() string
	// contains filtered or unexported methods
}

OAuthFlows is the proto OAuthFlows oneof Go interface. Each concrete flow variant satisfies this; runtime discrimination via `Kind()`.

Proto: message OAuthFlows.

func UnmarshalOAuthFlows

func UnmarshalOAuthFlows(data []byte) (OAuthFlows, error)

UnmarshalOAuthFlows decodes an OAuthFlows variant.

type OAuthFlowsWire

type OAuthFlowsWire struct {
	AuthorizationCode *AuthorizationCodeOAuthFlow `json:"authorizationCode,omitempty"`
	ClientCredentials *ClientCredentialsOAuthFlow `json:"clientCredentials,omitempty"`
	// Implicit is deprecated; retained for spec parity.
	Implicit *ImplicitOAuthFlow `json:"implicit,omitempty"`
	// Password is deprecated; retained for spec parity.
	Password   *PasswordOAuthFlow   `json:"password,omitempty"`
	DeviceCode *DeviceCodeOAuthFlow `json:"deviceCode,omitempty"`
}

OAuthFlowsWire is the JSON envelope used by OAuth2SecurityScheme to carry the proto OAuthFlows oneof. Per the OpenAPI 3.2 spec, all flows are objects under named keys ("authorizationCode", "clientCredentials", "implicit", "password", "deviceCode"); exactly one is non-nil for a valid scheme.

type OpenIdConnectSecurityScheme

type OpenIdConnectSecurityScheme struct {
	// Description — proto: `string description = 1`.
	Description string `json:"description,omitempty"`
	// OpenIDConnectURL — proto: `string open_id_connect_url = 2` (REQUIRED).
	OpenIDConnectURL string `json:"openIdConnectUrl"`
}

OpenIdConnectSecurityScheme defines a security scheme using OIDC.

Proto: message OpenIdConnectSecurityScheme.

func (*OpenIdConnectSecurityScheme) Kind

Kind returns SecurityKindOpenIDConnect.

type Part

type Part interface {
	// Kind returns the variant discriminator: "text" | "raw" | "url" | "data".
	Kind() string
	// contains filtered or unexported methods
}

Part is the proto Part oneof Go interface. Each concrete variant (TextPart, RawPart, URLPart, DataPart) satisfies this interface via its Kind() method and an unexported seal. Callers discriminate via `Kind()` or a type switch:

switch p := part.(type) {
case *TextPart: …
case *RawPart:  …
}

Proto: message Part (`docs/specifications/a2a.proto` §message Part).

func UnmarshalPart

func UnmarshalPart(data []byte) (Part, error)

UnmarshalPart decodes a JSON payload into a concrete Part variant. Probes the payload in declaration order (text, raw, url, data) and returns the first match. Returns ErrInvalidPart when no variant fields are present.

type Parts

type Parts []Part

Parts is a slice of Part values with a custom JSON encoding so the slice round-trips through MarshalPart / UnmarshalPart. Use as the type of any `repeated Part` proto field.

func (Parts) MarshalJSON

func (ps Parts) MarshalJSON() ([]byte, error)

MarshalJSON marshals each Part via MarshalPart and emits a JSON array.

func (*Parts) UnmarshalJSON

func (ps *Parts) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes an array of Part variants.

type PasswordOAuthFlow deprecated

type PasswordOAuthFlow struct {
	// TokenURL — proto: `string token_url = 1`.
	TokenURL string `json:"tokenUrl,omitempty"`
	// RefreshURL — proto: `string refresh_url = 2`.
	RefreshURL string `json:"refreshUrl,omitempty"`
	// Scopes — proto: `map<string, string> scopes = 3`.
	Scopes map[string]string `json:"scopes,omitempty"`
}

PasswordOAuthFlow is the (deprecated) Resource Owner Password Credentials flow. Included for spec parity per the vendored proto.

Proto: message PasswordOAuthFlow ("Deprecated: Use Authorization Code + PKCE or Device Code.").

Deprecated: use AuthorizationCodeOAuthFlow with PKCE or DeviceCodeOAuthFlow.

func (*PasswordOAuthFlow) Kind

func (f *PasswordOAuthFlow) Kind() string

Kind returns OAuthFlowKindPassword.

type RawPart

type RawPart struct {
	// Raw is the raw bytes. JSON-encoded as a base64 string (stdlib default).
	Raw []byte `json:"raw"`
	// contains filtered or unexported fields
}

RawPart is the `raw` variant of Part — raw bytes.

Proto: `bytes raw = 2` ("The raw byte content of a file. In JSON serialization, this is encoded as a base64 string.").

func (*RawPart) Kind

func (p *RawPart) Kind() string

Kind returns PartKindRaw.

type Role

type Role int32

Role identifies the sender of a Message in A2A communication.

Proto: enum Role.

const (
	// RoleUnspecified — the role is unspecified.
	RoleUnspecified Role = 0
	// RoleUser — message is from the client to the server.
	RoleUser Role = 1
	// RoleAgent — message is from the server to the client.
	RoleAgent Role = 2
)

Role values mirror the proto's ROLE_* constants.

func (Role) IsValid

func (r Role) IsValid() bool

IsValid reports whether r is one of the 3 canonical values.

func (Role) MarshalJSON

func (r Role) MarshalJSON() ([]byte, error)

MarshalJSON emits the canonical wire string.

func (Role) String

func (r Role) String() string

String returns the canonical wire name.

func (*Role) UnmarshalJSON

func (r *Role) UnmarshalJSON(data []byte) error

UnmarshalJSON accepts string or integer form.

type SecurityRequirement

type SecurityRequirement struct {
	// Schemes — proto: `map<string, StringList> schemes = 1`.
	Schemes map[string]StringList `json:"schemes,omitempty"`
}

SecurityRequirement defines the security requirements for an agent.

Proto: message SecurityRequirement.

type SecurityScheme

type SecurityScheme interface {
	// Kind returns the variant discriminator (e.g. "apiKey", "http", "oauth2", "openIdConnect", "mutualTLS").
	Kind() string
	// contains filtered or unexported methods
}

SecurityScheme is the proto SecurityScheme oneof Go interface. One concrete variant per scheme; the JSON wire form is a flat object per OpenAPI 3.2 conventions.

Proto: message SecurityScheme.

func UnmarshalSecurityScheme

func UnmarshalSecurityScheme(data []byte) (SecurityScheme, error)

UnmarshalSecurityScheme decodes a SecurityScheme variant.

type SecuritySchemeMap

type SecuritySchemeMap map[string]SecurityScheme

SecuritySchemeMap is a typed wrapper over `map[string]SecurityScheme` that round-trips through MarshalSecurityScheme / UnmarshalSecurityScheme.

func (SecuritySchemeMap) MarshalJSON

func (m SecuritySchemeMap) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler contract for the map.

func (*SecuritySchemeMap) UnmarshalJSON

func (m *SecuritySchemeMap) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler contract for the map.

type SendMessageConfiguration

type SendMessageConfiguration struct {
	// AcceptedOutputModes — proto: `repeated string accepted_output_modes = 1`.
	AcceptedOutputModes []string `json:"accepted_output_modes,omitempty"`
	// TaskPushNotificationConfig — proto: `TaskPushNotificationConfig task_push_notification_config = 2`.
	TaskPushNotificationConfig *TaskPushNotificationConfig `json:"task_push_notification_config,omitempty"`
	// HistoryLength — proto: `optional int32 history_length = 3`.
	HistoryLength *int32 `json:"history_length,omitempty"`
	// ReturnImmediately — proto: `bool return_immediately = 4`.
	ReturnImmediately bool `json:"return_immediately,omitempty"`
}

SendMessageConfiguration is the configuration of a send-message request.

Proto: message SendMessageConfiguration.

type SendMessageRequest

type SendMessageRequest struct {
	// Tenant — proto: `string tenant = 1`. Provided as path parameter.
	Tenant string `json:"tenant,omitempty"`
	// Message — proto: `Message message = 2` (REQUIRED).
	Message Message `json:"message"`
	// Configuration — proto: `SendMessageConfiguration configuration = 3`.
	Configuration *SendMessageConfiguration `json:"configuration,omitempty"`
	// Metadata — proto: `google.protobuf.Struct metadata = 4`.
	Metadata map[string]any `json:"metadata,omitempty"`
}

SendMessageRequest represents a request for the SendMessage method.

Proto: message SendMessageRequest.

type SendMessageResponse

type SendMessageResponse struct {
	// Task — proto: `Task task = 1` variant.
	Task *Task `json:"task,omitempty"`
	// Message — proto: `Message message = 2` variant.
	Message *Message `json:"message,omitempty"`
}

SendMessageResponse represents the response for the SendMessage method.

Proto: message SendMessageResponse (oneof payload { Task task; Message message; }).

Discriminated-union semantics: exactly one of Task or Message is non-nil on a valid response. `Kind()` returns "task" or "message".

func (SendMessageResponse) Kind

func (r SendMessageResponse) Kind() string

Kind returns the variant discriminator. Empty when neither variant is set (an invalid state).

type StreamResponse

type StreamResponse struct {
	// Task — proto: `Task task = 1`.
	Task *Task `json:"task,omitempty"`
	// Message — proto: `Message message = 2`.
	Message *Message `json:"message,omitempty"`
	// StatusUpdate — proto: `TaskStatusUpdateEvent status_update = 3`.
	StatusUpdate *TaskStatusUpdateEvent `json:"status_update,omitempty"`
	// ArtifactUpdate — proto: `TaskArtifactUpdateEvent artifact_update = 4`.
	ArtifactUpdate *TaskArtifactUpdateEvent `json:"artifact_update,omitempty"`
}

StreamResponse is the wrapper object used in streaming operations. Holds one of: Task, Message, TaskStatusUpdateEvent, TaskArtifactUpdateEvent.

Proto: message StreamResponse.

Exactly one field is non-nil on a valid response. `Kind()` returns the variant discriminator.

func (StreamResponse) Kind

func (r StreamResponse) Kind() string

Kind returns the variant discriminator, or empty when no variant set.

func (StreamResponse) Validate

func (r StreamResponse) Validate() error

Validate reports whether exactly one variant is set. Returns ErrInvalidOneof when zero or more than one variant is non-nil.

type StringList

type StringList struct {
	// List — proto: `repeated string list = 1`.
	List []string `json:"list,omitempty"`
}

StringList is a list of strings.

Proto: message StringList.

type SubscribeToTaskRequest

type SubscribeToTaskRequest struct {
	// Tenant — proto: `string tenant = 1`.
	Tenant string `json:"tenant,omitempty"`
	// ID — proto: `string id = 2` (REQUIRED).
	ID string `json:"id"`
}

SubscribeToTaskRequest represents a request for the SubscribeToTask method.

Proto: message SubscribeToTaskRequest.

type Task

type Task struct {
	// ID — proto: `string id = 1` (REQUIRED). Unique identifier (e.g. UUID).
	ID string `json:"id"`
	// ContextID — proto: `string context_id = 2`.
	ContextID string `json:"context_id,omitempty"`
	// Status — proto: `TaskStatus status = 3` (REQUIRED).
	Status TaskStatus `json:"status"`
	// Artifacts — proto: `repeated Artifact artifacts = 4`.
	Artifacts []Artifact `json:"artifacts,omitempty"`
	// History — proto: `repeated Message history = 5`.
	History []Message `json:"history,omitempty"`
	// Metadata — proto: `google.protobuf.Struct metadata = 6`.
	Metadata map[string]any `json:"metadata,omitempty"`
}

Task is the core unit of action for A2A.

Proto: message Task ("`Task` is the core unit of action for A2A. It has a current status and when results are created for the task they are stored in the artifact. If there are multiple turns for a task, these are stored in history.").

type TaskArtifactUpdateEvent

type TaskArtifactUpdateEvent struct {
	// TaskID — proto: `string task_id = 1` (REQUIRED).
	TaskID string `json:"task_id"`
	// ContextID — proto: `string context_id = 2` (REQUIRED).
	ContextID string `json:"context_id"`
	// Artifact — proto: `Artifact artifact = 3` (REQUIRED).
	Artifact Artifact `json:"artifact"`
	// Append — proto: `bool append = 4`.
	Append bool `json:"append,omitempty"`
	// LastChunk — proto: `bool last_chunk = 5`.
	LastChunk bool `json:"last_chunk,omitempty"`
	// Metadata — proto: `google.protobuf.Struct metadata = 6`.
	Metadata map[string]any `json:"metadata,omitempty"`
}

TaskArtifactUpdateEvent is a task delta where an artifact has been generated.

Proto: message TaskArtifactUpdateEvent.

type TaskPushNotificationConfig

type TaskPushNotificationConfig struct {
	// Tenant — proto: `string tenant = 1`.
	Tenant string `json:"tenant,omitempty"`
	// ID — proto: `string id = 2`. Unique identifier (e.g. UUID) for the config.
	ID string `json:"id,omitempty"`
	// TaskID — proto: `string task_id = 3`.
	TaskID string `json:"task_id,omitempty"`
	// URL — proto: `string url = 4` (REQUIRED).
	URL string `json:"url"`
	// Token — proto: `string token = 5`.
	Token string `json:"token,omitempty"`
	// Authentication — proto: `AuthenticationInfo authentication = 6`.
	Authentication *AuthenticationInfo `json:"authentication,omitempty"`
}

TaskPushNotificationConfig is a per-task push-notification configuration.

Proto: message TaskPushNotificationConfig.

type TaskState

type TaskState int32

TaskState defines the possible lifecycle states of a Task.

Proto: enum TaskState (`docs/specifications/a2a.proto` §enum TaskState).

const (
	// TaskStateUnspecified — the task is in an unknown or indeterminate state.
	TaskStateUnspecified TaskState = 0
	// TaskStateSubmitted — task has been successfully submitted and acknowledged.
	TaskStateSubmitted TaskState = 1
	// TaskStateWorking — task is actively being processed by the agent.
	TaskStateWorking TaskState = 2
	// TaskStateCompleted — task has finished successfully. Terminal.
	TaskStateCompleted TaskState = 3
	// TaskStateFailed — task has finished with an error. Terminal.
	TaskStateFailed TaskState = 4
	// TaskStateCanceled — task was canceled before completion. Terminal.
	TaskStateCanceled TaskState = 5
	// TaskStateInputRequired — agent requires additional user input. Interrupted.
	TaskStateInputRequired TaskState = 6
	// TaskStateRejected — agent has decided to not perform the task. Terminal.
	TaskStateRejected TaskState = 7
	// TaskStateAuthRequired — authentication is required to proceed. Interrupted.
	TaskStateAuthRequired TaskState = 8
)

TaskState values mirror the proto's `TASK_STATE_*` constants.

func (TaskState) IsValid

func (s TaskState) IsValid() bool

IsValid reports whether s is one of the 9 canonical values.

func (TaskState) MarshalJSON

func (s TaskState) MarshalJSON() ([]byte, error)

MarshalJSON emits the canonical wire string.

func (TaskState) String

func (s TaskState) String() string

String returns the canonical wire name (TASK_STATE_*).

func (*TaskState) UnmarshalJSON

func (s *TaskState) UnmarshalJSON(data []byte) error

UnmarshalJSON accepts either the canonical wire string or the integer form (proto3 JSON allows both).

type TaskStatus

type TaskStatus struct {
	// State — proto: `TaskState state = 1` (REQUIRED).
	State TaskState `json:"state"`
	// Message — proto: `Message message = 2`.
	Message *Message `json:"message,omitempty"`
	// Timestamp — proto: `google.protobuf.Timestamp timestamp = 3`. ISO 8601.
	Timestamp time.Time `json:"timestamp,omitempty"`
}

TaskStatus is a container for the status of a task.

Proto: message TaskStatus.

type TaskStatusUpdateEvent

type TaskStatusUpdateEvent struct {
	// TaskID — proto: `string task_id = 1` (REQUIRED).
	TaskID string `json:"task_id"`
	// ContextID — proto: `string context_id = 2` (REQUIRED).
	ContextID string `json:"context_id"`
	// Status — proto: `TaskStatus status = 3` (REQUIRED).
	Status TaskStatus `json:"status"`
	// Metadata — proto: `google.protobuf.Struct metadata = 4`.
	Metadata map[string]any `json:"metadata,omitempty"`
}

TaskStatusUpdateEvent is emitted by the agent to notify the client of a change in a task's status.

Proto: message TaskStatusUpdateEvent.

type TextPart

type TextPart struct {
	Text string `json:"text"`
	// contains filtered or unexported fields
}

TextPart is the `text` variant of Part.

Proto: `string text = 1` ("The string content of the `text` part.").

func (*TextPart) Kind

func (p *TextPart) Kind() string

Kind returns PartKindText.

type URLPart

type URLPart struct {
	URL string `json:"url"`
	// contains filtered or unexported fields
}

URLPart is the `url` variant of Part.

Proto: `string url = 3` ("A url pointing to the file's content.").

func (*URLPart) Kind

func (p *URLPart) Kind() string

Kind returns PartKindURL.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL