Documentation
¶
Overview ¶
Package a2atransport provides a strict, bounded JSON-RPC/SSE client transport for the A2A protocol profile used by NeKiro.
The package intentionally owns no Agent discovery, authorization, credential generation, invocation lineage, retry, persistence, or Agent Runtime behavior. Callers provide an exact endpoint, byte limits, and any request metadata interceptors for every operation.
Index ¶
- Constants
- type CallOptions
- type Client
- func (client *Client) CancelTask(ctx context.Context, options CallOptions, taskID a2a.TaskID) (*a2a.Task, error)
- func (client *Client) SendMessage(ctx context.Context, options CallOptions, params *a2a.MessageSendParams) (a2a.SendMessageResult, error)
- func (client *Client) SendStreamingMessage(ctx context.Context, options CallOptions, params *a2a.MessageSendParams) iter.Seq2[StreamItem, error]
- type Failure
- type FailureKind
- type StreamItem
Examples ¶
Constants ¶
const ( // ProtocolVersion is the A2A protocol version verified by this release. ProtocolVersion = "0.3.0" // A2AGoVersion is the official Go protocol-library version verified by this release. A2AGoVersion = "v0.3.15" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CallOptions ¶
type CallOptions struct {
Endpoint string
MaxResponseBytes int64
MaxEventBytes int64
Interceptors []a2aclient.CallInterceptor
}
CallOptions contains all transport policy required for one A2A operation. No endpoint, byte bound, or interceptor is inferred by the package.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client executes strict JSON-RPC A2A operations with caller-owned policy.
Example ¶
client, err := a2atransport.NewClient(&http.Client{})
if err != nil {
panic(err)
}
options := a2atransport.CallOptions{
Endpoint: "https://agent.example/a2a",
MaxResponseBytes: 1 << 20,
MaxEventBytes: 1 << 20,
}
_, _ = client.SendMessage(context.Background(), options, &a2a.MessageSendParams{})
for _, streamErr := range client.SendStreamingMessage(context.Background(), options, &a2a.MessageSendParams{}) {
_ = streamErr
}
func NewClient ¶
NewClient clones httpClient and installs a redirect-rejection policy. A nil *http.Client is invalid. A client whose Transport is nil retains Go's documented http.DefaultTransport behavior.
func (*Client) CancelTask ¶
func (client *Client) CancelTask(ctx context.Context, options CallOptions, taskID a2a.TaskID) (*a2a.Task, error)
CancelTask executes one A2A tasks/cancel operation. Callers own any timeout and decide whether the operation should be attempted.
func (*Client) SendMessage ¶
func (client *Client) SendMessage(ctx context.Context, options CallOptions, params *a2a.MessageSendParams) (a2a.SendMessageResult, error)
SendMessage executes A2A message/send.
func (*Client) SendStreamingMessage ¶
func (client *Client) SendStreamingMessage(ctx context.Context, options CallOptions, params *a2a.MessageSendParams) iter.Seq2[StreamItem, error]
SendStreamingMessage executes A2A message/stream and returns the decoded A2A event together with the exact JSON-RPC result bytes that produced it.
type Failure ¶
type Failure struct {
// contains filtered or unexported fields
}
Failure carries a stable kind and an inspectable cause. Error deliberately omits cause text so callers do not leak remote endpoints or credentials by formatting the transport failure.
func (*Failure) Kind ¶
func (failure *Failure) Kind() FailureKind
type FailureKind ¶
type FailureKind string
FailureKind is a stable, transport-only error classification.
const ( FailureInvalidArgument FailureKind = "invalid_argument" FailureProtocol FailureKind = "protocol" FailureRemoteAgent FailureKind = "remote_agent" FailureDeadlineExceeded FailureKind = "deadline_exceeded" FailureCanceled FailureKind = "canceled" FailureResponseTooLarge FailureKind = "response_too_large" )
func FailureKindOf ¶
func FailureKindOf(err error) (FailureKind, bool)
FailureKindOf returns the first transport Failure classification in err's unwrap chain.
type StreamItem ¶
type StreamItem struct {
Event a2a.Event
Result json.RawMessage
}
StreamItem is one decoded A2A event and the immutable raw JSON-RPC result that produced it.