types

package
v0.34.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: Apache-2.0 Imports: 8 Imported by: 9

Documentation

Overview

Package types provides primitives to interact with the openapi HTTP API.

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.8.0 DO NOT EDIT.

Index

Constants

View Source
const (
	HealthStatusHealthy   = "healthy"
	HealthStatusDegraded  = "degraded"
	HealthStatusUnhealthy = "unhealthy"
)

Health status constants

View Source
const (
	EventDelta               = "adk.agent.delta"
	EventIterationCompleted  = "adk.agent.iteration.completed"
	EventToolStarted         = "adk.agent.tool.started"
	EventToolCompleted       = "adk.agent.tool.completed"
	EventToolFailed          = "adk.agent.tool.failed"
	EventToolResult          = "adk.agent.tool.result"
	EventInputRequired       = "adk.agent.input.required"
	EventTaskInterrupted     = "adk.agent.task.interrupted"
	EventTaskStatusChanged   = "adk.agent.task.status.changed"
	EventStreamFailed        = "adk.agent.stream.failed"
	EventTaskArtifactUpdated = "adk.agent.task.artifact.updated"
)

CloudEvent type constants for agent streaming operations

View Source
const (
	UsageMetadataKey          = UsageExtensionURI + "/usage"
	ExecutionStatsMetadataKey = UsageExtensionURI + "/execution_stats"
)

Task metadata keys written by the usage extension.

View Source
const A2AProtocolVersion = "1.0"

A2AProtocolVersion is the A2A protocol version this ADK speaks, sent and checked as the A2A-Version header (spec section 3.6).

View Source
const (
	ToolInputRequired = "input_required"
)

Tool name constants

View Source
const UsageExtensionURI = "https://github.com/inference-gateway/schemas/tree/main/a2a/extensions/usage/v1"

UsageExtensionURI identifies the A2A extension that reports a task's token usage and execution stats in its metadata. It is inactive unless the client lists it in the A2A-Extensions header.

Variables

View Source
var (
	ErrParseError     = errors.New("parse error")
	ErrInvalidRequest = errors.New("invalid request")
	ErrMethodNotFound = errors.New("method not found")
	ErrInvalidParams  = errors.New("invalid params")
	ErrInternalError  = errors.New("internal error")
	ErrServerError    = errors.New("server error")

	ErrTaskNotFound                   = errors.New("task not found")
	ErrTaskNotCancelable              = errors.New("task not cancelable")
	ErrPushNotificationNotSupported   = errors.New("push notification not supported")
	ErrUnsupportedOperation           = errors.New("unsupported operation")
	ErrExtendedAgentCardNotConfigured = errors.New("extended agent card not configured")
	ErrVersionNotSupported            = errors.New("version not supported")
)

Sentinel errors for the JSON-RPC and A2A error codes of the A2A spec, so callers can match a failure with errors.Is instead of parsing the error message.

Functions

func MarshalParts added in v0.14.0

func MarshalParts(parts []Part) ([]byte, error)

MarshalParts is a utility function to marshal a slice of Parts

func NewAgentEvent added in v0.9.4

func NewAgentEvent(eventType, eventID string, data map[string]any) cloudevents.Event

NewAgentEvent creates a CloudEvent for agent lifecycle events

func NewDeltaEvent added in v0.9.4

func NewDeltaEvent(message *Message) cloudevents.Event

NewDeltaEvent creates a CloudEvent for streaming deltas, with the message in the data field

func NewIterationCompletedEvent added in v0.9.4

func NewIterationCompletedEvent(iteration int, taskID string, finalMessage *Message) cloudevents.Event

NewIterationCompletedEvent creates a CloudEvent for iteration completed with the final message

func NewMessageEvent added in v0.9.4

func NewMessageEvent(eventType, eventID string, message *Message) cloudevents.Event

NewMessageEvent creates a CloudEvent with a message payload and custom event type

Types

type A2AMethod added in v0.31.0

type A2AMethod string

A2AMethod The A2A method to invoke.

const (
	A2AMethodCancelTask                       A2AMethod = "CancelTask"
	A2AMethodCreateTaskPushNotificationConfig A2AMethod = "CreateTaskPushNotificationConfig"
	A2AMethodDeleteTaskPushNotificationConfig A2AMethod = "DeleteTaskPushNotificationConfig"
	A2AMethodGetExtendedAgentCard             A2AMethod = "GetExtendedAgentCard"
	A2AMethodGetTask                          A2AMethod = "GetTask"
	A2AMethodGetTaskPushNotificationConfig    A2AMethod = "GetTaskPushNotificationConfig"
	A2AMethodListTaskPushNotificationConfigs  A2AMethod = "ListTaskPushNotificationConfigs"
	A2AMethodListTasks                        A2AMethod = "ListTasks"
	A2AMethodSendMessage                      A2AMethod = "SendMessage"
	A2AMethodSendStreamingMessage             A2AMethod = "SendStreamingMessage"
	A2AMethodSubscribeToTask                  A2AMethod = "SubscribeToTask"
)

Defines values for A2AMethod.

func (A2AMethod) Valid added in v0.31.0

func (e A2AMethod) Valid() bool

Valid indicates whether the value is a known member of the A2AMethod enum.

type APIKeySecurityScheme

type APIKeySecurityScheme struct {
	// Description An optional description for the security scheme.
	Description *string `json:"description,omitempty"`

	// Location The location of the API key. Valid values are "query", "header", or "cookie".
	Location string `json:"location"`

	// Name The name of the header, query, or cookie parameter to be used.
	Name string `json:"name"`
}

APIKeySecurityScheme Defines a security scheme using an API key.

type AgentCapabilities

