a2a

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2026 License: Apache-2.0 Imports: 6 Imported by: 27

Documentation

Overview

Package a2a contains core types and constants from the A2A protocol shared by client and server implementations. These types implement the A2A specification and are transport-agnostic.

Additionally, the package provides factory methods for types implementing the Event interface.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrParseError indicates that server received payload that was not well-formed.
	ErrParseError = errors.New("parse error")

	// ErrInvalidRequest indicates that server received a well-formed payload which was not a valid request.
	ErrInvalidRequest = errors.New("invalid request")

	// ErrMethodNotFound indicates that a method does not exist or is not supported.
	ErrMethodNotFound = errors.New("method not found")

	// ErrInvalidParams indicates that params provided for the method were invalid (e.g., wrong type, missing required field).
	ErrInvalidParams = errors.New("invalid params")

	// ErrInternalError indicates an unexpected error occurred on the server during processing.
	ErrInternalError = errors.New("internal error")

	// ErrServerError reserved for implementation-defined server-errors.
	ErrServerError = errors.New("server error")

	// ErrTaskNotFound indicates that a task with the provided ID was not found.
	ErrTaskNotFound = errors.New("task not found")

	// ErrTaskNotCancelable indicates that the task was in a state where it could not be canceled.
	ErrTaskNotCancelable = errors.New("task cannot be canceled")

	// ErrPushNotificationNotSupported indicates that the agent does not support push notifications.
	ErrPushNotificationNotSupported = errors.New("push notification not supported")

	// ErrUnsupportedOperation indicates that the requested operation is not supported by the agent.
	ErrUnsupportedOperation = errors.New("this operation is not supported")

	// ErrUnsupportedContentType indicates an incompatibility between the requested
	// content types and the agent's capabilities.
	ErrUnsupportedContentType = errors.New("incompatible content types")

	// ErrInvalidAgentResponse indicates that the agent returned a response that
	// does not conform to the specification for the current method.
	ErrInvalidAgentResponse = errors.New("invalid agent response")

	// ErrAuthenticatedExtendedCardNotConfigured indicates that the agent does not have an Authenticated
	// Extended Card configured.
	ErrAuthenticatedExtendedCardNotConfigured = errors.New("extended card not configured")

	// ErrUnauthenticated indicates that the request does not have valid authentication credentials.
	ErrUnauthenticated = errors.New("unauthenticated")

	// ErrUnauthorized indicates that the caller does not have permission to execute the specified operation.
	ErrUnauthorized = errors.New("permission denied")
)

https://a2a-protocol.org/latest/specification/#8-error-handling

Functions

func NewContextID

func NewContextID() string

NewContextID generates a new random context identifier.

func NewMessageID

func NewMessageID() string

NewMessageID generates a new random message identifier.

Types

type APIKeySecurityScheme

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

	// The location of the API key.
	In APIKeySecuritySchemeIn `json:"in" yaml:"in" mapstructure:"in"`

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

APIKeySecurityScheme defines a security scheme using an API key.

func (APIKeySecurityScheme) MarshalJSON

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

type APIKeySecuritySchemeIn

type APIKeySecuritySchemeIn string

APIKeySecuritySchemeIn defines a set of permitted values for the expected API key location in APIKeySecurityScheme.

const (
	APIKeySecuritySchemeInCookie APIKeySecuritySchemeIn = "cookie"
	APIKeySecuritySchemeInHeader APIKeySecuritySchemeIn = "header"
	APIKeySecuritySchemeInQuery  APIKeySecuritySchemeIn = "query"
)

type AgentCapabilities

type AgentCapabilities struct {
	// Extensions is a list of protocol extensions supported by the agent.
	Extensions []AgentExtension `json:"extensions,omitempty" yaml:"extensions,omitempty" mapstructure:"extensions,omitempty"`

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

	// StateTransitionHistory indicates if the agent provides a history of state transitions for a task.
	StateTransitionHistory bool `` /* 127-byte string literal not displayed */

	// Streaming indicates if the agent supports streaming responses.
	Streaming bool `json:"streaming,omitempty" yaml:"streaming,omitempty" mapstructure:"streaming,omitempty"`
}

AgentCapabilities define optional capabilities supported by an agent.

type AgentCard

