a2a

package
v0.0.0-...-2569ef9 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentCard

type AgentCard struct {
	Name         string   `json:"name"`
	Description  string   `json:"description"`
	URL          string   `json:"url"`
	Capabilities []string `json:"capabilities,omitempty"`
}

AgentCard describes an agent's capabilities.

type Artifact

type Artifact struct {
	Type     string `json:"type"`
	MimeType string `json:"mimeType,omitempty"`
	Data     string `json:"data"`
}

Artifact represents output from an agent.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client calls other A2A agents.

func NewClient

func NewClient() *Client

NewClient creates a new A2A client.

func (*Client) GetAgentCard

func (c *Client) GetAgentCard(ctx context.Context, baseURL string) (*AgentCard, error)

GetAgentCard fetches an agent's card from well-known endpoint.

func (*Client) SendMessage

func (c *Client) SendMessage(ctx context.Context, endpoint string, msg Message) (*Result, error)

SendMessage sends a message to another agent.

type Error

type Error struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

Error represents a JSON-RPC error.

type Handler

type Handler func(ctx context.Context, msg Message) (*Result, error)

Handler processes incoming A2A requests.

type Message

type Message struct {
	Role      string `json:"role"`
	Parts     []Part `json:"parts"`
	MessageID string `json:"messageId,omitempty"`
}

Message represents an A2A message (JSON-RPC 2.0).

type Part

type Part struct {
	Type string `json:"type"` // "text", "file", etc.
	Text string `json:"text,omitempty"`
}

Part represents a content part in a message.

type Request

type Request struct {
	JSONRPC string         `json:"jsonrpc"`
	ID      any            `json:"id"`
	Method  string         `json:"method"`
	Params  map[string]any `json:"params"`
}

Request is the JSON-RPC request for A2A.

type Response

type Response struct {
	JSONRPC string  `json:"jsonrpc"`
	ID      any     `json:"id"`
	Result  *Result `json:"result,omitempty"`
	Error   *Error  `json:"error,omitempty"`
}

Response is the JSON-RPC response for A2A.

type Result

type Result struct {
	Artifacts []Artifact     `json:"artifacts,omitempty"`
	Usage     map[string]any `json:"usage,omitempty"`
	ToolsUsed []string       `json:"toolsUsed,omitempty"`
}

Result contains the successful response data.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server handles incoming A2A requests.

func NewServer

func NewServer(card AgentCard, handler Handler) *Server

NewServer creates a new A2A server.

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements http.Handler.

Jump to

Keyboard shortcuts

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