type AgentCapabilities struct {
	// ExtendedAgentCard Indicates if the agent supports providing an extended agent card when authenticated.
	ExtendedAgentCard *bool `json:"extendedAgentCard,omitempty"`

	// Extensions A list of protocol extensions supported by the agent.
	Extensions []AgentExtension `json:"extensions,omitempty"`

	// PushNotifications Indicates if the agent supports sending push notifications for asynchronous task updates.
	PushNotifications *bool `json:"pushNotifications,omitempty"`

	// Streaming Indicates if the agent supports streaming responses.
	Streaming *bool `json:"streaming,omitempty"`
}

AgentCapabilities Defines optional capabilities supported by an agent.

type AgentCard

type AgentCard struct {
	// Capabilities A2A Capability set supported by the agent.
	Capabilities AgentCapabilities `json:"capabilities"`

	// DefaultInputModes protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
	//  The set of interaction modes that the agent supports across all skills.
	//  This can be overridden per skill. Defined as media types.
	DefaultInputModes []string `json:"defaultInputModes"`

	// DefaultOutputModes The media types supported as outputs from this agent.
	DefaultOutputModes []string `json:"defaultOutputModes"`

	// Description A human-readable description of the agent, assisting users and other agents
	//  in understanding its purpose.
	//  Example: "Agent that helps users with recipes and cooking."
	Description string `json:"description"`

	// DocumentationURL A URL providing additional documentation about the agent.
	DocumentationURL *string `json:"documentationUrl,omitempty"`

	// IconURL Optional. A URL to an icon for the agent.
	IconURL *string `json:"iconUrl,omitempty"`

	// Name A human readable name for the agent.
	//  Example: "Recipe Agent"
	Name string `json:"name"`

	// Provider The service provider of the agent.
	Provider *AgentProvider `json:"provider,omitempty"`

	// SecurityRequirements Security requirements for contacting the agent.
	SecurityRequirements []SecurityRequirement `json:"securityRequirements,omitempty"`

	// SecuritySchemes The security scheme details used for authenticating with this agent.
	SecuritySchemes map[string]SecurityScheme `json:"securitySchemes,omitempty"`

	// Signatures JSON Web Signatures computed for this `AgentCard`.
	Signatures []AgentCardSignature `json:"signatures,omitempty"`

	// Skills Skills represent the abilities of an agent.
	//  It is largely a descriptive concept but represents a more focused set of behaviors that the
	//  agent is likely to succeed at.
	Skills []AgentSkill `json:"skills"`

	// SupportedInterfaces Ordered list of supported interfaces. The first entry is preferred.
	SupportedInterfaces []AgentInterface `json:"supportedInterfaces"`

	// Version The version of the agent.
	//  Example: "1.0.0"
	Version string `json:"version"`
}

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.
Next ID: 20

type AgentCardSignature added in v0.8.0

type AgentCardSignature struct {
	// Header The unprotected JWS header values.
	Header *Struct `json:"header,omitempty"`

	// Protected (-- api-linter: core::0140::reserved-words=disabled
	//      aip.dev/not-precedent: Backwards compatibility --)
	//  Required. The protected JWS header for the signature. This is always a
	//  base64url-encoded JSON object.
	Protected string `json:"protected"`

	// Signature Required. The computed signature, base64url-encoded.
	Signature string `json:"signature"`
}

AgentCardSignature AgentCardSignature represents a JWS signature of an AgentCard.

This follows the JSON format of an RFC 7515 JSON Web Signature (JWS).

type AgentExtension

type AgentExtension struct {
	// Description A human-readable description of how this agent uses the extension.
	Description *string `json:"description,omitempty"`

	// Params Optional. Extension-specific configuration parameters.
	Params *Struct `json:"params,omitempty"`

	// Required If true, the client must understand and comply with the extension's requirements.
	Required *bool `json:"required,omitempty"`

	// URI The unique URI identifying the extension.
	URI *string `json:"uri,omitempty"`
}

AgentExtension A declaration of a protocol extension supported by an Agent.

type AgentInterface

type AgentInterface struct {
	// ProtocolBinding The protocol binding supported at this URL. This is an open form string, to be
	//  easily extended for other protocol bindings. The core ones officially
	//  supported are `JSONRPC`, `GRPC` and `HTTP+JSON`.
	ProtocolBinding string `json:"protocolBinding"`

	// ProtocolVersion The version of the A2A protocol this interface exposes.
	//  Use the latest supported minor version per major version.
	//  Examples: "0.3", "1.0"
	ProtocolVersion string `json:"protocolVersion"`

	// Tenant Optional. An opaque string used for routing requests to a specific agent
	//  or tenant when multiple agents are served behind a single A2A endpoint.
	//  When set, clients MUST include this value in the `tenant` field of all
	//  request messages sent to this interface. The server is responsible for
	//  interpreting the value and routing requests accordingly; the protocol
	//  does not define its format or semantics.
	Tenant *string `json:"tenant,omitempty"`

	// URL The URL where this interface is available. Must be a valid absolute HTTPS URL in production.
	//  Example: "https://api.example.com/a2a/v1", "https://grpc.example.com/a2a"
	URL string `json:"url"`
}

AgentInterface Declares a combination of a target URL, transport and protocol version for interacting with the agent.

This allows agents to expose the same functionality over multiple protocol binding mechanisms.

type AgentProvider

type AgentProvider struct {
	// Organization The name of the agent provider's organization.
	//  Example: "Google"
	Organization string `json:"organization"`

	// URL A URL for the agent provider's website or relevant documentation.
	//  Example: "https://ai.google.dev"
	URL string `json:"url"`
}

AgentProvider Represents the service provider of an agent.

type AgentSkill

