Documentation
¶
Index ¶
- type A2AClient
- type Client
- func (c *Client) CancelTask(ctx context.Context, params types.TaskIdParams) (*types.JSONRPCSuccessResponse, error)
- func (c *Client) GetAgentCard(ctx context.Context) (*types.AgentCard, error)
- func (c *Client) GetBaseURL() string
- func (c *Client) GetConfig() Config
- func (c *Client) GetHealth(ctx context.Context) (*HealthResponse, error)
- func (c *Client) GetLogger() *zap.Logger
- func (c *Client) GetTask(ctx context.Context, params types.TaskQueryParams) (*types.JSONRPCSuccessResponse, error)
- func (c *Client) ListTasks(ctx context.Context, params types.TaskListParams) (*types.JSONRPCSuccessResponse, error)
- func (c *Client) RemoveHeader(key string)
- func (c *Client) SendTask(ctx context.Context, params types.MessageSendParams) (*types.JSONRPCSuccessResponse, error)
- func (c *Client) SendTaskStreaming(ctx context.Context, params types.MessageSendParams, eventChan chan<- any) error
- func (c *Client) SetHTTPClient(client *http.Client)
- func (c *Client) SetHeader(key, value string)
- func (c *Client) SetLogger(logger *zap.Logger)
- func (c *Client) SetMaxRetries(maxRetries int)
- func (c *Client) SetRetryDelay(delay time.Duration)
- func (c *Client) SetTimeout(timeout time.Duration)
- type Config
- type HealthResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type A2AClient ¶
type A2AClient interface {
// Agent discovery
GetAgentCard(ctx context.Context) (*types.AgentCard, error)
GetHealth(ctx context.Context) (*HealthResponse, error)
// Task operations
SendTask(ctx context.Context, params types.MessageSendParams) (*types.JSONRPCSuccessResponse, error)
SendTaskStreaming(ctx context.Context, params types.MessageSendParams, eventChan chan<- any) error
GetTask(ctx context.Context, params types.TaskQueryParams) (*types.JSONRPCSuccessResponse, error)
ListTasks(ctx context.Context, params types.TaskListParams) (*types.JSONRPCSuccessResponse, error)
CancelTask(ctx context.Context, params types.TaskIdParams) (*types.JSONRPCSuccessResponse, error)
// Configuration
SetTimeout(timeout time.Duration)
SetHTTPClient(client *http.Client)
GetBaseURL() string
// Logger configuration
SetLogger(logger *zap.Logger)
GetLogger() *zap.Logger
}
A2AClient defines the interface for an A2A protocol client
func NewClientWithConfig ¶
NewClientWithConfig creates a new A2A client with custom configuration
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents an A2A protocol client
func (*Client) CancelTask ¶
func (c *Client) CancelTask(ctx context.Context, params types.TaskIdParams) (*types.JSONRPCSuccessResponse, error)
CancelTaskWithContext cancels a task with context support
func (*Client) GetAgentCard ¶
GetAgentCard retrieves the agent card information via HTTP GET to .well-known/agent.json
func (*Client) GetBaseURL ¶
GetBaseURL returns the base URL of the client
func (*Client) GetHealth ¶
func (c *Client) GetHealth(ctx context.Context) (*HealthResponse, error)
GetHealth retrieves the health status of the agent via HTTP GET to /health
func (*Client) GetTask ¶
func (c *Client) GetTask(ctx context.Context, params types.TaskQueryParams) (*types.JSONRPCSuccessResponse, error)
GetTaskWithContext retrieves the status of a task with context support
func (*Client) ListTasks ¶
func (c *Client) ListTasks(ctx context.Context, params types.TaskListParams) (*types.JSONRPCSuccessResponse, error)
ListTasks retrieves a list of tasks from the agent
func (*Client) RemoveHeader ¶
RemoveHeader removes a custom header
func (*Client) SendTask ¶
func (c *Client) SendTask(ctx context.Context, params types.MessageSendParams) (*types.JSONRPCSuccessResponse, error)
SendTask sends a task to the agent (primary interface following official A2A pattern)
func (*Client) SendTaskStreaming ¶
func (c *Client) SendTaskStreaming(ctx context.Context, params types.MessageSendParams, eventChan chan<- any) error
SendTaskStreaming sends a task and streams the response (primary interface following official A2A pattern)
func (*Client) SetHTTPClient ¶
SetHTTPClient allows customizing the HTTP client
func (*Client) SetMaxRetries ¶
SetMaxRetries sets the maximum number of retry attempts
func (*Client) SetRetryDelay ¶
SetRetryDelay sets the delay between retry attempts
func (*Client) SetTimeout ¶
SetTimeout sets the timeout for HTTP requests
type Config ¶
type Config struct {
BaseURL string
Timeout time.Duration
HTTPClient *http.Client
UserAgent string
Headers map[string]string
MaxRetries int
RetryDelay time.Duration
Logger *zap.Logger
}
Config holds configuration options for the A2A client
func DefaultConfig ¶
DefaultConfig returns a default configuration
type HealthResponse ¶
type HealthResponse struct {
Status string `json:"status"`
}
HealthResponse represents the response from the health endpoint