Documentation
ΒΆ
Overview ΒΆ
Package a2a implements the A2A protocol operations and data structures This file implements the agent card functionality as defined in the A2A schema
Package a2a implements the A2A protocol operations and data structures This file implements the Artifact structure as defined in the A2A schema
Package a2a implements the A2A protocol operations and data structures This file implements the specific error types defined in the A2A schema
Package a2a implements the A2A protocol operations and data structures This file implements the base JSON-RPC 2.0 request/response structures as defined in the A2A schema
Package a2a implements the A2A protocol operations and data structures This file defines message structures used for communication between agents according to the A2A protocol
Package a2a implements the A2A protocol operations and data structures This file implements the different part types (TextPart, FilePart, DataPart) as defined in the A2A schema
Package a2a implements the A2A protocol operations and data structures This package implements the specification defined in a2a.json schema
Package a2a implements the A2A protocol operations and data structures This file implements push notification functionality as defined in the A2A schema
Package a2a implements the A2A protocol operations and data structures This file defines task structures and operations according to the A2A protocol
Index ΒΆ
- Constants
- func ValidateFileContent(file FileContent) bool
- type AgentAuthentication
- type AgentCapabilities
- type AgentCard
- type AgentProvider
- type AgentSkill
- type Artifact
- func (a *Artifact) ToJSON() ([]byte, error)
- func (a *Artifact) WithAppend(append bool) *Artifact
- func (a *Artifact) WithDescription(description string) *Artifact
- func (a *Artifact) WithIndex(index int) *Artifact
- func (a *Artifact) WithLastChunk(lastChunk bool) *Artifact
- func (a *Artifact) WithMetadata(metadata map[string]interface{}) *Artifact
- func (a *Artifact) WithName(name string) *Artifact
- type AuthenticationInfo
- type CancelTaskRequest
- type CancelTaskResponse
- type DataPart
- type FileContent
- type FilePart
- type GetTaskPushNotificationRequest
- type GetTaskPushNotificationResponse
- type GetTaskRequest
- type GetTaskResponse
- type JSONRPCError
- func InternalError() *JSONRPCError
- func InvalidParamsError() *JSONRPCError
- func InvalidRequestError() *JSONRPCError
- func JSONParseError() *JSONRPCError
- func MethodNotFoundError() *JSONRPCError
- func NewJSONRPCError(code int, message string) *JSONRPCError
- func PushNotificationNotSupportedError() *JSONRPCError
- func TaskNotCancelableError() *JSONRPCError
- func TaskNotFoundError() *JSONRPCError
- func UnsupportedOperationError() *JSONRPCError
- type JSONRPCMessage
- type JSONRPCRequest
- type JSONRPCResponse
- type Message
- type MessageRole
- type Part
- type Protocol
- func (p *Protocol) CreateCancelTaskRequest(id interface{}, params TaskIdParams) *CancelTaskRequest
- func (p *Protocol) CreateGetTaskPushNotificationRequest(id interface{}, params TaskIdParams) *GetTaskPushNotificationRequest
- func (p *Protocol) CreateGetTaskRequest(id interface{}, params TaskQueryParams) *GetTaskRequest
- func (p *Protocol) CreateSendTaskRequest(id interface{}, params TaskSendParams) *SendTaskRequest
- func (p *Protocol) CreateSetTaskPushNotificationRequest(id interface{}, params TaskPushNotificationConfig) *SetTaskPushNotificationRequest
- func (p *Protocol) CreateTaskResubscriptionRequest(id interface{}, params TaskQueryParams) *TaskResubscriptionRequest
- func (p *Protocol) CreateTaskStreamingRequest(id interface{}, params TaskSendParams) *SendTaskStreamingRequest
- func (p *Protocol) ParseCancelTaskResponse(data []byte) (*CancelTaskResponse, error)
- func (p *Protocol) ParseGetTaskPushNotificationResponse(data []byte) (*GetTaskPushNotificationResponse, error)
- func (p *Protocol) ParseGetTaskResponse(data []byte) (*GetTaskResponse, error)
- func (p *Protocol) ParseResponse(data []byte) (*JSONRPCResponse, error)
- func (p *Protocol) ParseSendTaskResponse(data []byte) (*SendTaskResponse, error)
- func (p *Protocol) ParseSetTaskPushNotificationResponse(data []byte) (*SetTaskPushNotificationResponse, error)
- func (p *Protocol) ParseStreamingResponse(data []byte) (*SendTaskStreamingResponse, error)
- func (p *Protocol) ParseTask(response *JSONRPCResponse) (*Task, error)
- func (p *Protocol) ParseTaskArtifactUpdate(response *SendTaskStreamingResponse) (*TaskArtifactUpdateEvent, error)
- func (p *Protocol) ParseTaskStatusUpdate(response *SendTaskStreamingResponse) (*TaskStatusUpdateEvent, error)
- type PushNotificationConfig
- type SendTaskRequest
- type SendTaskResponse
- type SendTaskStreamingRequest
- type SendTaskStreamingResponse
- type SetTaskPushNotificationRequest
- type SetTaskPushNotificationResponse
- type Task
- type TaskArtifactUpdateEvent
- type TaskIdParams
- type TaskPushNotificationConfig
- type TaskQueryParams
- type TaskResubscriptionRequest
- type TaskSendParams
- type TaskState
- type TaskStatus
- type TaskStatusUpdateEvent
- type TextPart
Constants ΒΆ
const ( ErrCodeParseError = -32700 ErrCodeInvalidRequest = -32600 ErrCodeMethodNotFound = -32601 ErrCodeInvalidParams = -32602 ErrCodeInternalError = -32603 ErrCodeTaskNotFound = -32001 ErrCodeTaskNotCancelable = -32002 ErrCodePushNotificationNotSupported = -32003 ErrCodeUnsupportedOperation = -32004 )
Error codes as defined in the A2A schema
const JSONRPCVersion = "2.0"
JSONRPCVersion is the version of JSON-RPC used
Variables ΒΆ
This section is empty.
Functions ΒΆ
func ValidateFileContent ΒΆ
func ValidateFileContent(file FileContent) bool
ValidateFileContent validates that the FileContent follows the constraints (either 'bytes' or 'uri' must be provided, but not both)
Types ΒΆ
type AgentAuthentication ΒΆ
type AgentAuthentication struct {
Schemes []string `json:"schemes"`
Credentials *string `json:"credentials,omitempty"`
}
AgentAuthentication represents the authentication requirements of an agent
type AgentCapabilities ΒΆ
type AgentCapabilities struct {
Streaming bool `json:"streaming,omitempty"`
PushNotifications bool `json:"pushNotifications,omitempty"`
StateTransitionHistory bool `json:"stateTransitionHistory,omitempty"`
}
AgentCapabilities represents the capabilities of an agent
type AgentCard ΒΆ
type AgentCard struct {
Name string `json:"name"`
Description *string `json:"description,omitempty"`
URL string `json:"url"`
Provider *AgentProvider `json:"provider,omitempty"`
Version string `json:"version"`
DocumentationURL *string `json:"documentationUrl,omitempty"`
Capabilities AgentCapabilities `json:"capabilities"`
Authentication *AgentAuthentication `json:"authentication,omitempty"`
DefaultInputModes []string `json:"defaultInputModes,omitempty"`
DefaultOutputModes []string `json:"defaultOutputModes,omitempty"`
Skills []AgentSkill `json:"skills"`
}
AgentCard represents an agent's capabilities according to the A2A protocol
func NewAgentCard ΒΆ
func NewAgentCard(name, url, version string, capabilities AgentCapabilities, skills []AgentSkill) *AgentCard
NewAgentCard creates a new agent card with required fields
func (*AgentCard) Validate ΒΆ
Validate checks if the agent card is valid according to the A2A schema
func (*AgentCard) WithDescription ΒΆ
WithDescription adds a description to the agent card
type AgentProvider ΒΆ
type AgentProvider struct {
Organization string `json:"organization"`
URL *string `json:"url,omitempty"`
}
AgentProvider represents the provider of an agent
type AgentSkill ΒΆ
type AgentSkill struct {
ID string `json:"id"`
Name string `json:"name"`
Description *string `json:"description,omitempty"`
Tags []string `json:"tags,omitempty"`
Examples []string `json:"examples,omitempty"`
InputModes []string `json:"inputModes,omitempty"`
OutputModes []string `json:"outputModes,omitempty"`
}
AgentSkill represents a skill that an agent can perform
type Artifact ΒΆ
type Artifact struct {
Name *string `json:"name,omitempty"`
Description *string `json:"description,omitempty"`
Parts []Part `json:"parts"`
Index int `json:"index,omitempty"`
Append *bool `json:"append,omitempty"`
LastChunk *bool `json:"lastChunk,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
Artifact represents a task artifact in the A2A protocol This corresponds to the Artifact definition in the schema
func ArtifactFromJSON ΒΆ
ArtifactFromJSON parses JSON into an artifact
func NewArtifact ΒΆ
NewArtifact creates a new artifact with the given parts
func (*Artifact) WithAppend ΒΆ
WithAppend sets the append flag of the artifact
func (*Artifact) WithDescription ΒΆ
WithDescription adds a description to the artifact
func (*Artifact) WithLastChunk ΒΆ
WithLastChunk sets the lastChunk flag of the artifact
func (*Artifact) WithMetadata ΒΆ
WithMetadata adds metadata to the artifact
type AuthenticationInfo ΒΆ
type AuthenticationInfo struct {
Schemes []string `json:"schemes"`
Credentials *string `json:"credentials,omitempty"`
}
AuthenticationInfo represents authentication information in the A2A protocol
func NewAuthenticationInfo ΒΆ
func NewAuthenticationInfo(schemes []string) *AuthenticationInfo
NewAuthenticationInfo creates new authentication information
func (*AuthenticationInfo) WithCredentials ΒΆ
func (a *AuthenticationInfo) WithCredentials(credentials string) *AuthenticationInfo
WithCredentials adds credentials to the authentication information
type CancelTaskRequest ΒΆ
type CancelTaskRequest struct {
JSONRPC string `json:"jsonrpc"`
ID interface{} `json:"id,omitempty"`
Method string `json:"method"`
Params TaskIdParams `json:"params"`
}
CancelTaskRequest represents a JSON-RPC request for the tasks/cancel method
type CancelTaskResponse ΒΆ
type CancelTaskResponse struct {
JSONRPC string `json:"jsonrpc"`
ID interface{} `json:"id,omitempty"`
Result *Task `json:"result,omitempty"`
Error *JSONRPCError `json:"error,omitempty"`
}
CancelTaskResponse represents a JSON-RPC response for the tasks/cancel method
type DataPart ΒΆ
type DataPart struct {
Type string `json:"type"`
Data map[string]interface{} `json:"data"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
DataPart represents a data part
func NewDataPart ΒΆ
NewDataPart creates a new data part
func (DataPart) GetMetadata ΒΆ
GetMetadata returns the part metadata
func (DataPart) WithMetadata ΒΆ
WithMetadata adds metadata to the data part
type FileContent ΒΆ
type FileContent struct {
Name string `json:"name,omitempty"`
MimeType string `json:"mimeType,omitempty"`
Bytes string `json:"bytes,omitempty"`
URI string `json:"uri,omitempty"`
}
FileContent represents the content of a file, either as base64 encoded bytes or a URI. Either 'bytes' or 'uri' must be provided, but not both.
func NewFileContentWithBytes ΒΆ
func NewFileContentWithBytes(name, mimeType, bytes string) FileContent
NewFileContentWithBytes creates a new FileContent with base64 encoded data
func NewFileContentWithURI ΒΆ
func NewFileContentWithURI(name, mimeType, uri string) FileContent
NewFileContentWithURI creates a new FileContent with a URI reference
type FilePart ΒΆ
type FilePart struct {
Type string `json:"type"`
File FileContent `json:"file"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
FilePart represents a file part
func (FilePart) GetMetadata ΒΆ
GetMetadata returns the part metadata
func (FilePart) WithMetadata ΒΆ
WithMetadata adds metadata to the file part
type GetTaskPushNotificationRequest ΒΆ
type GetTaskPushNotificationRequest struct {
JSONRPC string `json:"jsonrpc"`
ID interface{} `json:"id,omitempty"`
Method string `json:"method"`
Params TaskIdParams `json:"params"`
}
GetTaskPushNotificationRequest represents a JSON-RPC request for the tasks/pushNotification/get method
type GetTaskPushNotificationResponse ΒΆ
type GetTaskPushNotificationResponse struct {
JSONRPC string `json:"jsonrpc"`
ID interface{} `json:"id,omitempty"`
Result *TaskPushNotificationConfig `json:"result,omitempty"`
Error *JSONRPCError `json:"error,omitempty"`
}
GetTaskPushNotificationResponse represents a JSON-RPC response for the tasks/pushNotification/get method
type GetTaskRequest ΒΆ
type GetTaskRequest struct {
JSONRPC string `json:"jsonrpc"`
ID interface{} `json:"id,omitempty"`
Method string `json:"method"`
Params TaskQueryParams `json:"params"`
}
GetTaskRequest represents a JSON-RPC request for the tasks/get method
type GetTaskResponse ΒΆ
type GetTaskResponse struct {
JSONRPC string `json:"jsonrpc"`
ID interface{} `json:"id,omitempty"`
Result *Task `json:"result,omitempty"`
Error *JSONRPCError `json:"error,omitempty"`
}
GetTaskResponse represents a JSON-RPC response for the tasks/get method
type JSONRPCError ΒΆ
type JSONRPCError struct {
Code int `json:"code"`
Message string `json:"message"`
Data interface{} `json:"data,omitempty"`
}
JSONRPCError represents a JSON-RPC 2.0 error
func InvalidParamsError ΒΆ
func InvalidParamsError() *JSONRPCError
InvalidParamsError creates an invalid parameters error
func InvalidRequestError ΒΆ
func InvalidRequestError() *JSONRPCError
InvalidRequestError creates an invalid request error
func JSONParseError ΒΆ
func JSONParseError() *JSONRPCError
JSONParseError creates a JSON parse error
func MethodNotFoundError ΒΆ
func MethodNotFoundError() *JSONRPCError
MethodNotFoundError creates a method not found error
func NewJSONRPCError ΒΆ
func NewJSONRPCError(code int, message string) *JSONRPCError
NewJSONRPCError creates a new JSON-RPC error
func PushNotificationNotSupportedError ΒΆ
func PushNotificationNotSupportedError() *JSONRPCError
PushNotificationNotSupportedError creates a push notification not supported error
func TaskNotCancelableError ΒΆ
func TaskNotCancelableError() *JSONRPCError
TaskNotCancelableError creates a task not cancelable error
func TaskNotFoundError ΒΆ
func TaskNotFoundError() *JSONRPCError
TaskNotFoundError creates a task not found error
func UnsupportedOperationError ΒΆ
func UnsupportedOperationError() *JSONRPCError
UnsupportedOperationError creates an unsupported operation error
func (*JSONRPCError) WithData ΒΆ
func (e *JSONRPCError) WithData(data interface{}) *JSONRPCError
WithData adds data to the error
type JSONRPCMessage ΒΆ
type JSONRPCMessage struct {
JSONRPC string `json:"jsonrpc"`
ID interface{} `json:"id,omitempty"`
}
JSONRPCMessage represents a JSON-RPC 2.0 message
func NewJSONRPCMessage ΒΆ
func NewJSONRPCMessage(id interface{}) *JSONRPCMessage
NewJSONRPCMessage creates a new JSON-RPC message
type JSONRPCRequest ΒΆ
type JSONRPCRequest struct {
JSONRPC string `json:"jsonrpc"`
ID interface{} `json:"id,omitempty"`
Method string `json:"method"`
Params interface{} `json:"params,omitempty"`
}
JSONRPCRequest represents a JSON-RPC 2.0 request
func NewJSONRPCRequest ΒΆ
func NewJSONRPCRequest(id interface{}, method string, params interface{}) *JSONRPCRequest
NewJSONRPCRequest creates a new JSON-RPC request
func RequestFromJSON ΒΆ
func RequestFromJSON(data []byte) (*JSONRPCRequest, error)
RequestFromJSON parses JSON into a request
func (*JSONRPCRequest) ToJSON ΒΆ
func (r *JSONRPCRequest) ToJSON() ([]byte, error)
ToJSON converts the request to JSON
type JSONRPCResponse ΒΆ
type JSONRPCResponse struct {
JSONRPC string `json:"jsonrpc"`
ID interface{} `json:"id,omitempty"`
Result interface{} `json:"result,omitempty"`
Error *JSONRPCError `json:"error,omitempty"`
}
JSONRPCResponse represents a JSON-RPC 2.0 response
func NewJSONRPCErrorResponse ΒΆ
func NewJSONRPCErrorResponse(id interface{}, error *JSONRPCError) *JSONRPCResponse
NewJSONRPCErrorResponse creates a new JSON-RPC error response
func NewJSONRPCResponse ΒΆ
func NewJSONRPCResponse(id interface{}, result interface{}) *JSONRPCResponse
NewJSONRPCResponse creates a new JSON-RPC response
func ResponseFromJSON ΒΆ
func ResponseFromJSON(data []byte) (*JSONRPCResponse, error)
ResponseFromJSON parses JSON into a response
func (*JSONRPCResponse) IsError ΒΆ
func (r *JSONRPCResponse) IsError() bool
IsError checks if the response is an error
func (*JSONRPCResponse) ToJSON ΒΆ
func (r *JSONRPCResponse) ToJSON() ([]byte, error)
ToJSON converts the response to JSON
type Message ΒΆ
type Message struct {
Role MessageRole `json:"role"`
Parts []Part `json:"parts"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
Message represents a communication between agents according to A2A protocol
func MessageFromJSON ΒΆ
MessageFromJSON parses JSON into a message
func NewMessage ΒΆ
func NewMessage(role MessageRole, parts []Part) *Message
NewMessage creates a new message
func (*Message) MarshalJSON ΒΆ
MarshalJSON serializes the message, preserving the concrete Part types.
func (*Message) UnmarshalJSON ΒΆ
UnmarshalJSON deserializes the message, dispatching each part to its concrete type (TextPart, FilePart, DataPart) based on the "type" field.
func (*Message) WithMetadata ΒΆ
WithMetadata adds metadata to the message
type MessageRole ΒΆ
type MessageRole string
MessageRole defines the sender role
const ( RoleUser MessageRole = "user" RoleAgent MessageRole = "agent" )
type Protocol ΒΆ
type Protocol struct {
}
Protocol implements the A2A protocol
func (*Protocol) CreateCancelTaskRequest ΒΆ
func (p *Protocol) CreateCancelTaskRequest(id interface{}, params TaskIdParams) *CancelTaskRequest
CreateCancelTaskRequest creates a JSON-RPC request for tasks/cancel
func (*Protocol) CreateGetTaskPushNotificationRequest ΒΆ
func (p *Protocol) CreateGetTaskPushNotificationRequest(id interface{}, params TaskIdParams) *GetTaskPushNotificationRequest
CreateGetTaskPushNotificationRequest creates a JSON-RPC request for tasks/pushNotification/get
func (*Protocol) CreateGetTaskRequest ΒΆ
func (p *Protocol) CreateGetTaskRequest(id interface{}, params TaskQueryParams) *GetTaskRequest
CreateGetTaskRequest creates a JSON-RPC request for tasks/get
func (*Protocol) CreateSendTaskRequest ΒΆ
func (p *Protocol) CreateSendTaskRequest(id interface{}, params TaskSendParams) *SendTaskRequest
CreateSendTaskRequest creates a JSON-RPC request for tasks/send
func (*Protocol) CreateSetTaskPushNotificationRequest ΒΆ
func (p *Protocol) CreateSetTaskPushNotificationRequest(id interface{}, params TaskPushNotificationConfig) *SetTaskPushNotificationRequest
CreateSetTaskPushNotificationRequest creates a JSON-RPC request for tasks/pushNotification/set
func (*Protocol) CreateTaskResubscriptionRequest ΒΆ
func (p *Protocol) CreateTaskResubscriptionRequest(id interface{}, params TaskQueryParams) *TaskResubscriptionRequest
CreateTaskResubscriptionRequest creates a JSON-RPC request for tasks/resubscribe
func (*Protocol) CreateTaskStreamingRequest ΒΆ
func (p *Protocol) CreateTaskStreamingRequest(id interface{}, params TaskSendParams) *SendTaskStreamingRequest
CreateTaskStreamingRequest creates a JSON-RPC request for tasks/sendSubscribe
func (*Protocol) ParseCancelTaskResponse ΒΆ
func (p *Protocol) ParseCancelTaskResponse(data []byte) (*CancelTaskResponse, error)
ParseCancelTaskResponse parses a CancelTaskResponse from JSON
func (*Protocol) ParseGetTaskPushNotificationResponse ΒΆ
func (p *Protocol) ParseGetTaskPushNotificationResponse(data []byte) (*GetTaskPushNotificationResponse, error)
ParseGetTaskPushNotificationResponse parses a GetTaskPushNotificationResponse from JSON
func (*Protocol) ParseGetTaskResponse ΒΆ
func (p *Protocol) ParseGetTaskResponse(data []byte) (*GetTaskResponse, error)
ParseGetTaskResponse parses a GetTaskResponse from JSON
func (*Protocol) ParseResponse ΒΆ
func (p *Protocol) ParseResponse(data []byte) (*JSONRPCResponse, error)
ParseResponse parses a JSON-RPC response
func (*Protocol) ParseSendTaskResponse ΒΆ
func (p *Protocol) ParseSendTaskResponse(data []byte) (*SendTaskResponse, error)
ParseSendTaskResponse parses a SendTaskResponse from JSON
func (*Protocol) ParseSetTaskPushNotificationResponse ΒΆ
func (p *Protocol) ParseSetTaskPushNotificationResponse(data []byte) (*SetTaskPushNotificationResponse, error)
ParseSetTaskPushNotificationResponse parses a SetTaskPushNotificationResponse from JSON
func (*Protocol) ParseStreamingResponse ΒΆ
func (p *Protocol) ParseStreamingResponse(data []byte) (*SendTaskStreamingResponse, error)
ParseStreamingResponse parses a SendTaskStreamingResponse from JSON
func (*Protocol) ParseTask ΒΆ
func (p *Protocol) ParseTask(response *JSONRPCResponse) (*Task, error)
ParseTask parses a Task from a JSON-RPC response
func (*Protocol) ParseTaskArtifactUpdate ΒΆ
func (p *Protocol) ParseTaskArtifactUpdate(response *SendTaskStreamingResponse) (*TaskArtifactUpdateEvent, error)
ParseTaskArtifactUpdate parses a TaskArtifactUpdateEvent from a streaming response
func (*Protocol) ParseTaskStatusUpdate ΒΆ
func (p *Protocol) ParseTaskStatusUpdate(response *SendTaskStreamingResponse) (*TaskStatusUpdateEvent, error)
ParseTaskStatusUpdate parses a TaskStatusUpdateEvent from a streaming response
type PushNotificationConfig ΒΆ
type PushNotificationConfig struct {
URL string `json:"url"`
Token *string `json:"token,omitempty"`
Authentication *AuthenticationInfo `json:"authentication,omitempty"`
}
PushNotificationConfig represents push notification configuration in the A2A protocol
func NewPushNotificationConfig ΒΆ
func NewPushNotificationConfig(url string) *PushNotificationConfig
NewPushNotificationConfig creates a new push notification configuration
func (*PushNotificationConfig) WithAuthentication ΒΆ
func (p *PushNotificationConfig) WithAuthentication(auth *AuthenticationInfo) *PushNotificationConfig
WithAuthentication adds authentication information to the push notification configuration
func (*PushNotificationConfig) WithToken ΒΆ
func (p *PushNotificationConfig) WithToken(token string) *PushNotificationConfig
WithToken adds a token to the push notification configuration
type SendTaskRequest ΒΆ
type SendTaskRequest struct {
JSONRPC string `json:"jsonrpc"`
ID interface{} `json:"id,omitempty"`
Method string `json:"method"`
Params TaskSendParams `json:"params"`
}
SendTaskRequest represents a JSON-RPC request for the tasks/send method
type SendTaskResponse ΒΆ
type SendTaskResponse struct {
JSONRPC string `json:"jsonrpc"`
ID interface{} `json:"id,omitempty"`
Result *Task `json:"result,omitempty"`
Error *JSONRPCError `json:"error,omitempty"`
}
SendTaskResponse represents a JSON-RPC response for the tasks/send method
type SendTaskStreamingRequest ΒΆ
type SendTaskStreamingRequest struct {
JSONRPC string `json:"jsonrpc"`
ID interface{} `json:"id,omitempty"`
Method string `json:"method"`
Params TaskSendParams `json:"params"`
}
SendTaskStreamingRequest represents a JSON-RPC request for the tasks/sendSubscribe method
type SendTaskStreamingResponse ΒΆ
type SendTaskStreamingResponse struct {
JSONRPC string `json:"jsonrpc"`
ID interface{} `json:"id,omitempty"`
Result interface{} `json:"result,omitempty"`
Error *JSONRPCError `json:"error,omitempty"`
}
SendTaskStreamingResponse represents a JSON-RPC response for the tasks/sendSubscribe method
type SetTaskPushNotificationRequest ΒΆ
type SetTaskPushNotificationRequest struct {
JSONRPC string `json:"jsonrpc"`
ID interface{} `json:"id,omitempty"`
Method string `json:"method"`
Params TaskPushNotificationConfig `json:"params"`
}
SetTaskPushNotificationRequest represents a JSON-RPC request for the tasks/pushNotification/set method
type SetTaskPushNotificationResponse ΒΆ
type SetTaskPushNotificationResponse struct {
JSONRPC string `json:"jsonrpc"`
ID interface{} `json:"id,omitempty"`
Result *TaskPushNotificationConfig `json:"result,omitempty"`
Error *JSONRPCError `json:"error,omitempty"`
}
SetTaskPushNotificationResponse represents a JSON-RPC response for the tasks/pushNotification/set method
type Task ΒΆ
type Task struct {
ID string `json:"id"`
SessionID *string `json:"sessionId,omitempty"`
Status TaskStatus `json:"status"`
Artifacts []Artifact `json:"artifacts,omitempty"`
History []Message `json:"history,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
Task represents a task in the A2A protocol
func TaskFromJSON ΒΆ
TaskFromJSON parses JSON into a task
func (*Task) AddArtifact ΒΆ
AddArtifact adds an artifact to the task
func (*Task) AddToHistory ΒΆ
AddToHistory adds a message to the task history
func (*Task) WithMessage ΒΆ
WithMessage adds a message to the task status
func (*Task) WithSessionID ΒΆ
WithSessionID adds a session ID to the task
type TaskArtifactUpdateEvent ΒΆ
type TaskArtifactUpdateEvent struct {
ID string `json:"id"`
Artifact Artifact `json:"artifact"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
TaskArtifactUpdateEvent represents a task artifact update event
type TaskIdParams ΒΆ
type TaskIdParams struct {
ID string `json:"id"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
TaskIdParams represents parameters for methods requiring only a task ID
type TaskPushNotificationConfig ΒΆ
type TaskPushNotificationConfig struct {
ID string `json:"id"`
PushNotificationConfig PushNotificationConfig `json:"pushNotificationConfig"`
}
TaskPushNotificationConfig represents task push notification configuration
func NewTaskPushNotificationConfig ΒΆ
func NewTaskPushNotificationConfig(id string, config PushNotificationConfig) *TaskPushNotificationConfig
NewTaskPushNotificationConfig creates a new task push notification configuration
type TaskQueryParams ΒΆ
type TaskQueryParams struct {
ID string `json:"id"`
HistoryLength *int `json:"historyLength,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
TaskQueryParams represents parameters for tasks/get method
type TaskResubscriptionRequest ΒΆ
type TaskResubscriptionRequest struct {
JSONRPC string `json:"jsonrpc"`
ID interface{} `json:"id,omitempty"`
Method string `json:"method"`
Params TaskQueryParams `json:"params"`
}
TaskResubscriptionRequest represents a JSON-RPC request for the tasks/resubscribe method
type TaskSendParams ΒΆ
type TaskSendParams struct {
ID string `json:"id"`
SessionID string `json:"sessionId,omitempty"`
Message Message `json:"message"`
PushNotification *PushNotificationConfig `json:"pushNotification,omitempty"`
HistoryLength *int `json:"historyLength,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
TaskSendParams represents parameters for tasks/send method
type TaskState ΒΆ
type TaskState string
TaskState represents the current state of a task
const ( TaskStateSubmitted TaskState = "submitted" TaskStateWorking TaskState = "working" TaskStateInputRequired TaskState = "input-required" TaskStateCompleted TaskState = "completed" TaskStateCanceled TaskState = "canceled" TaskStateFailed TaskState = "failed" TaskStateUnknown TaskState = "unknown" )
type TaskStatus ΒΆ
type TaskStatus struct {
State TaskState `json:"state"`
Message *Message `json:"message,omitempty"`
Timestamp time.Time `json:"timestamp"`
}
TaskStatus represents the status of a task
type TaskStatusUpdateEvent ΒΆ
type TaskStatusUpdateEvent struct {
ID string `json:"id"`
Status TaskStatus `json:"status"`
Final bool `json:"final,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
TaskStatusUpdateEvent represents a task status update event
type TextPart ΒΆ
type TextPart struct {
Type string `json:"type"`
Text string `json:"text"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
TextPart represents a text part
func (TextPart) GetMetadata ΒΆ
GetMetadata returns the part metadata
func (TextPart) WithMetadata ΒΆ
WithMetadata adds metadata to the text part