type AgentSkill struct {
	// Description A detailed description of the skill.
	Description string `json:"description"`

	// Examples Example prompts or scenarios that this skill can handle.
	Examples []string `json:"examples,omitempty"`

	// ID A unique identifier for the agent's skill.
	ID string `json:"id"`

	// InputModes The set of supported input media types for this skill, overriding the agent's defaults.
	InputModes []string `json:"inputModes,omitempty"`

	// Name A human-readable name for the skill.
	Name string `json:"name"`

	// OutputModes The set of supported output media types for this skill, overriding the agent's defaults.
	OutputModes []string `json:"outputModes,omitempty"`

	// SecurityRequirements Security schemes necessary for this skill.
	SecurityRequirements []SecurityRequirement `json:"securityRequirements,omitempty"`

	// Tags A set of keywords describing the skill's capabilities.
	Tags []string `json:"tags"`
}

AgentSkill Represents a distinct capability or function that an agent can perform.

type Artifact

type Artifact struct {
	// ArtifactID Unique identifier (e.g. UUID) for the artifact. It must be unique within a task.
	ArtifactID string `json:"artifactId"`

	// Description Optional. A human readable description of the artifact.
	Description *string `json:"description,omitempty"`

	// Extensions The URIs of extensions that are present or contributed to this Artifact.
	Extensions []string `json:"extensions,omitempty"`

	// Metadata Optional. Metadata included with the artifact.
	Metadata *Struct `json:"metadata,omitempty"`

	// Name A human readable name for the artifact.
	Name *string `json:"name,omitempty"`

	// Parts The content of the artifact. Must contain at least one part.
	Parts []Part `json:"parts"`
}

Artifact Artifacts represent task outputs.

type AuthenticationInfo added in v0.17.0

type AuthenticationInfo struct {
	// Credentials Push Notification credentials. Format depends on the scheme (e.g., token for Bearer).
	Credentials *string `json:"credentials,omitempty"`

	// Scheme HTTP Authentication Scheme from the [IANA registry](https://www.iana.org/assignments/http-authschemes/).
	//  Examples: `Bearer`, `Basic`, `Digest`.
	//  Scheme names are case-insensitive per [RFC 9110 Section 11.1](https://www.rfc-editor.org/rfc/rfc9110#section-11.1).
	Scheme string `json:"scheme"`
}

AuthenticationInfo Defines authentication details, used for push notifications.

type AuthorizationCodeOAuthFlow

type AuthorizationCodeOAuthFlow struct {
	// AuthorizationURL The authorization URL to be used for this flow.
	AuthorizationURL string `json:"authorizationUrl"`

	// PkceRequired Indicates if PKCE (RFC 7636) is required for this flow.
	//  PKCE should always be used for public clients and is recommended for all clients.
	PkceRequired *bool `json:"pkceRequired,omitempty"`

	// RefreshURL The URL to be used for obtaining refresh tokens.
	RefreshURL *string `json:"refreshUrl,omitempty"`

	// Scopes The available scopes for the OAuth2 security scheme.
	Scopes map[string]string `json:"scopes"`

	// TokenURL The token URL to be used for this flow.
	TokenURL string `json:"tokenUrl"`
}

AuthorizationCodeOAuthFlow Defines configuration details for the OAuth 2.0 Authorization Code flow.

type CancelTaskRequest

type CancelTaskRequest struct {
	// ID The resource ID of the task to cancel.
	ID string `json:"id"`

	// Metadata A flexible key-value map for passing additional context or parameters.
	Metadata *Struct `json:"metadata,omitempty"`

	// Tenant Optional. Opaque routing identifier. Must match the `tenant` value from
	//  the selected `AgentInterface` in the Agent Card when that field is set.
	Tenant *string `json:"tenant,omitempty"`
}

CancelTaskRequest Represents a request for the `CancelTask` method.

type ClientCredentialsOAuthFlow

type ClientCredentialsOAuthFlow struct {
	// RefreshURL The URL to be used for obtaining refresh tokens.
	RefreshURL *string `json:"refreshUrl,omitempty"`

	// Scopes The available scopes for the OAuth2 security scheme.
	Scopes map[string]string `json:"scopes"`

	// TokenURL The token URL to be used for this flow.
	TokenURL string `json:"tokenUrl"`
}

ClientCredentialsOAuthFlow Defines configuration details for the OAuth 2.0 Client Credentials flow.

type DeleteTaskPushNotificationConfigRequest

type DeleteTaskPushNotificationConfigRequest struct {
	// ID The resource ID of the configuration to delete.
	ID string `json:"id"`

	// TaskID The parent task resource ID.
	TaskID string `json:"taskId"`

	// Tenant Optional. Opaque routing identifier. Must match the `tenant` value from
	//  the selected `AgentInterface` in the Agent Card when that field is set.
	Tenant *string `json:"tenant,omitempty"`
}

DeleteTaskPushNotificationConfigRequest Represents a request for the `DeleteTaskPushNotificationConfig` method.

type DeviceCodeOAuthFlow added in v0.30.0

type DeviceCodeOAuthFlow struct {
	// DeviceAuthorizationURL The device authorization endpoint URL.
	DeviceAuthorizationURL string `json:"deviceAuthorizationUrl"`

	// RefreshURL The URL to be used for obtaining refresh tokens.
	RefreshURL *string `json:"refreshUrl,omitempty"`

	// Scopes The available scopes for the OAuth2 security scheme.
	Scopes map[string]string `json:"scopes"`

	// TokenURL The token URL to be used for this flow.
	TokenURL string `json:"tokenUrl"`
}

DeviceCodeOAuthFlow Defines configuration details for the OAuth 2.0 Device Code flow (RFC 8628).

This flow is designed for input-constrained devices such as IoT devices,
and CLI tools where the user authenticates on a separate device.

type GetExtendedAgentCardRequest added in v0.17.0

type GetExtendedAgentCardRequest struct {
	// Tenant Optional. Opaque routing identifier. Must match the `tenant` value from
	//  the selected `AgentInterface` in the Agent Card when that field is set.
	Tenant *string `json:"tenant,omitempty"`
}

GetExtendedAgentCardRequest Represents a request for the `GetExtendedAgentCard` method.

type GetTaskPushNotificationConfigRequest

