Documentation
¶
Overview ¶
Package agentcard provides utilities for fetching public a2a.AgentCard. A Resolver can be created with a custom http.Client or package-level DefaultResolver can be used.
card, err := agentcard.DefaultResolver.Resolve(ctx, baseURL) // or resolver := agentcard.NewResolver(customClient) card, err := resolver.Resolve(ctx, baseURL)
By default the request is sent for a well-known card location, but this can be customized by providing [ResolveOption]s.
card, err := resolver.Resolve( ctx, baseURL, a2aclient.WithPath(customPath), a2aclient.WithHeader(key, value), )
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultResolver = &Resolver{Client: defaultClient}
DefaultResolver is configured with an http.Client with a 30-second timeout.
Functions ¶
This section is empty.
Types ¶
type ErrStatusNotOK ¶
ErrStatusNotOK is an error returned by Resolver when HTTP request returned a non-OK status.
func (*ErrStatusNotOK) Error ¶
func (e *ErrStatusNotOK) Error() string
type ResolveOption ¶
type ResolveOption func(r *resolveRequest)
ResolveOption is used to customize Resolve behavior.
func WithPath ¶
func WithPath(path string) ResolveOption
WithPath makes Resolve fetch from the provided path relative to base URL.
func WithRequestHeader ¶
func WithRequestHeader(name string, val string) ResolveOption
WithRequestHeader makes Resolve perform fetch attaching the provided HTTP headers.
type Resolver ¶
type Resolver struct {
// Client can be used to configure appropriate timeout, retry policy, and connection pooling
Client *http.Client
}
Resolver is used to fetch an a2a.AgentCard.
func NewResolver ¶
NewResolver is a Resolver constructor function.