a2aext

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package a2aext provides utilities for A2A extension implementers.

Index

Constants

View Source
const CallMetaKey = "x-a2a-extensions"

Variables

This section is empty.

Functions

func GetMetadata

func GetMetadata(ctx context.Context) map[string]any

GetMetadata returns the metadata attached as per ServerPropagatorConfig. Returns nil context was not found.

func GetRequestHeaders

func GetRequestHeaders(ctx context.Context) map[string][]string

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.

Jump to

Keyboard shortcuts

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