type GetTaskPushNotificationConfigRequest struct {
	// ID The resource ID of the configuration to retrieve.
	ID string `json:"id"`

	// TaskID The parent task resource ID.
	TaskID string `json:"taskId"`

	// Tenant Optional. Opaque routing identifier. Must match the `tenant` value from
	//  the selected `AgentInterface` in the Agent Card when that field is set.
	Tenant *string `json:"tenant,omitempty"`
}

GetTaskPushNotificationConfigRequest Represents a request for the `GetTaskPushNotificationConfig` method.

type GetTaskRequest

type GetTaskRequest struct {
	// HistoryLength The maximum number of most recent messages from the task's history to retrieve. An
	//  unset value means the client does not impose any limit. A value of zero is
	//  a request to not include any messages. The server MUST NOT return more
	//  messages than the provided value, but MAY apply a lower limit.
	HistoryLength *int `json:"historyLength,omitempty"`

	// ID The resource ID of the task to retrieve.
	ID string `json:"id"`

	// Tenant Optional. Opaque routing identifier. Must match the `tenant` value from
	//  the selected `AgentInterface` in the Agent Card when that field is set.
	Tenant *string `json:"tenant,omitempty"`
}

GetTaskRequest Represents a request for the `GetTask` method.

type HTTPAuthSecurityScheme

type HTTPAuthSecurityScheme struct {
	// BearerFormat A hint to the client to identify how the bearer token is formatted (e.g., "JWT").
	//  Primarily for documentation purposes.
	BearerFormat *string `json:"bearerFormat,omitempty"`

	// Description An optional description for the security scheme.
	Description *string `json:"description,omitempty"`

	// Scheme The name of the HTTP Authentication scheme to be used in the Authorization header,
	//  as defined in RFC7235 (e.g., "Bearer").
	//  This value should be registered in the IANA Authentication Scheme registry.
	Scheme string `json:"scheme"`
}

HTTPAuthSecurityScheme Defines a security scheme using HTTP authentication.

type HTTPStatusError added in v0.34.0

type HTTPStatusError struct {
	Operation  string
	StatusCode int
	Body       string
}

HTTPStatusError reports an unexpected HTTP status from an A2A endpoint. Operation names the request that failed and is empty for the JSON-RPC endpoint.

func (*HTTPStatusError) Error added in v0.34.0

func (e *HTTPStatusError) Error() string

type ImplicitOAuthFlow

type ImplicitOAuthFlow struct {
	// AuthorizationURL The authorization URL to be used for this flow. This MUST be in the
	//  form of a URL. The OAuth2 standard requires the use of TLS
	AuthorizationURL *string `json:"authorizationUrl,omitempty"`

	// RefreshURL The URL to be used for obtaining refresh tokens. This MUST be in the
	//  form of a URL. The OAuth2 standard requires the use of TLS.
	RefreshURL *string `json:"refreshUrl,omitempty"`

	// Scopes The available scopes for the OAuth2 security scheme. A map between the
	//  scope name and a short description for it. The map MAY be empty.
	Scopes map[string]string `json:"scopes,omitempty"`
}

ImplicitOAuthFlow Deprecated: Use Authorization Code + PKCE instead.

type JSONRPCError

type JSONRPCError struct {
	// Code The error code, e.g. -32601 for an unknown method.
	Code int `json:"code"`

	// Data Additional information about the error.
	Data *Value `json:"data,omitempty"`

	// Message A short description of the error.
	Message string `json:"message"`
}

JSONRPCError A JSON-RPC 2.0 error object; A2A error codes are mapped in spec section 5.4.

Hand-written by inference-gateway, not part of the official a2a.proto, which does not model
the JSON-RPC binding.

func (*JSONRPCError) Error added in v0.34.0

func (e *JSONRPCError) Error() string

func (*JSONRPCError) Unwrap added in v0.34.0

func (e *JSONRPCError) Unwrap() error

Unwrap exposes the sentinel for the error code, or nil for an unknown code.

type JSONRPCErrorResponse

type JSONRPCErrorResponse struct {
	// Error The error that occurred.
	Error JSONRPCError `json:"error"`

	// ID The id of the request this response answers, or null when it could not be read.
	ID Value `json:"id"`

	// JSONRPC The JSON-RPC version, always "2.0".
	JSONRPC string `json:"jsonrpc"`
}

JSONRPCErrorResponse A JSON-RPC 2.0 response reporting a failed A2A method call (A2A spec section 9.5).

Hand-written by inference-gateway, not part of the official a2a.proto, which does not model
the JSON-RPC binding.

type JSONRPCRequest

type JSONRPCRequest struct {
	// ID The request id: a string, a number or null. Omitted for notifications.
	ID *Value `json:"id,omitempty"`

	// JSONRPC The JSON-RPC version, always "2.0".
	JSONRPC string `json:"jsonrpc"`

	// Method The A2A method to invoke.
	Method A2AMethod `json:"method"`

	// Params The method's request message, e.g. a SendMessageRequest for SendMessage.
	Params *Struct `json:"params,omitempty"`
}

JSONRPCRequest A JSON-RPC 2.0 request to an A2A agent (A2A spec section 9.3).

Hand-written by inference-gateway, not part of the official a2a.proto, which does not model
the JSON-RPC binding.

type JSONRPCSuccessResponse

type JSONRPCSuccessResponse struct {
	// ID The id of the request this response answers.
	ID Value `json:"id"`

	// JSONRPC The JSON-RPC version, always "2.0".
	JSONRPC string `json:"jsonrpc"`

	// Result The method's response message, e.g. a Task for GetTask.
	Result Value `json:"result"`
}

JSONRPCSuccessResponse A JSON-RPC 2.0 response carrying the result of an A2A method (A2A spec section 9).

Hand-written by inference-gateway, not part of the official a2a.proto, which does not model
the JSON-RPC binding.

type ListTaskPushNotificationConfigsRequest added in v0.30.0

