Documentation
¶
Overview ¶
Package a2a implements a minimal A2A (Agent2Agent) surface for seamlessd: the agent card at /.well-known/agent-card.json and a JSON-RPC endpoint at /api/a2a whose one skill is recall -- another agent on this machine sends a text message and gets the owner's fused memory search results back. Synchronous only: message/send replies with a completed Message, never a Task, so the task lifecycle, streaming, and push notifications are all deliberately absent and the card says so.
Index ¶
Constants ¶
const AgentName = "Seamless"
AgentName is the display name the card leads with. It matches the MCP initialize handshake's mcp.ServerName -- one install, one agent identity -- pinned by a docsgen test rather than an import, because internal/a2a and internal/mcp are sibling API surfaces that do not import each other.
const ProtocolVersion = "0.3.0"
ProtocolVersion is the A2A generation the endpoint speaks: the v0.3 JSON-RPC binding, whose card names the endpoint in url/preferredTransport. The card additionally carries the newer draft's supportedInterfaces shape (the one the agent-readiness scanners key on), the same both-generations-in-one-document approach as the MCP server card.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AgentCapabilities ¶
type AgentCapabilities struct {
Streaming bool `json:"streaming"`
PushNotifications bool `json:"pushNotifications"`
StateTransitionHistory bool `json:"stateTransitionHistory"`
}
AgentCapabilities are all explicit booleans for the same reason as SupportsAuthenticatedExtendedCard: absent-vs-false ambiguity costs a client a probe request.
type AgentCard ¶
type AgentCard struct {
ProtocolVersion string `json:"protocolVersion"`
Name string `json:"name"`
Description string `json:"description"`
URL string `json:"url"`
PreferredTransport string `json:"preferredTransport"`
Provider *AgentProvider `json:"provider,omitempty"`
Version string `json:"version"`
DocumentationURL string `json:"documentationUrl,omitempty"`
Capabilities AgentCapabilities `json:"capabilities"`
SecuritySchemes map[string]SecurityScheme `json:"securitySchemes,omitempty"`
Security []map[string][]string `json:"security,omitempty"`
DefaultInputModes []string `json:"defaultInputModes"`
DefaultOutputModes []string `json:"defaultOutputModes"`
Skills []AgentSkill `json:"skills"`
// SupportsAuthenticatedExtendedCard is explicit (not omitempty) so a
// client never has to guess whether false means "no" or "not stated".
SupportsAuthenticatedExtendedCard bool `json:"supportsAuthenticatedExtendedCard"`
// SupportedInterfaces is the newer draft's interface declaration. Each
// entry carries both that draft's protocolBinding and v0.3's transport
// vocabulary, so either generation of client finds the field it expects.
SupportedInterfaces []AgentInterface `json:"supportedInterfaces"`
}
AgentCard is the A2A agent card (v0.3 field set, plus the newer draft's supportedInterfaces). Exported so docsgen can render the site twin from the same struct the daemon serves -- one shape, no drift.
type AgentInterface ¶
type AgentProvider ¶
type AgentSkill ¶
type Config ¶
type Config struct {
Retrieve Recaller
Events *events.Recorder // may be nil (recall demand is then not recorded)
APIKey string
Version string // build version served in the card; defaults to 0.0.0-dev
Endpoint string // absolute URL the card advertises, e.g. http://127.0.0.1:8081/api/a2a
Logger *slog.Logger
}
Config wires the A2A server's dependencies.
type Message ¶
type Message struct {
Kind string `json:"kind"` // always "message"
MessageID string `json:"messageId"`
ContextID string `json:"contextId,omitempty"`
Role string `json:"role"` // "agent" in replies
Parts []Part `json:"parts"`
Metadata map[string]any `json:"metadata,omitempty"`
}
Message is an A2A message. Only the fields this server reads or writes are declared; unknown incoming fields are ignored by encoding/json as usual.
type Part ¶
type Part struct {
Kind string `json:"kind"`
Text string `json:"text,omitempty"`
Data map[string]any `json:"data,omitempty"`
}
Part is a message part; kind "text" carries Text, kind "data" carries Data.
type Recaller ¶
type Recaller interface {
Recall(ctx context.Context, in retrieve.RecallInput) ([]retrieve.Hit, error)
}
Recaller is the one retrieval capability this surface needs; *retrieve.Service satisfies it.
type SecurityScheme ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server hosts the A2A JSON-RPC endpoint and its agent card.
func (*Server) CardHandler ¶
CardHandler serves the agent card. Public by design (RFC 8615 discovery, no auth): the card carries no secrets -- only the endpoint URL and the name of the auth scheme the endpoint itself will demand.