Help us shape the future of Go! Take the 2026 Go Developer Survey

agentcard

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package agentcard provides a block-partitioned A2A Agent Card upstream with deterministic failure modes and a per-scope request counter.

The control plane fetches a passthrough Agent proxy's public card from its upstream and caches the result, so the property worth asserting is how many times the upstream was actually contacted. A scenario addresses the service as

http://testbench:3013/<block>/<scope>/<mode>

where <scope> is a scenario-unique name and <mode> selects the upstream's behaviour. The control plane appends the well-known card path, and every card request increments the scope's counter, which GET /<block>/test/requests?scope=<scope> reports.

Index

Constants

View Source
const (
	// ModeOK serves the scope's card.
	ModeOK = "ok"
	// ModeAlternate serves a different card for the same scope, so a changed upstream is
	// distinguishable from a cached one.
	ModeAlternate = "alternate"
	// ModeAuth serves the card only when CredentialHeader carries Credential(scope), and answers
	// 401 otherwise.
	ModeAuth = "auth"
	// ModeMalformed answers 200 with a body that is not a JSON document.
	ModeMalformed = "malformed"
	// ModeSlow answers only after the control plane's fetch budget has elapsed.
	ModeSlow = "slow"
	// ModeServerError answers 500.
	ModeServerError = "status500"
)

Card modes, the second path segment.

View Source
const CredentialHeader = "X-Card-Key"

CredentialHeader is the header the auth mode requires.

View Source
const Port = 3013

Port is the container port used by the testbench.

Variables

This section is empty.

Functions

func Card

func Card(scope, name string) map[string]any

Card returns the deterministic Agent Card served for a scope under the given name. It carries every key a managed card requires, so the same document can also be saved as managed content.

func Credential

func Credential(scope string) string

Credential returns the credential ModeAuth expects for a scope.

Types

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service implements testbench.Service and testbench.Partitioned.

func New

func New() *Service

New returns a new Agent Card service.

func (*Service) Handler

func (s *Service) Handler() http.Handler

Handler serves the partitioned routes.

func (*Service) Name

func (s *Service) Name() string

Name returns the service registration name.

func (*Service) PartitionKey

func (s *Service) PartitionKey() string

PartitionKey returns the partitioning strategy used by this stateful service.

func (*Service) Port

func (s *Service) Port() int

Port returns the service's listening port.

func (*Service) Stateful

func (s *Service) Stateful() bool

Stateful reports that the service retains request counts.

Jump to

Keyboard shortcuts

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