Documentation
¶
Overview ¶
Package a2a implements a minimal, interoperable subset of the Agent-to-Agent (A2A) protocol so AgentCTL agents can expose themselves as network services and call one another. It is transport-agnostic at the core: the server is given an Executor and never imports the engine, which keeps it testable.
The wire format follows the A2A Agent Card + JSON-RPC `message/send` conventions closely enough to interoperate with other A2A tooling, while staying intentionally small (synchronous, text parts, no push notifications) for the first version.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgentCard ¶
type AgentCard struct {
Name string `json:"name"`
Description string `json:"description"`
URL string `json:"url"`
Version string `json:"version"`
Capabilities Capabilities `json:"capabilities"`
DefaultInputModes []string `json:"defaultInputModes"`
DefaultOutputModes []string `json:"defaultOutputModes"`
Skills []Skill `json:"skills"`
}
AgentCard is the public description an A2A agent serves at /.well-known/agent.json. Field names match the A2A spec.
func CardFromAgent ¶
CardFromAgent builds an AgentCard from a parsed agent spec. baseURL is the externally reachable root (e.g. "http://localhost:8080"); version is the build version string. Both may be empty and are filled with sane defaults.
type Capabilities ¶
type Capabilities struct {
Streaming bool `json:"streaming"`
PushNotifications bool `json:"pushNotifications"`
}
Capabilities advertises optional protocol features. This implementation is synchronous request/response, so streaming and push are false.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client talks to a remote A2A agent.
func NewClient ¶
NewClient builds a client for the agent rooted at baseURL (e.g. "http://localhost:8080"). Trailing slashes are trimmed.
type Executor ¶
Executor runs a task (the incoming user text) and returns the agent's reply. The server is decoupled from the engine through this func, so it can be tested with a stub and reused by any caller that can run a task.
type Message ¶
type Message struct {
Role string `json:"role"` // "user" or "agent"
Parts []Part `json:"parts"`
MessageID string `json:"messageId,omitempty"`
Kind string `json:"kind"` // always "message"
}
Message is an A2A message (a turn from user or agent).
func TextMessage ¶
TextMessage builds a single-text-part message.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server serves a single agent's A2A card and message endpoint.
type Skill ¶
type Skill struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Tags []string `json:"tags,omitempty"`
Examples []string `json:"examples,omitempty"`
}
Skill is a capability the agent advertises. We map one agent to one primary skill derived from its description.