type AgentCard struct {
	// AdditionalInterfaces is a list of additional supported transport and URL combinations.
	// This allows agents to expose multiple transports, potentially at different
	// URLs.
	//
	// Best practices:
	// - SHOULD include all supported transports for completeness
	// - SHOULD include an entry matching the main 'url' and 'preferredTransport'
	// - MAY reuse URLs if multiple transports are available at the same endpoint
	// - MUST accurately declare the transport available at each URL
	//
	// Clients can select any interface from this list based on their transport capabilities
	// and preferences. This enables transport negotiation and fallback scenarios.
	AdditionalInterfaces []AgentInterface `json:"additionalInterfaces,omitempty" yaml:"additionalInterfaces,omitempty" mapstructure:"additionalInterfaces,omitempty"`

	// Capabilities is a declaration of optional capabilities supported by the agent.
	Capabilities AgentCapabilities `json:"capabilities" yaml:"capabilities" mapstructure:"capabilities"`

	// DefaultInputModes a default set of supported input MIME types for all skills, which can be
	// overridden on a per-skill basis.
	DefaultInputModes []string `json:"defaultInputModes" yaml:"defaultInputModes" mapstructure:"defaultInputModes"`

	// DefaultOutputModes is a default set of supported output MIME types for all skills, which can be
	// overridden on a per-skill basis.
	DefaultOutputModes []string `json:"defaultOutputModes" yaml:"defaultOutputModes" mapstructure:"defaultOutputModes"`

	// Description is a human-readable description of the agent, assisting users and other agents
	// in understanding its purpose.
	Description string `json:"description" yaml:"description" mapstructure:"description"`

	// DocumentationURL is an optional URL to the agent's documentation.
	DocumentationURL string `json:"documentationUrl,omitempty" yaml:"documentationUrl,omitempty" mapstructure:"documentationUrl,omitempty"`

	// IconURL is an optional URL to an icon for the agent.
	IconURL string `json:"iconUrl,omitempty" yaml:"iconUrl,omitempty" mapstructure:"iconUrl,omitempty"`

	// Name is a human-readable name for the agent.
	Name string `json:"name" yaml:"name" mapstructure:"name"`

	// PreferredTransport is the transport protocol for the preferred endpoint (the main 'url' field).
	// If not specified, defaults to 'JSONRPC'.
	//
	// IMPORTANT: The transport specified here MUST be available at the main 'url'.
	// This creates a binding between the main URL and its supported transport protocol.
	// Clients should prefer this transport and URL combination when both are supported.
	PreferredTransport TransportProtocol `json:"preferredTransport,omitempty" yaml:"preferredTransport,omitempty" mapstructure:"preferredTransport,omitempty"`

	// ProtocolVersion is the version of the A2A protocol this agent supports.
	ProtocolVersion string `json:"protocolVersion" yaml:"protocolVersion" mapstructure:"protocolVersion"`

	// Provider contains information about the agent's service provider.
	Provider *AgentProvider `json:"provider,omitempty" yaml:"provider,omitempty" mapstructure:"provider,omitempty"`

	// Security is a list of security requirement objects that apply to all agent interactions.
	// Each object lists security schemes that can be used.
	// Follows the OpenAPI 3.0 Security Requirement Object.
	// This list can be seen as an OR of ANDs. Each object in the list describes one
	// possible set of security requirements that must be present on a request.
	// This allows specifying, for example, "callers must either use OAuth OR an API Key AND mTLS.":
	//
	// Security: []SecurityRequirements{
	//		{"oauth2": SecuritySchemeScopes{"read"}},
	// 		{"mTLS": SecuritySchemeScopes{}, "apiKey": SecuritySchemeScopes{"read"}}
	// }
	Security []SecurityRequirements `json:"security,omitempty" yaml:"security,omitempty" mapstructure:"security,omitempty"`

	// SecuritySchemes is a declaration of the security schemes available to authorize requests. The key
	// is the scheme name. Follows the OpenAPI 3.0 Security Scheme Object.
	SecuritySchemes NamedSecuritySchemes `json:"securitySchemes,omitempty" yaml:"securitySchemes,omitempty" mapstructure:"securitySchemes,omitempty"`

	// Signatures is a list of JSON Web Signatures computed for this AgentCard.
	Signatures []AgentCardSignature `json:"signatures,omitempty" yaml:"signatures,omitempty" mapstructure:"signatures,omitempty"`

	// Skills is the set of skills, or distinct capabilities, that the agent can perform.
	Skills []AgentSkill `json:"skills" yaml:"skills" mapstructure:"skills"`

	// SupportsAuthenticatedExtendedCard indicates if the agent can provide an extended agent card with additional details
	// to authenticated users. Defaults to false.
	SupportsAuthenticatedExtendedCard bool `` /* 160-byte string literal not displayed */

	// URL is the preferred endpoint URL for interacting with the agent.
	// This URL MUST support the transport specified by 'preferredTransport'.
	URL string `json:"url" yaml:"url" mapstructure:"url"`

	// Version is the agent's own version number. The format is defined by the provider.
	Version string `json:"version" yaml:"version" mapstructure:"version"`
}

AgentCard is 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 {
	// Header is the unprotected JWS header values.
	Header map[string]any `json:"header,omitempty" yaml:"header,omitempty" mapstructure:"header,omitempty"`

	// Protected is a JWS header for the signature. This is a Base64url-encoded
	// JSON object, as per RFC 7515.
	Protected string `json:"protected" yaml:"protected" mapstructure:"protected"`

	// Signature is the computed signature, Base64url-encoded.
	Signature string `json:"signature" yaml:"signature" mapstructure:"signature"`
}

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 is an optional human-readable description of how this agent uses the extension.
	Description string `json:"description,omitempty" yaml:"description,omitempty" mapstructure:"description,omitempty"`

	// Params are optional, extension-specific configuration parameters.
	Params map[string]any `json:"params,omitempty" yaml:"params,omitempty" mapstructure:"params,omitempty"`

	// Required indicates if the client must understand and comply with the extension's
	// requirements to interact with the agent.
	Required bool `json:"required,omitempty" yaml:"required,omitempty" mapstructure:"required,omitempty"`

	// URI is the unique URI identifying the extension.
	URI string `json:"uri" yaml:"uri" mapstructure:"uri"`
}

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

type AgentInterface

type AgentInterface struct {
	// Transport is the transport protocol supported at this URL.
	Transport TransportProtocol `json:"transport" yaml:"transport" mapstructure:"transport"`

	// URL is the URL where this interface is available.
	// Must be a valid absolute HTTPS URL in production.
	URL string `json:"url" yaml:"url" mapstructure:"url"`
}

AgentInterface declares a combination of a target URL and a transport protocol for interacting with the agent. This allows agents to expose the same functionality over multiple transport mechanisms.

type AgentProvider

type AgentProvider struct {
	// Org is the name of the agent provider's organization.
	Org string `json:"organization" yaml:"organization" mapstructure:"organization"`

	// URL is a URL for the agent provider's website or relevant documentation.
	URL string `json:"url" yaml:"url" mapstructure:"url"`
}

AgentProvider represents the service provider of an agent.

type AgentSkill

