discovery

package
v1.55.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultCardCacheTTL is how long a successful Agent Card stays cached.
	DefaultCardCacheTTL = 5 * time.Minute

	// DefaultCardErrorTTL is how long a failed fetch stays cached (avoids retry storms).
	DefaultCardErrorTTL = 30 * time.Second

	// DefaultCardFetchTimeout is the HTTP timeout for fetching an Agent Card.
	DefaultCardFetchTimeout = 3 * time.Second
)
View Source
const DefaultRegistryPath = "/tmp/apteva-agents"

DefaultRegistryPath is the default location for file-based agent registry

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentMetadata

type AgentMetadata struct {
	ID           string          `json:"id"`
	Name         string          `json:"name"`
	URL          string          `json:"url"`
	Capabilities []string        `json:"capabilities,omitempty"`
	Tags         []string        `json:"tags,omitempty"`
	Features     map[string]bool `json:"features,omitempty"`
}

AgentMetadata is broadcast via mDNS TXT records

type CardProber added in v1.43.1

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

CardProber fetches and caches A2A Agent Cards from discovered peers.

func NewCardProber added in v1.43.1

func NewCardProber() *CardProber

NewCardProber creates a new Agent Card prober.

func (*CardProber) CacheSize added in v1.43.1

func (p *CardProber) CacheSize() int

CacheSize returns the number of cached entries.

func (*CardProber) EnrichAgents added in v1.43.1

func (p *CardProber) EnrichAgents(agents []*config.AgentInfo)

EnrichAgents enriches agents that have features["a2a"]==true by probing their Agent Card endpoint. Non-A2A agents pass through unchanged. Probing happens concurrently. If a card fetch fails, the agent keeps its basic info.

func (*CardProber) InvalidateCache added in v1.43.1

func (p *CardProber) InvalidateCache(agentURL string)

InvalidateCache removes the cached card for a given agent URL.

type DiscoveryService

type DiscoveryService interface {
	// Start begins the discovery process
	Start() error

	// Stop stops the discovery service
	Stop() error

	// GetAgents returns currently discovered agents
	GetAgents() []config.AgentInfo

	// IsRunning returns whether discovery is active
	IsRunning() bool
}

DiscoveryService handles automatic agent discovery

func NewDiscoveryService

func NewDiscoveryService(cfg *config.AgentsConfig, agentID, agentName, agentDescription, agentURL string, features map[string]bool, mcpServers []string) (DiscoveryService, error)

NewDiscoveryService creates the appropriate discovery service based on config

type FileAgentEntry added in v1.33.62

type FileAgentEntry struct {
	ID           string          `json:"id"`
	Name         string          `json:"name"`
	Description  string          `json:"description,omitempty"`
	URL          string          `json:"url"`
	Group        string          `json:"group"`
	Features     map[string]bool `json:"features,omitempty"`
	Capabilities []string        `json:"capabilities,omitempty"`
	MCPServers   []string        `json:"mcp_servers,omitempty"`
	PID          int             `json:"pid"`
	StartedAt    time.Time       `json:"started_at"`
}

FileAgentEntry is the structure written to each agent's file

type FileDiscovery added in v1.33.62

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

FileDiscovery implements agent discovery using filesystem This is the most reliable method for localhost/same-machine scenarios

func NewFileDiscovery added in v1.33.62

func NewFileDiscovery(cfg *config.AgentsConfig, agentID, agentName, agentDescription, agentURL string, features map[string]bool, mcpServers []string) (*FileDiscovery, error)

NewFileDiscovery creates a new file-based discovery service

func (*FileDiscovery) GetAgents added in v1.33.62

func (d *FileDiscovery) GetAgents() []config.AgentInfo

GetAgents returns the list of currently discovered agents

func (*FileDiscovery) IsRunning added in v1.33.62

func (d *FileDiscovery) IsRunning() bool

IsRunning returns whether discovery is active

func (*FileDiscovery) Start added in v1.33.62

func (d *FileDiscovery) Start() error

Start begins file-based discovery

func (*FileDiscovery) Stop added in v1.33.62

func (d *FileDiscovery) Stop() error

Stop stops file-based discovery and unregisters this agent

type GossipDiscovery

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

GossipDiscovery implements agent discovery using gossip protocol (memberlist) This is a stub for future implementation

func NewGossipDiscovery

func NewGossipDiscovery(cfg *config.AgentsConfig, agentID, agentName, agentURL string) (*GossipDiscovery, error)