type ListTaskPushNotificationConfigsRequest struct {
	// PageSize The maximum number of configurations to return.
	PageSize *int `json:"pageSize,omitempty"`

	// PageToken A page token received from a previous `ListTaskPushNotificationConfigsRequest` call.
	PageToken *string `json:"pageToken,omitempty"`

	// TaskID The parent task resource ID.
	TaskID string `json:"taskId"`

	// Tenant Optional. Opaque routing identifier. Must match the `tenant` value from
	//  the selected `AgentInterface` in the Agent Card when that field is set.
	Tenant *string `json:"tenant,omitempty"`
}

ListTaskPushNotificationConfigsRequest Represents a request for the `ListTaskPushNotificationConfigs` method.

type ListTaskPushNotificationConfigsResponse added in v0.30.0

type ListTaskPushNotificationConfigsResponse struct {
	// Configs The list of push notification configurations.
	Configs []TaskPushNotificationConfig `json:"configs,omitempty"`

	// NextPageToken A token to retrieve the next page of results, or empty if there are no more results in the list.
	NextPageToken *string `json:"nextPageToken,omitempty"`
}

ListTaskPushNotificationConfigsResponse Represents a successful response for the `ListTaskPushNotificationConfigs`

method.

type ListTasksRequest

type ListTasksRequest struct {
	// ContextID Filter tasks by context ID to get tasks from a specific conversation or session.
	ContextID *string `json:"contextId,omitempty"`

	// HistoryLength The maximum number of messages to include in each task's history.
	HistoryLength *int `json:"historyLength,omitempty"`

	// IncludeArtifacts Whether to include artifacts in the returned tasks.
	//  Defaults to false to reduce payload size.
	IncludeArtifacts *bool `json:"includeArtifacts,omitempty"`

	// PageSize The maximum number of tasks to return. The service may return fewer than this value.
	//  If unspecified, at most 50 tasks will be returned.
	//  The minimum value is 1.
	//  The maximum value is 100.
	PageSize *int `json:"pageSize,omitempty"`

	// PageToken A page token, received from a previous `ListTasks` call.
	//  `ListTasksResponse.next_page_token`.
	//  Provide this to retrieve the subsequent page.
	PageToken *string `json:"pageToken,omitempty"`

	// Status Filter tasks by their current status state.
	Status *TaskState `json:"status,omitempty"`

	// StatusTimestampAfter Filter tasks which have a status updated after the provided timestamp in ISO 8601 format (e.g., "2023-10-27T10:00:00Z").
	//  Only tasks with a status timestamp time greater than or equal to this value will be returned.
	StatusTimestampAfter *Timestamp `json:"statusTimestampAfter,omitempty"`

	// Tenant Optional. Opaque routing identifier. Must match the `tenant` value from
	//  the selected `AgentInterface` in the Agent Card when that field is set.
	Tenant *string `json:"tenant,omitempty"`
}

ListTasksRequest Parameters for listing tasks with optional filtering criteria.

type ListTasksResponse

type ListTasksResponse struct {
	// NextPageToken A token to retrieve the next page of results, or empty if there are no more results in the list.
	NextPageToken string `json:"nextPageToken"`

	// PageSize The page size used for this response.
	PageSize int `json:"pageSize"`

	// Tasks Array of tasks matching the specified criteria.
	Tasks []Task `json:"tasks"`

	// TotalSize Total number of tasks available (before pagination).
	TotalSize int `json:"totalSize"`
}

ListTasksResponse Result object for `ListTasks` method containing an array of tasks and pagination information.

type Message

type Message struct {
	// ContextID Optional. The context id of the message. If set, the message will be associated with the given context.
	ContextID *string `json:"contextId,omitempty"`

	// Extensions The URIs of extensions that are present or contributed to this Message.
	Extensions []string `json:"extensions,omitempty"`

	// MessageID The unique identifier (e.g. UUID) of the message. This is created by the message creator.
	MessageID string `json:"messageId"`

	// Metadata Optional. Any metadata to provide along with the message.
	Metadata *Struct `json:"metadata,omitempty"`

	// Parts Parts is the container of the message content.
	Parts []Part `json:"parts"`

	// ReferenceTaskIDs A list of task IDs that this message references for additional context.
	ReferenceTaskIDs []string `json:"referenceTaskIds,omitempty"`

	// Role Identifies the sender of the message.
	Role Role `json:"role"`

	// TaskID Optional. The task id of the message. If set, the message will be associated with the given task.
	TaskID *string `json:"taskId,omitempty"`
}

Message `Message` is one unit of communication between client and server. It can be

associated with a context and/or a task. For server messages, `context_id` must
be provided, and `task_id` only if a task was created. For client messages, both
fields are optional, with the caveat that if both are provided, they have to
match (the `context_id` has to be the one that is set on the task). If only
`task_id` is provided, the server will infer `context_id` from it.

func NewAssistantMessage added in v0.9.4

func NewAssistantMessage(messageID string, parts []Part) *Message

NewAssistantMessage creates a standardized assistant message

func NewInputRequiredMessage added in v0.9.4

func NewInputRequiredMessage(toolCallID, message string) *Message

NewInputRequiredMessage creates an input required message

func NewStreamingStatusMessage added in v0.9.4

func NewStreamingStatusMessage(messageID, status string, metadata map[string]any) *Message

NewStreamingStatusMessage creates a status message for streaming

func NewToolResultMessage added in v0.9.4

func NewToolResultMessage(toolCallID string, toolName string, result any, hasError bool) *Message

NewToolResultMessage creates a standardized tool result message

func (*Message) UnmarshalJSON added in v0.14.0

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

UnmarshalJSON custom unmarshaler for Message that properly handles typed Parts

type MutualTLSSecurityScheme added in v0.8.0

type MutualTLSSecurityScheme struct {
	// Description An optional description for the security scheme.
	Description *string `json:"description,omitempty"`
}