type AgentSkill struct {
	// Description is a detailed description of the skill, intended to help clients or users
	// understand its purpose and functionality.
	Description string `json:"description" yaml:"description" mapstructure:"description"`

	// Examples are prompts or scenarios that this skill can handle. Provides a hint to
	// the client on how to use the skill.
	Examples []string `json:"examples,omitempty" yaml:"examples,omitempty" mapstructure:"examples,omitempty"`

	// ID is a unique identifier for the agent's skill.
	ID string `json:"id" yaml:"id" mapstructure:"id"`

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

	// Name is a human-readable name for the skill.
	Name string `json:"name" yaml:"name" mapstructure:"name"`

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

	// Security is a map of schemes necessary for the agent to leverage this skill.
	// As in the overall AgentCard.security, this list represents a logical OR of
	// security requirement objects.
	// Each object is a set of security schemes that must be used together (a logical AND).
	Security []SecurityRequirements `json:"security,omitempty" yaml:"security,omitempty" mapstructure:"security,omitempty"`

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

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

type Artifact

type Artifact struct {
	// ID is a unique identifier for the artifact within the scope of the task.
	ID ArtifactID `json:"artifactId" yaml:"artifactId" mapstructure:"artifactId"`

	// Description is an optional, human-readable description of the artifact.
	Description string `json:"description,omitempty" yaml:"description,omitempty" mapstructure:"description,omitempty"`

	// Extensions are the URIs of extensions that are relevant to this artifact.
	Extensions []string `json:"extensions,omitempty" yaml:"extensions,omitempty" mapstructure:"extensions,omitempty"`

	// Metadata is an optional metadata for extensions. The key is an extension-specific identifier.
	Metadata map[string]any `json:"metadata,omitempty" yaml:"metadata,omitempty" mapstructure:"metadata,omitempty"`

	// Name is an optional, human-readable name for the artifact.
	Name string `json:"name,omitempty" yaml:"name,omitempty" mapstructure:"name,omitempty"`

	// Parts is an array of content parts that make up the artifact.
	Parts ContentParts `json:"parts" yaml:"parts" mapstructure:"parts"`
}

Artifact represents a file, data structure, or other resource generated by an agent during a task.

func (*Artifact) Meta added in v0.3.6

func (a *Artifact) Meta() map[string]any

func (*Artifact) SetMeta added in v0.3.6

func (a *Artifact) SetMeta(k string, v any)

type ArtifactID

type ArtifactID string

ArtifactID is a unique identifier for the artifact within the scope of the task.

func NewArtifactID

func NewArtifactID() ArtifactID

NewArtifactID generates a new random artifact identifier.

type AuthorizationCodeOAuthFlow

type AuthorizationCodeOAuthFlow struct {
	// AuthorizationURL is the authorization URL to be used for this flow.
	// This MUST be a URL and use TLS.
	AuthorizationURL string `json:"authorizationUrl" yaml:"authorizationUrl" mapstructure:"authorizationUrl"`

	// RefreshURL is an optional URL to be used for obtaining refresh tokens.
	// This MUST be a URL and use TLS.
	RefreshURL string `json:"refreshUrl,omitempty" yaml:"refreshUrl,omitempty" mapstructure:"refreshUrl,omitempty"`

	// Scopes are the available scopes for the OAuth2 security scheme. A map between the scope
	// name and a short description for it.
	Scopes map[string]string `json:"scopes" yaml:"scopes" mapstructure:"scopes"`

	// TokenURL is the URL to be used for this flow. This MUST be a URL and use TLS.
	TokenURL string `json:"tokenUrl" yaml:"tokenUrl" mapstructure:"tokenUrl"`
}

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

type ClientCredentialsOAuthFlow

type ClientCredentialsOAuthFlow struct {
	// RefreshURL is an optional URL to be used for obtaining refresh tokens. This MUST be a URL.
	RefreshURL string `json:"refreshUrl,omitempty" yaml:"refreshUrl,omitempty" mapstructure:"refreshUrl,omitempty"`

	// Scopes are the available scopes for the OAuth2 security scheme. A map between the scope
	// name and a short description for it.
	Scopes map[string]string `json:"scopes" yaml:"scopes" mapstructure:"scopes"`

	// TokenURL is the token URL to be used for this flow. This MUST be a URL.
	TokenURL string `json:"tokenUrl" yaml:"tokenUrl" mapstructure:"tokenUrl"`
}

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

type ContentParts

type ContentParts []Part

ContentParts is an array of content parts that form the message body or an artifact.

func (ContentParts) MarshalJSON added in v0.3.4

func (j ContentParts) MarshalJSON() ([]byte, error)

func (*ContentParts) UnmarshalJSON

func (j *ContentParts) UnmarshalJSON(b []byte) error

type DataPart

type DataPart struct {
	// Data is the structured data content.
	Data map[string]any `json:"data" yaml:"data" mapstructure:"data"`

	// Metadata is an optional metadata associated with the part.
	Metadata map[string]any `json:"metadata,omitempty" yaml:"metadata,omitempty" mapstructure:"metadata,omitempty"`
}

DataPart represents a structured data segment (e.g., JSON) within a message or artifact.

func (DataPart) MarshalJSON

func (p DataPart) MarshalJSON() ([]byte, error)

func (DataPart) Meta

func (p DataPart) Meta() map[string]any

func (*DataPart) SetMeta added in v0.3.6

func (p *DataPart) SetMeta(k string, v any)

type DeleteTaskPushConfigParams

type DeleteTaskPushConfigParams struct {
	// TaskID is the unique identifier of the task.
	TaskID TaskID `json:"id" yaml:"id" mapstructure:"id"`

	// ConfigID is the ID of the push notification configuration to delete.
	ConfigID string `json:"pushNotificationConfigId" yaml:"pushNotificationConfigId" mapstructure:"pushNotificationConfigId"`

	// Metadata is an optional metadata for extensions.
	Metadata map[string]any `json:"metadata,omitempty" yaml:"metadata,omitempty" mapstructure:"metadata,omitempty"`
}

DeleteTaskPushConfigParams defines parameters for deleting a specific push notification configuration for a task.

func (*DeleteTaskPushConfigParams) Meta added in v0.3.6

func (p *DeleteTaskPushConfigParams) Meta() map[string]any

func (*DeleteTaskPushConfigParams) SetMeta added in v0.3.6

func (p *DeleteTaskPushConfigParams) SetMeta(k string, v any)

type Error added in v0.3.6

type Error struct {
	// Err is the underlying error. It will be used for transport-specific code selection.
	Err error
	// Message is a human-readable description of the error returned to clients.
	Message string
	// Details can contain additional structured information about the error.
	Details map[string]any
}

Error provides control over the message and details returned to clients.

func NewError added in v0.3.6

func NewError(err error, message string) *Error

NewError creates a new A2A Error wrapping the provided error with a custom message.

func (*Error) Error added in v0.3.6

func (e *Error) Error() string

Error returns the error message.

func (*Error) Unwrap added in v0.3.6

func (e *Error) Unwrap() error

Unwrap provides access to the error cause.

func (*Error) WithDetails added in v0.3.6

func (e *Error) WithDetails(details map[string]any) *Error

WithDetails attaches structured data to the error.

type Event

type Event interface {
	TaskInfoProvider
	MetadataCarrier
	// contains filtered or unexported methods
}

Event interface is used to represent types that can be sent over a streaming connection.

func UnmarshalEventJSON

func UnmarshalEventJSON(data []byte) (Event, error)

UnmarshalEventJSON unmarshals JSON data into the appropriate Event type based on the 'kind' field. The kind field is used as a discriminator to determine which concrete type to unmarshal into.

type FileBytes

type FileBytes struct {
	FileMeta
	// Bytes is the base64-encoded content of the file.
	Bytes string `json:"bytes" yaml:"bytes" mapstructure:"bytes"`
}

FileBytes represents a file with its content provided directly as a base64-encoded string.

type FileMeta

type FileMeta struct {
	// MimeType is an optinal MIME type of the file (e.g., "application/pdf").
	MimeType string `json:"mimeType,omitempty" yaml:"mimeType,omitempty" mapstructure:"mimeType,omitempty"`

	// Name is an optional name for the file (e.g., "document.pdf").
	Name string `json:"name,omitempty" yaml:"name,omitempty" mapstructure:"name,omitempty"`
}

FileMeta represents file metadata of a file part.

type FilePart

type FilePart struct {
	// File the file content, represented as either a URI or as base64-encoded bytes.
	File FilePartContent `json:"file" yaml:"file" mapstructure:"file"`

	// Metadata is an optional metadata associated with the part.
	Metadata map[string]any `json:"metadata,omitempty" yaml:"metadata,omitempty" mapstructure:"metadata,omitempty"`
}

FilePart represents a file segment within a message or artifact. The file content can be provided either directly as bytes or as a URI.

func (FilePart) MarshalJSON

func (p FilePart) MarshalJSON() ([]byte, error)

func (FilePart) Meta

func (p FilePart) Meta() map[string]any

func (*FilePart) SetMeta added in v0.3.6

func (p *FilePart) SetMeta(k string, v any)

func (*FilePart) UnmarshalJSON

func (p *FilePart) UnmarshalJSON(b []byte) error

type FilePartContent

type FilePartContent interface {
	// contains filtered or unexported methods
}

FilePartContent is a discriminated union of possible file part payloads.

type FileURI

type FileURI struct {
	FileMeta
	// URI is a URI pointing to the file's content.
	URI string `json:"uri" yaml:"uri" mapstructure:"uri"`
}

FileURI represents a file with its content located at a specific URI.

type GetTaskPushConfigParams

type GetTaskPushConfigParams struct {
	// TaskID is the unique identifier of the task.
	TaskID TaskID `json:"id" yaml:"id" mapstructure:"id"`

	// ConfigID is an optional ID of the push notification configuration to retrieve.
	ConfigID string `` /* 133-byte string literal not displayed */

	// Metadata is an optional metadata for extensions.
	Metadata map[string]any `json:"metadata,omitempty" yaml:"metadata,omitempty" mapstructure:"metadata,omitempty"`
}

GetTaskPushConfigParams defines parameters for fetching a specific push notification configuration for a task.

func (*GetTaskPushConfigParams) Meta added in v0.3.6

func (p *GetTaskPushConfigParams) Meta() map[string]any

func (*GetTaskPushConfigParams) SetMeta added in v0.3.6

func (p *GetTaskPushConfigParams) SetMeta(k string, v any)

type HTTPAuthSecurityScheme

type HTTPAuthSecurityScheme struct {
	// BearerFormat is an optional hint to the client to identify how the bearer token is formatted (e.g.,
	// "JWT"). This is primarily for documentation purposes.
	BearerFormat string `json:"bearerFormat,omitempty" yaml:"bearerFormat,omitempty" mapstructure:"bearerFormat,omitempty"`

	// Description is an optional description for the security scheme.
	Description string `json:"description,omitempty" yaml:"description,omitempty" mapstructure:"description,omitempty"`

	// Scheme is 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" yaml:"scheme" mapstructure:"scheme"`
}

HTTPAuthSecurityScheme defines a security scheme using HTTP authentication.

func (HTTPAuthSecurityScheme) MarshalJSON

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

type ImplicitOAuthFlow

type ImplicitOAuthFlow struct {
	// AuthorizationURL is the authorization URL to be used for this flow. This MUST be a URL.
	AuthorizationURL string `json:"authorizationUrl" yaml:"authorizationUrl" mapstructure:"authorizationUrl"`

	// RefreshURL is an optional URL to be used for obtaining refresh tokens. This MUST be a URL.
	RefreshURL string `json:"refreshUrl,omitempty" yaml:"refreshUrl,omitempty" mapstructure:"refreshUrl,omitempty"`

	// Scopes are the available scopes for the OAuth2 security scheme. A map between the scope
	// name and a short description for it.
	Scopes map[string]string `json:"scopes" yaml:"scopes" mapstructure:"scopes"`
}

ImplicitOAuthFlow defines configuration details for the OAuth 2.0 Implicit flow.

type ListTaskPushConfigParams

type ListTaskPushConfigParams struct {
	// TaskID is the unique identifier of the task.
	TaskID TaskID `json:"id" yaml:"id" mapstructure:"id"`

	// Metadata is an optional metadata for extensions.
	Metadata map[string]any `json:"metadata,omitempty" yaml:"metadata,omitempty" mapstructure:"metadata,omitempty"`
}

ListTaskPushConfigParams defines parameters for listing all push notification configurations associated with a task.

func (*ListTaskPushConfigParams) Meta added in v0.3.6

func (p *ListTaskPushConfigParams) Meta() map[string]any

func (*ListTaskPushConfigParams) SetMeta added in v0.3.6

func (p *ListTaskPushConfigParams) SetMeta(k string, v any)

type ListTasksRequest added in v0.3.4

type ListTasksRequest struct {
	// ContextID is the ID of the context to list tasks for.
	ContextID string `json:"context_id,omitempty" yaml:"context_id,omitempty" mapstructure:"context_id,omitempty"`

	// Status is the current state of the tasks to list.
	Status TaskState `json:"status,omitempty" yaml:"status,omitempty" mapstructure:"status,omitempty"`

	// PageSize is the maximum number of tasks to return in the response.
	// Must be between 1 and 100. If not set, the default value is 50.
	PageSize int `json:"page_size,omitempty" yaml:"page_size,omitempty" mapstructure:"page_size,omitempty"`

	// PageToken is the token for retrieving the next page of results.
	PageToken string `json:"page_token,omitempty" yaml:"page_token,omitempty" mapstructure:"page_token,omitempty"`

	// HistoryLength is the number of most recent messages from the task's history to retrieve in the response.
	HistoryLength int `json:"history_length,omitempty" yaml:"history_length,omitempty" mapstructure:"history_length,omitempty"`

	// LastUpdatedAfter is the time to list tasks updated after.
	LastUpdatedAfter *time.Time `json:"last_updated_after,omitempty" yaml:"last_updated_after,omitempty" mapstructure:"last_updated_after,omitempty"`

	// IncludeArtifacts is whether to include artifacts in the response.
	IncludeArtifacts bool `json:"include_artifacts,omitempty" yaml:"include_artifacts,omitempty" mapstructure:"include_artifacts,omitempty"`
}

ListTasksRequest defines the parameters for a request to list tasks.

type ListTasksResponse added in v0.3.4

type ListTasksResponse struct {
	// Tasks is the list of tasks matching the specified criteria.
	Tasks []*Task `json:"tasks,omitempty" yaml:"tasks,omitempty" mapstructure:"tasks,omitempty"`

	// TotalSize is the total number of tasks available (before pagination).
	TotalSize int `json:"total_size,omitempty" yaml:"total_size,omitempty" mapstructure:"total_size,omitempty"`

	// PageSize is the maximum number of tasks returned in the response.
	PageSize int `json:"page_size,omitempty" yaml:"page_size,omitempty" mapstructure:"page_size,omitempty"`

	// NextPageToken is the token for retrieving the next page of results.
	// Empty string if no more results.
	NextPageToken string `json:"next_page_token,omitempty" yaml:"next_page_token,omitempty" mapstructure:"next_page_token,omitempty"`
}

ListTasksResponse defines the response for a request to tasks/list.

type Message

type Message struct {
	// ID is a unique identifier for the message, typically a UUID, generated by the sender.
	ID string `json:"messageId" yaml:"messageId" mapstructure:"messageId"`

	// ContextID is the context identifier for this message, used to group related interactions.
	// An empty string means the message doesn't reference any context.
	ContextID string `json:"contextId,omitempty" yaml:"contextId,omitempty" mapstructure:"contextId,omitempty"`

	// Extensions are the URIs of extensions that are relevant to this message.
	Extensions []string `json:"extensions,omitempty" yaml:"extensions,omitempty" mapstructure:"extensions,omitempty"`

	// Metadata is an optional metadata for extensions. The key is an extension-specific identifier.
	Metadata map[string]any `json:"metadata,omitempty" yaml:"metadata,omitempty" mapstructure:"metadata,omitempty"`

	// Parts is an array of content parts that form the message body. A message can be
	// composed of multiple parts of different types (e.g., text and files).
	Parts ContentParts `json:"parts" yaml:"parts" mapstructure:"parts"`

	// ReferenceTasks is a list of other task IDs that this message references for additional context.
	ReferenceTasks []TaskID `json:"referenceTaskIds,omitempty" yaml:"referenceTaskIds,omitempty" mapstructure:"referenceTaskIds,omitempty"`

	// Role identifies the sender of the message.
	Role MessageRole `json:"role" yaml:"role" mapstructure:"role"`

	// TaskID is the identifier of the task this message is part of. Can be omitted for the
	// first message of a new task.
	// An empty string means the message doesn't reference any Task.
	TaskID TaskID `json:"taskId,omitempty" yaml:"taskId,omitempty" mapstructure:"taskId,omitempty"`
}

Message represents a single message in the conversation between a user and an agent.

func NewMessage

func NewMessage(role MessageRole, parts ...Part) *Message

NewMessage creates a new message with a random identifier.

func NewMessageForTask

func NewMessageForTask(role MessageRole, infoProvider TaskInfoProvider, parts ...Part) *Message

NewMessageForTask creates a new message with a random identifier that references the provided Task.

func (Message) MarshalJSON

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

func (*Message) Meta

func (m *Message) Meta() map[string]any

func (*Message) SetMeta added in v0.3.6

func (m *Message) SetMeta(k string, v any)

func (*Message) TaskInfo

func (m *Message) TaskInfo() TaskInfo

type MessageRole

type MessageRole string

MessageRole represents a set of possible values that identify the message sender.

const (
	MessageRoleUnspecified MessageRole = ""
	MessageRoleAgent       MessageRole = "agent"
	MessageRoleUser        MessageRole = "user"
)

type MessageSendConfig

type MessageSendConfig struct {
	// AcceptedOutputModes is a list of output MIME types the client is prepared to accept in the response.
	AcceptedOutputModes []string `json:"acceptedOutputModes,omitempty" yaml:"acceptedOutputModes,omitempty" mapstructure:"acceptedOutputModes,omitempty"`

	// Blocking indicates if the client will wait for the task to complete. The server may reject
	// this if the task is long-running. Server might choose to default to true.
	Blocking *bool `json:"blocking,omitempty" yaml:"blocking,omitempty" mapstructure:"blocking,omitempty"`

	// HistoryLength is the number of most recent messages from the task's history to retrieve in the response.
	HistoryLength *int `json:"historyLength,omitempty" yaml:"historyLength,omitempty" mapstructure:"historyLength,omitempty"`

	// PushConfig is configuration for the agent to send push notifications for updates after the initial response.
	PushConfig *PushConfig `` /* 127-byte string literal not displayed */
}

MessageSendConfig defines configuration options for a `message/send` or `message/stream` request.

type MessageSendParams

type MessageSendParams struct {
	// Config is an optional configuration for the send request.
	Config *MessageSendConfig `json:"configuration,omitempty" yaml:"configuration,omitempty" mapstructure:"configuration,omitempty"`

	// Message is the message object being sent to the agent.
	Message *Message `json:"message" yaml:"message" mapstructure:"message"`

	// Metadata is an optional metadata for extensions.
	Metadata map[string]any `json:"metadata,omitempty" yaml:"metadata,omitempty" mapstructure:"metadata,omitempty"`
}

MessageSendParams defines the parameters for a request to send a message to an agent. This can be used to create a new task, continue an existing one, or restart a task.

func (*MessageSendParams) Meta added in v0.3.6

func (p *MessageSendParams) Meta() map[string]any

func (*MessageSendParams) SetMeta added in v0.3.6

func (p *MessageSendParams) SetMeta(k string, v any)

type MetadataCarrier added in v0.3.6

type MetadataCarrier interface {
	// Meta returns the metadata container.
	Meta() map[string]any
	// SetMeta sets the metadata value for the provided key.
	SetMeta(k string, v any)
}

MetadataCarrier provides access to extensions metadata container.

type MutualTLSSecurityScheme

type MutualTLSSecurityScheme struct {
	// Description is an optional description for the security scheme.
	Description string `json:"description,omitempty" yaml:"description,omitempty" mapstructure:"description,omitempty"`
}

MutualTLSSecurityScheme defines a security scheme using mTLS authentication.

func (MutualTLSSecurityScheme) MarshalJSON

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

type NamedSecuritySchemes

type NamedSecuritySchemes map[SecuritySchemeName]SecurityScheme

NamedSecuritySchemes is a declaration of the security schemes available to authorize requests. The key is the scheme name. Follows the OpenAPI 3.0 Security Scheme Object.

func (*NamedSecuritySchemes) UnmarshalJSON

func (s *NamedSecuritySchemes) UnmarshalJSON(b []byte) error

type OAuth2SecurityScheme

type OAuth2SecurityScheme struct {
	// Description is an optional description for the security scheme.
	Description string `json:"description,omitempty" yaml:"description,omitempty" mapstructure:"description,omitempty"`

	// Flows is an object containing configuration information for the supported OAuth 2.0 flows.
	Flows OAuthFlows `json:"flows" yaml:"flows" mapstructure:"flows"`

	// Oauth2MetadataURL is an optional URL to the oauth2 authorization server metadata
	// [RFC8414](https://datatracker.ietf.org/doc/html/rfc8414). TLS is required.
	Oauth2MetadataURL string `json:"oauth2MetadataUrl,omitempty" yaml:"oauth2MetadataUrl,omitempty" mapstructure:"oauth2MetadataUrl,omitempty"`
}

OAuth2SecurityScheme defines a security scheme using OAuth 2.0.

func (OAuth2SecurityScheme) MarshalJSON

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

type OAuthFlows

type OAuthFlows struct {
	// AuthorizationCode is a configuration for the OAuth Authorization Code flow.
	// Previously called accessCode in OpenAPI 2.0.
	AuthorizationCode *AuthorizationCodeOAuthFlow `json:"authorizationCode,omitempty" yaml:"authorizationCode,omitempty" mapstructure:"authorizationCode,omitempty"`

	// ClientCredentials is a configuration for the OAuth Client Credentials flow. Previously called
	// application in OpenAPI 2.0.
	ClientCredentials *ClientCredentialsOAuthFlow `json:"clientCredentials,omitempty" yaml:"clientCredentials,omitempty" mapstructure:"clientCredentials,omitempty"`

	// Implicit is a configuration for the OAuth Implicit flow.
	Implicit *ImplicitOAuthFlow `json:"implicit,omitempty" yaml:"implicit,omitempty" mapstructure:"implicit,omitempty"`

	// Password is a configuration for the OAuth Resource Owner Password flow.
	Password *PasswordOAuthFlow `json:"password,omitempty" yaml:"password,omitempty" mapstructure:"password,omitempty"`
}

OAuthFlows defines the configuration for the supported OAuth 2.0 flows.

type OpenIDConnectSecurityScheme

type OpenIDConnectSecurityScheme struct {
	// Description is an optional description for the security scheme.
	Description string `json:"description,omitempty" yaml:"description,omitempty" mapstructure:"description,omitempty"`

	// OpenIDConnectURL is the OpenID Connect Discovery URL for the OIDC provider's metadata.
	OpenIDConnectURL string `json:"openIdConnectUrl" yaml:"openIdConnectUrl" mapstructure:"openIdConnectUrl"`
}

OpenIDConnectSecurityScheme defines a security scheme using OpenID Connect.

func (OpenIDConnectSecurityScheme) MarshalJSON

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

type Part

type Part interface {
	Meta() map[string]any
	// contains filtered or unexported methods
}

Part is a discriminated union representing a part of a message or artifact, which can be text, a file, or structured data.

type PasswordOAuthFlow

type PasswordOAuthFlow struct {
	// RefreshURL is an optional URL to be used for obtaining refresh tokens. This MUST be a URL.
	RefreshURL string `json:"refreshUrl,omitempty" yaml:"refreshUrl,omitempty" mapstructure:"refreshUrl,omitempty"`

	// Scopes are еру available scopes for the OAuth2 security scheme. A map between the scope
	// name and a short description for it.
	Scopes map[string]string `json:"scopes" yaml:"scopes" mapstructure:"scopes"`

	// TokenURL is the token URL to be used for this flow. This MUST be a URL.
	TokenURL string `json:"tokenUrl" yaml:"tokenUrl" mapstructure:"tokenUrl"`
}

PasswordOAuthFlow defines configuration details for the OAuth 2.0 Resource Owner Password flow.

type ProtocolVersion added in v0.3.6

type ProtocolVersion string

ProtocolVersion is a string constant which represents a version of the protocol.

const Version ProtocolVersion = "0.3.0"

Version is the protocol version which SDK implements.

type PushAuthInfo

type PushAuthInfo struct {
	// Credentials is an optional credentials required by the push notification endpoint.
	Credentials string `json:"credentials,omitempty" yaml:"credentials,omitempty" mapstructure:"credentials,omitempty"`

	// Schemes is a list of supported authentication schemes (e.g., 'Basic', 'Bearer').
	Schemes []string `json:"schemes" yaml:"schemes" mapstructure:"schemes"`
}

PushAuthInfo defines authentication details for a push notification endpoint.

type PushConfig

type PushConfig struct {
	// ID is an optional unique ID for the push notification configuration, set by the client
	// to support multiple notification callbacks.
	ID string `json:"id,omitempty" yaml:"id,omitempty" mapstructure:"id,omitempty"`

	// Auth is an optional authentication details for the agent to use when calling the
	// notification URL.
	Auth *PushAuthInfo `json:"authentication,omitempty" yaml:"authentication,omitempty" mapstructure:"authentication,omitempty"`

	// Token is an optional unique token for this task or session to validate incoming push notifications.
	Token string `json:"token,omitempty" yaml:"token,omitempty" mapstructure:"token,omitempty"`

	// URL is the callback URL where the agent should send push notifications.
	URL string `json:"url" yaml:"url" mapstructure:"url"`
}

PushConfig defines the configuration for setting up push notifications for task updates.

type SecurityRequirements

type SecurityRequirements map[SecuritySchemeName]SecuritySchemeScopes

SecurityRequirements describes a set of security requirements that must be present on a request. For example, to specify that mutual TLS AND an oauth2 token for specific scopes is required, the following requirements object needs to be created:

SecurityRequirements{
	SecuritySchemeName("oauth2"): SecuritySchemeScopes{"read", "write"},
	SecuritySchemeName("mTLS"): {}
}

type SecurityScheme

type SecurityScheme interface {
	// contains filtered or unexported methods
}

SecurityScheme is a sealed discriminated type union for supported security schemes.

type SecuritySchemeName

type SecuritySchemeName string

SecuritySchemeName is a string used to describe a security scheme in AgentCard.SecuritySchemes and reference it the AgentCard.Security requirements.

type SecuritySchemeScopes

type SecuritySchemeScopes []string

SecuritySchemeScopes is a list of scopes a security credential must be covering.

type SendMessageResult

type SendMessageResult interface {
	Event
	// contains filtered or unexported methods
}

SendMessageResult represents a response for non-streaming message send.

type Task

type Task struct {
	// ID is a unique identifier for the task, generated by the server for a new task.
	ID TaskID `json:"id" yaml:"id" mapstructure:"id"`

	// Artifacts is a collection of artifacts generated by the agent during the execution of the task.
	Artifacts []*Artifact `json:"artifacts,omitempty" yaml:"artifacts,omitempty" mapstructure:"artifacts,omitempty"`

	// ContextID is a server-generated identifier for maintaining context across multiple related
	// tasks or interactions. Required to be non empty.
	ContextID string `json:"contextId" yaml:"contextId" mapstructure:"contextId"`

	// History is an array of messages exchanged during the task, representing the conversation history.
	History []*Message `json:"history,omitempty" yaml:"history,omitempty" mapstructure:"history,omitempty"`

	// Metadata is an optional metadata for extensions. The key is an extension-specific identifier.
	Metadata map[string]any `json:"metadata,omitempty" yaml:"metadata,omitempty" mapstructure:"metadata,omitempty"`

	// Status is the current status of the task, including its state and a descriptive message.
	Status TaskStatus `json:"status" yaml:"status" mapstructure:"status"`
}

Task represents a single, stateful operation or conversation between a client and an agent.

func NewSubmittedTask

func NewSubmittedTask(infoProvider TaskInfoProvider, initialMessage *Message) *Task

NewSubmittedTask is a utility for creating a Task in submitted state from the initial Message. New values are generated for task and context id when they are missing.

func (Task) MarshalJSON

func (t Task) MarshalJSON() ([]byte, error)

func (*Task) Meta

func (m *Task) Meta() map[string]any

func (*Task) SetMeta added in v0.3.6

func (m *Task) SetMeta(k string, v any)

func (*Task) TaskInfo

func (m *Task) TaskInfo() TaskInfo

type TaskArtifactUpdateEvent

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

	// Artifact is the artifact that was generated or updated.
	Artifact *Artifact `json:"artifact" yaml:"artifact" mapstructure:"artifact"`

	// ContextID is the context ID associated with the task. Required to be non-empty.
	ContextID string `json:"contextId" yaml:"contextId" mapstructure:"contextId"`

	// LastChunk indicates if this is the final chunk of the artifact.
	LastChunk bool `json:"lastChunk,omitempty" yaml:"lastChunk,omitempty" mapstructure:"lastChunk,omitempty"`

	// TaskID is the ID of the task this artifact belongs to.
	TaskID TaskID `json:"taskId" yaml:"taskId" mapstructure:"taskId"`

	// Metadata is an optional metadata for extensions.
	Metadata map[string]any `json:"metadata,omitempty" yaml:"metadata,omitempty" mapstructure:"metadata,omitempty"`
}

