Documentation
¶
Overview ¶
Package a2aext provides utilities for A2A extension implementers.
Index ¶
- Constants
- func GetMetadata(ctx context.Context) map[string]any
- func GetRequestHeaders(ctx context.Context) map[string][]string
- func NewActivator(extensionURIs ...string) a2aclient.CallInterceptor
- func NewClientPropagator(config *ClientPropagatorConfig) a2aclient.CallInterceptor
- func NewServerPropagator(config *ServerPropagatorConfig) a2asrv.CallInterceptor
- type ClientPropagatorConfig
- type ServerPropagatorConfig
Constants ¶
const CallMetaKey = "x-a2a-extensions"
Variables ¶
This section is empty.
Functions ¶
func GetMetadata ¶
GetMetadata returns the metadata attached as per ServerPropagatorConfig. Returns nil context was not found.
func GetRequestHeaders ¶
GetRequestHeaders returns the request headers attached as per ServerPropagatorConfig. Returns nil context was not found.
func NewActivator ¶
func NewActivator(extensionURIs ...string) a2aclient.CallInterceptor
NewActivator creates an a2aclient.CallInterceptor which requests extension activation when calls are made to the server supporting these extensions.
func NewClientPropagator ¶
func NewClientPropagator(config *ClientPropagatorConfig) a2aclient.CallInterceptor
NewClientPropagator returns a client interceptor that propagates payload metada header values. The client interceptor needs to be set on a2aclient or client factory using a2aclient.WithInterceptors option.
func NewServerPropagator ¶
func NewServerPropagator(config *ServerPropagatorConfig) a2asrv.CallInterceptor
NewServerPropagator returns a server interceptor that propagates payload metada header values. The server interceptor needs to be set on request handler using a2asrv.WithCallInterceptor option.
Types ¶
type ClientPropagatorConfig ¶
type ClientPropagatorConfig struct {
// MetadataPredicate determines which payload metadata keys are propagated.
// If not provided, metadata payload fields matching server-supported
// extensions will be propagated.
// If a Client was created from an AgentInterface, the logic will assume
// that the server supports all extensions.
MetadataPredicate func(ctx context.Context, card *a2a.AgentCard, key string) bool
// HeaderPredicate determines which request headers will be propagated.
// If not provided, A2A-Extensions header values matching server-supported
// extensions will be propagated.
// If a Client was created from an AgentInterface, the logic will assume
// that the server supports all extensions.
HeaderPredicate func(ctx context.Context, card *a2a.AgentCard, key string, val string) bool
}
ClientPropagatorConfig configures the behavior of the client metadata propagator.
type ServerPropagatorConfig ¶
type ServerPropagatorConfig struct {
// MetadataPredicate determines which payload metadata keys are propagated.
// If not provided, metadata payload fields matching client-requested extensions
// will be propagated.
MetadataPredicate func(ctx context.Context, key string) bool
// HeaderPredicate determines which request headers will be propagated.
// If not provided, A2A-Extensions header value will be propagated.
HeaderPredicate func(ctx context.Context, key string) bool
}
ServerPropagatorConfig configures the behavior of the metadata propagator.