MutualTLSSecurityScheme Defines a security scheme using mTLS authentication.

type OAuth2SecurityScheme

type OAuth2SecurityScheme struct {
	// Description An optional description for the security scheme.
	Description *string `json:"description,omitempty"`

	// Flows An object containing configuration information for the supported OAuth 2.0 flows.
	Flows OAuthFlows `json:"flows"`

	// Oauth2MetadataURL URL to the OAuth2 authorization server metadata [RFC 8414](https://datatracker.ietf.org/doc/html/rfc8414).
	//  TLS is required.
	Oauth2MetadataURL *string `json:"oauth2MetadataUrl,omitempty"`
}

OAuth2SecurityScheme Defines a security scheme using OAuth 2.0.

type OAuthFlows

type OAuthFlows struct {
	// AuthorizationCode Configuration for the OAuth Authorization Code flow.
	AuthorizationCode *AuthorizationCodeOAuthFlow `json:"authorizationCode,omitempty"`

	// ClientCredentials Configuration for the OAuth Client Credentials flow.
	ClientCredentials *ClientCredentialsOAuthFlow `json:"clientCredentials,omitempty"`

	// DeviceCode Configuration for the OAuth Device Code flow.
	DeviceCode *DeviceCodeOAuthFlow `json:"deviceCode,omitempty"`

	// Implicit Deprecated: Use Authorization Code + PKCE instead.
	Implicit *ImplicitOAuthFlow `json:"implicit,omitempty"`

	// Password Deprecated: Use Authorization Code + PKCE or Device Code.
	Password *PasswordOAuthFlow `json:"password,omitempty"`
}

OAuthFlows Defines the configuration for the supported OAuth 2.0 flows.

type OpenIDConnectSecurityScheme added in v0.25.0

type OpenIDConnectSecurityScheme struct {
	// Description An optional description for the security scheme.
	Description *string `json:"description,omitempty"`

	// OpenIDConnectURL The [OpenID Connect Discovery URL](https://openid.net/specs/openid-connect-discovery-1_0.html) for the OIDC provider's metadata.
	OpenIDConnectURL string `json:"openIdConnectUrl"`
}

OpenIDConnectSecurityScheme Defines a security scheme using OpenID Connect.

type Part

type Part struct {
	// Data Arbitrary structured `data` as a JSON value (object, array, string, number, boolean, or null).
	Data *Value `json:"data,omitempty"`

	// Filename An optional `filename` for the file (e.g., "document.pdf").
	Filename *string `json:"filename,omitempty"`

	// MediaType The `media_type` (MIME type) of the part content (e.g., "text/plain", "application/json", "image/png").
	//  This field is available for all part types.
	MediaType *string `json:"mediaType,omitempty"`

	// Metadata Optional. metadata associated with this part.
	Metadata *Struct `json:"metadata,omitempty"`

	// Raw The `raw` byte content of a file. In JSON serialization, this is encoded as a base64 string.
	Raw *string `json:"raw,omitempty"`

	// Text The string content of the `text` part.
	Text *string `json:"text,omitempty"`

	// URL A `url` pointing to the file's content.
	URL *string `json:"url,omitempty"`
}

Part `Part` represents a container for a section of communication content.

Parts can be purely textual, some sort of file (image, video, etc) or
a structured data blob (i.e. JSON).

func CreateDataPart added in v0.14.0

func CreateDataPart(data map[string]any, metadata ...map[string]any) Part

CreateDataPart creates a Part with structured data content

func CreateFilePart added in v0.14.0

func CreateFilePart(filename, mediaType string, raw *string, url *string, metadata ...map[string]any) Part

CreateFilePart creates a Part with file content, either inline (base64 in raw) or by URL

func CreateTextPart added in v0.14.0

func CreateTextPart(text string, metadata ...map[string]any) Part

CreateTextPart creates a Part with text content

func NewDataPart added in v0.9.4

func NewDataPart(data map[string]any) Part

NewDataPart creates a generic data part for a message

func NewTextPart added in v0.9.4

func NewTextPart(text string) Part

NewTextPart creates a text part for a message

func NewToolCallPart added in v0.9.4

func NewToolCallPart(toolCallID, toolName string, arguments map[string]any) Part

NewToolCallPart creates a tool call part for a message

func UnmarshalPart added in v0.14.0

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

UnmarshalPart unmarshals a single Part from JSON with proper type handling

func UnmarshalParts added in v0.14.0

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

UnmarshalParts is a utility function to unmarshal a slice of Parts with proper type handling

func (Part) DataMap added in v0.30.0

func (p Part) DataMap() map[string]any

DataMap returns the part's data as an object, or nil when the part has no data or its data is not a JSON object.

func (Part) IsFile added in v0.30.0

func (p Part) IsFile() bool

IsFile reports whether the part carries file content (inline bytes or a URL).

type PasswordOAuthFlow

type PasswordOAuthFlow struct {
	// RefreshURL The URL to be used for obtaining refresh tokens. This MUST be in the
	//  form of a URL. The OAuth2 standard requires the use of TLS.
	RefreshURL *string `json:"refreshUrl,omitempty"`

	// Scopes The available scopes for the OAuth2 security scheme. A map between the
	//  scope name and a short description for it. The map MAY be empty.
	Scopes map[string]string `json:"scopes,omitempty"`

	// TokenURL The token URL to be used for this flow. This MUST be in the form of a URL.
	//  The OAuth2 standard requires the use of TLS.
	TokenURL *string `json:"tokenUrl,omitempty"`
}

PasswordOAuthFlow Deprecated: Use Authorization Code + PKCE or Device Code.

type Role added in v0.17.0

type Role string

Role Identifies the sender of the message.

const (
	RoleAgent       Role = "ROLE_AGENT"
	RoleUnspecified Role = "ROLE_UNSPECIFIED"
	RoleUser        Role = "ROLE_USER"
)