TaskArtifactUpdateEvent is an event sent by the agent to notify the client that an artifact has been generated or updated. This is typically used in streaming models.

func NewArtifactEvent

func NewArtifactEvent(infoProvider TaskInfoProvider, parts ...Part) *TaskArtifactUpdateEvent

NewArtifactEvent create a TaskArtifactUpdateEvent for an Artifact with a random ID.

func NewArtifactUpdateEvent

func NewArtifactUpdateEvent(infoProvider TaskInfoProvider, id ArtifactID, parts ...Part) *TaskArtifactUpdateEvent

NewArtifactUpdateEvent creates a TaskArtifactUpdateEvent that represents an update of the artifact with the provided ID.

func (TaskArtifactUpdateEvent) MarshalJSON

func (e TaskArtifactUpdateEvent) MarshalJSON() ([]byte, error)

func (*TaskArtifactUpdateEvent) Meta

func (a *TaskArtifactUpdateEvent) Meta() map[string]any

func (*TaskArtifactUpdateEvent) SetMeta added in v0.3.6

func (a *TaskArtifactUpdateEvent) SetMeta(k string, v any)

func (*TaskArtifactUpdateEvent) TaskInfo

func (m *TaskArtifactUpdateEvent) TaskInfo() TaskInfo

type TaskID