NewGossipDiscovery creates a new gossip-based discovery service

func (*GossipDiscovery) GetAgents

func (d *GossipDiscovery) GetAgents() []config.AgentInfo

GetAgents returns discovered agents (stub returns empty)

func (*GossipDiscovery) IsRunning

func (d *GossipDiscovery) IsRunning() bool

IsRunning returns whether discovery is active

func (*GossipDiscovery) Start

func (d *GossipDiscovery) Start() error

Start begins gossip discovery (stub)

func (*GossipDiscovery) Stop

func (d *GossipDiscovery) Stop() error

Stop stops gossip discovery

type HTTPDiscovery

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

HTTPDiscovery implements agent discovery using direct HTTP polling This works in Docker and any environment without multicast support

func NewHTTPDiscovery

func NewHTTPDiscovery(cfg *config.AgentsConfig, agentID, agentName, agentURL string) (*HTTPDiscovery, error)

NewHTTPDiscovery creates a new HTTP-based discovery service

func (*HTTPDiscovery) GetAgents

func (d *HTTPDiscovery) GetAgents() []config.AgentInfo

GetAgents returns the list of currently discovered agents

func (*HTTPDiscovery) IsRunning

func (d *HTTPDiscovery) IsRunning() bool

IsRunning returns whether discovery is active

func (*HTTPDiscovery) RegisterSelf

func (d *HTTPDiscovery) RegisterSelf(registryURL string) error

RegisterSelf announces this agent to a central registry (if configured)

func (*HTTPDiscovery) Start

func (d *HTTPDiscovery) Start() error

Start begins HTTP discovery

func (*HTTPDiscovery) Stop

func (d *HTTPDiscovery) Stop() error

Stop stops the HTTP discovery service

type MDNSDiscovery

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

MDNSDiscovery implements agent discovery using mDNS (Multicast DNS)

func NewMDNSDiscovery

func NewMDNSDiscovery(cfg *config.AgentsConfig, agentID, agentName, agentURL string, features map[string]bool) (*MDNSDiscovery, error)

NewMDNSDiscovery creates a new mDNS-based discovery service

func (*MDNSDiscovery) GetAgents

func (d *MDNSDiscovery) GetAgents() []config.AgentInfo

GetAgents returns the list of currently discovered agents

func (*MDNSDiscovery) IsRunning

func (d *MDNSDiscovery) IsRunning() bool

IsRunning returns whether discovery is active

func (*MDNSDiscovery) Start

func (d *MDNSDiscovery) Start() error

Start begins mDNS broadcasting and discovery

func (*MDNSDiscovery) Stop

func (d *MDNSDiscovery) Stop() error

Stop stops the mDNS discovery service

type ManualDiscovery

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

ManualDiscovery uses the manually configured available_agents array (legacy mode)

func NewManualDiscovery

func NewManualDiscovery(cfg *config.AgentsConfig) (*ManualDiscovery, error)

NewManualDiscovery creates a manual discovery service (uses available_agents from config)

func (*ManualDiscovery) GetAgents

func (d *ManualDiscovery) GetAgents() []config.AgentInfo

GetAgents returns the manually configured agents

func (*ManualDiscovery) IsRunning

func (d *ManualDiscovery) IsRunning() bool

IsRunning returns whether discovery is active

func (*ManualDiscovery) Start

func (d *ManualDiscovery) Start() error

Start begins manual discovery (no-op, agents are already configured)

func (*ManualDiscovery) Stop

func (d *ManualDiscovery) Stop() error

Stop stops manual discovery

type SSDPDiscovery

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

SSDPDiscovery implements agent discovery using SSDP (Simple Service Discovery Protocol)

func NewSSDPDiscovery

func NewSSDPDiscovery(cfg *config.AgentsConfig, agentID, agentName, agentURL string) (*SSDPDiscovery, error)

NewSSDPDiscovery creates a new SSDP-based discovery service

func (*SSDPDiscovery) GetAgents

func (d *SSDPDiscovery) GetAgents() []config.AgentInfo

GetAgents returns the list of currently discovered agents

func (*SSDPDiscovery) IsRunning

func (d *SSDPDiscovery) IsRunning() bool

IsRunning returns whether discovery is active

func (*SSDPDiscovery) Start

func (d *SSDPDiscovery) Start() error

Start begins SSDP advertising and discovery

func (*SSDPDiscovery) Stop

func (d *SSDPDiscovery) Stop() error

Stop stops the SSDP discovery service

Jump to

Keyboard shortcuts

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