Documentation
¶
Overview ¶
Package a2aclient implements the bounded outbound A2A wire protocol.
Index ¶
- func EncodeRequest(version string, op Operation, r Request) ([]byte, error)
- func ParseCard(body []byte, dialect string) (*Card, Interface, error)
- func ParseURL(raw string) (*url.URL, error)
- type Artifact
- type Card
- type CardCache
- type CardResponse
- type Client
- type Compatibility
- type Error
- type Interface
- type Message
- type Operation
- type Options
- type Part
- type Request
- type Result
- type Skill
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncodeRequest ¶
EncodeRequest encodes only the supported fields, bounding aggregate input.
Types ¶
type Card ¶
type Card struct {
SupportedInterfaces []Interface `json:"supportedInterfaces"`
ProtocolVersion string `json:"protocolVersion"`
URL string `json:"url"`
PreferredTransport string `json:"preferredTransport"`
AdditionalInterfaces []Interface `json:"additionalInterfaces"`
Capabilities struct {
Extensions []struct {
Required bool `json:"required"`
} `json:"extensions"`
} `json:"capabilities"`
DefaultInputModes []string `json:"defaultInputModes"`
DefaultOutputModes []string `json:"defaultOutputModes"`
Security json.RawMessage `json:"security"`
SecurityRequirements json.RawMessage `json:"securityRequirements"`
SecuritySchemes json.RawMessage `json:"securitySchemes"`
Skills []Skill `json:"skills"`
}
Card retains the discovery fields needed by the bounded adapter subset. Text and raw compatibility declarations are untrusted, not diagnostic values.
type CardCache ¶
type CardCache struct {
// contains filtered or unexported fields
}
CardCache is private to one registration and credential/session identity. Approved trust must be stored separately; a cache hit is not approval.
func NewCardCache ¶
NewCardCache binds freshness to an immutable client and configured dialect.
type CardResponse ¶
CardResponse is bounded discovery evidence. Callers must keep it out of diagnostics.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client owns a single bounded HTTP transport and a private discovery session. It performs no automatic RPC retries and has no ambient cookie credentials.
func (*Client) Close ¶
func (c *Client) Close()
Close releases idle transport connections. In-flight calls are canceled by their owning adapter generation before transport cleanup.
func (*Client) FetchCard ¶
func (c *Client) FetchCard(ctx context.Context) (CardResponse, error)
FetchCard performs a full GET, following at most three same-origin redirects.
type Compatibility ¶
Compatibility is the supported media intersection for one message operation.
func CheckCompatibility ¶
func CheckCompatibility(card *Card, skill *Skill, version string, bearer, bedrock bool) (Compatibility, error)
CheckCompatibility evaluates agent defaults or a skill's explicit overrides. Security alternatives are OR; schemes within an alternative are AND. URLs in security declarations are descriptive only and are never fetched here.
type Error ¶
type Error struct {
Category string
Status int
Code int
Retryable bool
// contains filtered or unexported fields
}
Error contains only locally authored diagnostics, never downstream text.
type Interface ¶
type Interface struct {
URL string `json:"url"`
ProtocolBinding string `json:"protocolBinding"`
ProtocolVersion string `json:"protocolVersion"`
Tenant string `json:"tenant"`
Transport string `json:"transport"`
}
Interface describes an advertised protocol binding. It is not authorization.
type Operation ¶
type Operation uint8
Operation is the bounded, non-streaming subset of A2A JSON-RPC.
type Part ¶
type Part struct {
Type string `json:"type"`
Text string `json:"text,omitempty"`
Data map[string]any `json:"data,omitempty"`
}
Part holds accepted application content. Numbers in Data retain JSON precision.
func (Part) MarshalJSON ¶
MarshalJSON preserves empty text and empty data objects as application content.
type Request ¶
type Request struct {
ID, MessageID, TaskID, ContextID string
Text string
Data map[string]any
SkillID string
OutputModes []string
ReturnImmediately bool
HistoryLength int
}
Request contains protocol IDs supplied by trusted routing, never capabilities.
type Result ¶
type Result struct {
Kind, TaskID, ContextID, State string
Parts []Part
StatusMessages, History []Message
Artifacts []Artifact
}
Result is decoded evidence, not authority. Routing must validate its top-level IDs against the admitted operation before issuing or updating capabilities.
type Skill ¶
type Skill struct {
ID string `json:"id"`
Description string `json:"description"`
InputModes []string `json:"inputModes"`
OutputModes []string `json:"outputModes"`
Security json.RawMessage `json:"security"`
SecurityRequirements json.RawMessage `json:"securityRequirements"`
}
Skill preserves authored descriptions and mode/security overrides.