type TaskID string

TaskID is a unique identifier for the task, generated by the server for a new task.

func NewTaskID

func NewTaskID() TaskID

NewTaskID generates a new random task identifier.

type TaskIDParams

type TaskIDParams struct {
	// TaskID is the unique identifier of the task.
	ID TaskID `json:"id" yaml:"id" mapstructure:"id"`

	// Metadata is an optional metadata associated with the request.
	Metadata map[string]any `json:"metadata,omitempty" yaml:"metadata,omitempty" mapstructure:"metadata,omitempty"`
}

TaskIDParams defines parameters containing a task ID, used for simple task operations.

func (*TaskIDParams) Meta added in v0.3.6

func (p *TaskIDParams) Meta() map[string]any

func (*TaskIDParams) SetMeta added in v0.3.6

func (p *TaskIDParams) SetMeta(k string, v any)

type TaskInfo

type TaskInfo struct {
	// TaskID is an id of the task.
	TaskID TaskID
	// ContextID is an id of the interactions group the task belong to.
	ContextID string
}

TaskInfo represents information about the Task and the group of interactions it belongs to. Values might be empty which means the TaskInfoProvider is not associated with any tasks. An example would be the first user message.

func (TaskInfo) TaskInfo added in v0.3.5

func (ti TaskInfo) TaskInfo() TaskInfo