Defines values for Role.

func (Role) Valid added in v0.25.0

func (e Role) Valid() bool

Valid indicates whether the value is a known member of the Role enum.

type SecurityRequirement added in v0.30.0

type SecurityRequirement struct {
	// Schemes A map of security schemes to the required scopes.
	Schemes map[string]StringList `json:"schemes,omitempty"`
}

SecurityRequirement Defines the security requirements for an agent.

type SecurityScheme

type SecurityScheme struct {
	// APIKeySecurityScheme API key-based authentication.
	APIKeySecurityScheme *APIKeySecurityScheme `json:"apiKeySecurityScheme,omitempty"`

	// HTTPAuthSecurityScheme HTTP authentication (Basic, Bearer, etc.).
	HTTPAuthSecurityScheme *HTTPAuthSecurityScheme `json:"httpAuthSecurityScheme,omitempty"`

	// MtlsSecurityScheme Mutual TLS authentication.
	MtlsSecurityScheme *MutualTLSSecurityScheme `json:"mtlsSecurityScheme,omitempty"`

	// Oauth2SecurityScheme OAuth 2.0 authentication.
	Oauth2SecurityScheme *OAuth2SecurityScheme `json:"oauth2SecurityScheme,omitempty"`

	// OpenIDConnectSecurityScheme OpenID Connect authentication.
	OpenIDConnectSecurityScheme *OpenIDConnectSecurityScheme `json:"openIdConnectSecurityScheme,omitempty"`
}

SecurityScheme Defines a security scheme that can be used to secure an agent's endpoints.

This is a discriminated union type based on the OpenAPI 3.2 Security Scheme Object.
See: https://spec.openapis.org/oas/v3.2.0.html#security-scheme-object

type SendMessageConfiguration added in v0.17.0

type SendMessageConfiguration struct {
	// AcceptedOutputModes A list of media types the client is prepared to accept for response parts.
	//  Agents SHOULD use this to tailor their output.
	AcceptedOutputModes []string `json:"acceptedOutputModes,omitempty"`

	// HistoryLength The maximum number of most recent messages from the task's history to retrieve in
	//  the response. An unset value means the client does not impose any limit. A
	//  value of zero is a request to not include any messages. The server MUST NOT
	//  return more messages than the provided value, but MAY apply a lower limit.
	HistoryLength *int `json:"historyLength,omitempty"`

	// ReturnImmediately If `true`, the operation returns immediately after creating the task,
	//  even if processing is still in progress.
	//  If `false` (default), the operation MUST wait until the task reaches a
	//  terminal (`COMPLETED`, `FAILED`, `CANCELED`, `REJECTED`) or interrupted
	//  (`INPUT_REQUIRED`, `AUTH_REQUIRED`) state before returning.
	ReturnImmediately *bool `json:"returnImmediately,omitempty"`

	// TaskPushNotificationConfig Configuration for the agent to send push notifications for task updates.
	//  Task id should be empty when sending this configuration in a `SendMessage` request.
	TaskPushNotificationConfig *TaskPushNotificationConfig `json:"taskPushNotificationConfig,omitempty"`
}

SendMessageConfiguration Configuration of a send message request.

type SendMessageRequest

type SendMessageRequest struct {
	// Configuration Configuration for the send request.
	Configuration *SendMessageConfiguration `json:"configuration,omitempty"`

	// Message The message to send to the agent.
	Message Message `json:"message"`

	// Metadata A flexible key-value map for passing additional context or parameters.
	Metadata *Struct `json:"metadata,omitempty"`

	// Tenant Optional. Opaque routing identifier. Must match the `tenant` value from
	//  the selected `AgentInterface` in the Agent Card when that field is set.
	Tenant *string `json:"tenant,omitempty"`
}

SendMessageRequest Represents a request for the `SendMessage` method.

type SendMessageResponse

type SendMessageResponse struct {
	// Message A message from the agent.
	Message *Message `json:"message,omitempty"`

	// Task The task created or updated by the message.
	Task *Task `json:"task,omitempty"`
}

SendMessageResponse Represents the response for the `SendMessage` method.

type StreamResponse added in v0.17.0

type StreamResponse struct {
	// ArtifactUpdate An event indicating a task artifact update.
	ArtifactUpdate *TaskArtifactUpdateEvent `json:"artifactUpdate,omitempty"`

	// Message A Message object containing a message from the agent.
	Message *Message `json:"message,omitempty"`

	// StatusUpdate An event indicating a task status update.
	StatusUpdate *TaskStatusUpdateEvent `json:"statusUpdate,omitempty"`

	// Task A Task object containing the current state of the task.
	Task *Task `json:"task,omitempty"`
}

StreamResponse A wrapper object used in streaming operations to encapsulate different types of response data.

type StringList added in v0.17.0

type StringList struct {
	// List The individual string values.
	List []string `json:"list,omitempty"`
}

StringList protolint:disable REPEATED_FIELD_NAMES_PLURALIZED

A list of strings.

type Struct added in v0.17.0

type Struct = map[string]any

Struct defines model for Struct.

type SubscribeToTaskRequest added in v0.17.0

type SubscribeToTaskRequest struct {
	// ID The resource ID of the task to subscribe to.
	ID string `json:"id"`

	// Tenant Optional. Opaque routing identifier. Must match the `tenant` value from
	//  the selected `AgentInterface` in the Agent Card when that field is set.
	Tenant *string `json:"tenant,omitempty"`
}

SubscribeToTaskRequest Represents a request for the `SubscribeToTask` method.

type Task

