agentcard

package
v0.3.9 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2026 License: Apache-2.0 Imports: 9 Imported by: 13

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

View Source
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

type ErrStatusNotOK struct {
	StatusCode int
	Status     string
}

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

func NewResolver(client *http.Client) *Resolver

NewResolver is a Resolver constructor function.

func (*Resolver) Resolve

func (r *Resolver) Resolve(ctx context.Context, baseURL string, opts ...ResolveOption) (*a2a.AgentCard, error)

Resolve fetches an a2a.AgentCard from the provided base URL. By default the request is sent for the /.well-known/agent-card.json path.

Jump to

Keyboard shortcuts

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