TaskInfo implements TaskInfoProvider so that the struct can be passed to core type constructor functions. For example: a2a.NewMessageForTask(role, a2a.TaskInfo{...}).

type TaskInfoProvider

type TaskInfoProvider interface {
	// TaskInfo returns information about the task.
	TaskInfo() TaskInfo
}

TaskInfoProvider provides information about the Task.

type TaskPushConfig

type TaskPushConfig struct {
	// Config is the push notification configuration for this task.
	Config PushConfig `json:"pushNotificationConfig" yaml:"pushNotificationConfig" mapstructure:"pushNotificationConfig"`

	// TaskID is the ID of the task.
	TaskID TaskID `json:"taskId" yaml:"taskId" mapstructure:"taskId"`
}

TaskPushConfig is a container associating a push notification configuration with a specific task.

type TaskQueryParams

type TaskQueryParams struct {
	// HistoryLength is the number of most recent messages from the task's history to retrieve.
	HistoryLength *int `json:"historyLength,omitempty" yaml:"historyLength,omitempty" mapstructure:"historyLength,omitempty"`

	// ID is the unique identifier of the task.
	ID TaskID `json:"id" yaml:"id" mapstructure:"id"`

	// Metadata is an optional metadata associated with the request.
	Metadata map[string]any `json:"metadata,omitempty" yaml:"metadata,omitempty" mapstructure:"metadata,omitempty"`
}