type Task struct {
	// Artifacts A set of output artifacts for a `Task`.
	Artifacts []Artifact `json:"artifacts,omitempty"`

	// ContextID Unique identifier (e.g. UUID) for the contextual collection of interactions
	//  (tasks and messages).
	ContextID *string `json:"contextId,omitempty"`

	// History protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
	//  The history of interactions from a `Task`.
	History []Message `json:"history,omitempty"`

	// ID Unique identifier (e.g. UUID) for the task, generated by the server for a
	//  new task.
	ID string `json:"id"`

	// Metadata protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
	//  A key/value object to store custom metadata about a task.
	Metadata *Struct `json:"metadata,omitempty"`

	// Status The current status of a `Task`, including `state` and a `message`.
	Status TaskStatus `json:"status"`
}

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.

func (*Task) ApplyArtifactUpdate added in v0.32.0

func (t *Task) ApplyArtifactUpdate(update TaskArtifactUpdateEvent)

ApplyArtifactUpdate records an artifact update on the task: parts are appended to the artifact with the same id when the update says append, otherwise the artifact is added or replaced.

func (*Task) GetContextID added in v0.30.0

func (t *Task) GetContextID() string

GetContextID returns the task's context ID, or "" when it is unset. The ADK always assigns one when it creates a task; the accessor exists because A2A v1.0 made the field optional on the wire.

func (Task) WithHistoryLength added in v0.32.0

func (t Task) WithHistoryLength(historyLength *int) Task

WithHistoryLength returns a copy of the task keeping only its historyLength most recent messages; nil keeps the full history (spec section 3.2.4).

func (Task) WithoutExtension added in v0.33.0

func (t Task) WithoutExtension(uri string) Task

WithoutExtension returns a copy of the task without the metadata keys of the extension identified by uri, and without metadata once none is left. The metadata map is cloned, so the original task keeps them.

type TaskArtifactUpdateEvent

type TaskArtifactUpdateEvent struct {
	// Append If true, the content of this artifact should be appended to a previously
	//  sent artifact with the same ID.
	Append *bool `json:"append,omitempty"`

	// Artifact The artifact that was generated or updated.
	Artifact Artifact `json:"artifact"`

	// ContextID The ID of the context that this task belongs to.
	ContextID string `json:"contextId"`

	// LastChunk If true, this is the final chunk of the artifact.
	LastChunk *bool `json:"lastChunk,omitempty"`

	// Metadata Optional. Metadata associated with the artifact update.
	Metadata *Struct `json:"metadata,omitempty"`

	// TaskID The ID of the task for this artifact.
	TaskID string `json:"taskId"`
}

TaskArtifactUpdateEvent A task delta where an artifact has been generated.

type TaskPushNotificationConfig

type TaskPushNotificationConfig struct {
	// Authentication Authentication information required to send the notification.
	Authentication *AuthenticationInfo `json:"authentication,omitempty"`

	// ID The push notification configuration details.
	//  A unique identifier (e.g. UUID) for this push notification configuration.
	ID *string `json:"id,omitempty"`

	// TaskID The ID of the task this configuration is associated with.
	TaskID *string `json:"taskId,omitempty"`

	// Tenant Optional. Opaque routing identifier. Must match the `tenant` value from
	//  the selected `AgentInterface` in the Agent Card when that field is set.
	Tenant *string `json:"tenant,omitempty"`

	// Token A token unique for this task or session.
	Token *string `json:"token,omitempty"`

	// URL The URL where the notification should be sent.
	URL string `json:"url"`
}

TaskPushNotificationConfig A container associating a push notification configuration with a specific task.

type TaskState

type TaskState string

TaskState Filter tasks by their current status state.

const (
	TaskStateAuthRequired  TaskState = "TASK_STATE_AUTH_REQUIRED"
	TaskStateCanceled      TaskState = "TASK_STATE_CANCELED"
	TaskStateCompleted     TaskState = "TASK_STATE_COMPLETED"
	TaskStateFailed        TaskState = "TASK_STATE_FAILED"
	TaskStateInputRequired TaskState = "TASK_STATE_INPUT_REQUIRED"
	TaskStateRejected      TaskState = "TASK_STATE_REJECTED"
	TaskStateSubmitted     TaskState = "TASK_STATE_SUBMITTED"
	TaskStateUnspecified   TaskState = "TASK_STATE_UNSPECIFIED"
	TaskStateWorking       TaskState = "TASK_STATE_WORKING"
)

Defines values for TaskState.

func (TaskState) IsInterrupted added in v0.32.0

func (s TaskState) IsInterrupted() bool

IsInterrupted reports whether a task in this state is paused waiting on the client.

func (TaskState) IsTerminal added in v0.30.0

func (s TaskState) IsTerminal() bool

IsTerminal reports whether a task in this state will never change state again. A2A v1.0 dropped the `final` flag from status updates; terminal state is the signal.

func (TaskState) Valid added in v0.25.0

func (e TaskState) Valid() bool

Valid indicates whether the value is a known member of the TaskState enum.

type TaskStatus

type TaskStatus struct {
	// Message A message associated with the status.
	Message *Message `json:"message,omitempty"`

	// State Filter tasks by their current status state.
	State TaskState `json:"state"`

	// Timestamp ISO 8601 Timestamp when the status was recorded.
	//  Example: "2023-10-27T10:00:00Z"
	Timestamp *Timestamp `json:"timestamp,omitempty"`
}

TaskStatus A container for the status of a task

type TaskStatusUpdateEvent

type TaskStatusUpdateEvent struct {
	// ContextID The ID of the context that the task belongs to.
	ContextID string `json:"contextId"`

	// Metadata Optional. Metadata associated with the task update.
	Metadata *Struct `json:"metadata,omitempty"`

	// Status The new status of the task.
	Status TaskStatus `json:"status"`

	// TaskID The ID of the task that has changed.
	TaskID string `json:"taskId"`
}

TaskStatusUpdateEvent An event sent by the agent to notify the client of a change in a task's status.

type Timestamp added in v0.17.0

type Timestamp = time.Time

Timestamp defines model for Timestamp.

type Value added in v0.30.0

type Value = interface{}

Value defines model for Value.

Jump to

Keyboard shortcuts

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