TaskQueryParams defines parameters for querying a task, with an option to limit history length.

func (*TaskQueryParams) Meta added in v0.3.6

func (p *TaskQueryParams) Meta() map[string]any

func (*TaskQueryParams) SetMeta added in v0.3.6

func (p *TaskQueryParams) SetMeta(k string, v any)

type TaskState

type TaskState string

TastState defines a set of possible task states.

const (
	// TaskStateUnspecified represents a missing TaskState value.
	TaskStateUnspecified TaskState = ""
	// TaskStateAuthRequired means the task requires authentication to proceed.
	TaskStateAuthRequired TaskState = "auth-required"
	// TaskStateCanceled means the task has been canceled by the user.
	TaskStateCanceled TaskState = "canceled"
	// TaskStateCompleted means the task has been successfully completed.
	TaskStateCompleted TaskState = "completed"
	// TaskStateFailed means the task failed due to an error during execution.
	TaskStateFailed TaskState = "failed"
	// TaskStateInputRequired means the task is paused and waiting for input from the user.
	TaskStateInputRequired TaskState = "input-required"
	// TaskStateRejected means the task was rejected by the agent and was not started.
	TaskStateRejected TaskState = "rejected"
	// TaskStateSubmitted means the task has been submitted and is awaiting execution.
	TaskStateSubmitted TaskState = "submitted"
	// TaskStateUnknown means the task is in an unknown or indeterminate state.
	TaskStateUnknown TaskState = "unknown"
	// TaskStateWorking means The agent is actively working on the task.
	TaskStateWorking TaskState = "working"
)

func (TaskState) Terminal

func (ts TaskState) Terminal() bool

Terminal returns true for states in which a Task becomes immutable, i.e. no further changes to the Task are permitted.

type TaskStatus

type TaskStatus struct {
	// Message is an optional, human-readable message providing more details about the current status.
	Message *Message `json:"message,omitempty" yaml:"message,omitempty" mapstructure:"message,omitempty"`

	// State is the current state of the task's lifecycle.
	State TaskState `json:"state" yaml:"state" mapstructure:"state"`

	// Timestamp is a datetime indicating when this status was recorded.
	Timestamp *time.Time `json:"timestamp,omitempty" yaml:"timestamp,omitempty" mapstructure:"timestamp,omitempty"`
}

TaskStatus represents the status of a task at a specific point in time.

type TaskStatusUpdateEvent

type TaskStatusUpdateEvent struct {
	// ContextID is the context ID associated with the task. Required to be non-empty.
	ContextID string `json:"contextId" yaml:"contextId" mapstructure:"contextId"`

	// Final indicates if this is the final event in the stream for this interaction.
	Final bool `json:"final" yaml:"final" mapstructure:"final"`

	// Status is the new status of the task.
	Status TaskStatus `json:"status" yaml:"status" mapstructure:"status"`

	// TaskID is the ID of the task that was updated.
	TaskID TaskID `json:"taskId" yaml:"taskId" mapstructure:"taskId"`

	// Metadata is an optional metadata for extensions.
	Metadata map[string]any `json:"metadata,omitempty" yaml:"metadata,omitempty" mapstructure:"metadata,omitempty"`
}

TaskStatusUpdateEvent is an event sent by the agent to notify the client of a change in a task's status. This is typically used in streaming or subscription models.

func NewStatusUpdateEvent

func NewStatusUpdateEvent(infoProvider TaskInfoProvider, state TaskState, msg *Message) *TaskStatusUpdateEvent

NewStatusUpdateEvent creates a TaskStatusUpdateEvent that references the provided Task.

func (TaskStatusUpdateEvent) MarshalJSON

func (e TaskStatusUpdateEvent) MarshalJSON() ([]byte, error)

func (*TaskStatusUpdateEvent) Meta

func (a *TaskStatusUpdateEvent) Meta() map[string]any

func (*TaskStatusUpdateEvent) SetMeta added in v0.3.6

func (a *TaskStatusUpdateEvent) SetMeta(k string, v any)

func (*TaskStatusUpdateEvent) TaskInfo

func (m *TaskStatusUpdateEvent) TaskInfo() TaskInfo

type TaskVersion added in v0.3.4

type TaskVersion int64

TaskVersion is a version of the task stored on the server.

var TaskVersionMissing TaskVersion = 0

TaskVersionMissing is a special value used to denote that task version is not being tracked.

func (TaskVersion) After added in v0.3.4

func (v TaskVersion) After(another TaskVersion) bool

type TextPart

type TextPart struct {
	// Text is the string content of the text part.
	Text string `json:"text" yaml:"text" mapstructure:"text"`

	// Metadata is an optional metadata associated with the part.
	Metadata map[string]any `json:"metadata,omitempty" yaml:"metadata,omitempty" mapstructure:"metadata,omitempty"`
}

TextPart represents a text segment within a message or artifact.

func (TextPart) MarshalJSON

func (p TextPart) MarshalJSON() ([]byte, error)

func (TextPart) Meta

func (p TextPart) Meta() map[string]any

func (*TextPart) SetMeta added in v0.3.6

func (p *TextPart) SetMeta(k string, v any)

type TransportProtocol

type TransportProtocol string

TransportProtocol represents a transport protocol which a client and an agent can use for communication. Custom protocols are allowed and the type MUST NOT be treated as an enum.

const (
	TransportProtocolJSONRPC  TransportProtocol = "JSONRPC"
	TransportProtocolGRPC     TransportProtocol = "GRPC"
	TransportProtocolHTTPJSON TransportProtocol = "HTTP+JSON"
)

Jump to

Keyboard shortcuts

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