Documentation
¶
Overview ¶
Package aire is govega's adapter for the AIRE peer-to-peer agent protocol.
AIRE (https://github.com/aire-protocol/aire-spec) is a QUIC-native agent-to-agent protocol with per-stream identity, multiplexed Operations without head-of-line blocking, semantic cancellation, and budget-aware backpressure. This package mirrors the shape of mcp/ — a Client that opens outbound connections to remote AIRE-speaking peers — and adds Vega ergonomics: a connection pool keyed by resolved endpoint and pluggable reference resolution (handles, DIDs).
Per the AIRE governance contract, the upstream library (github.com/aire-protocol/aire-go) MUST NOT depend on Vega. The dependency always points one way: Vega imports AIRE, never the reverse.
Index ¶
- type Client
- type Reply
- type Request
- type ResolveFunc
- type Server
- func (s *Server) Addr() string
- func (s *Server) Listen(addr string, tlsConf *tls.Config) error
- func (s *Server) RegisterAgent(agentID string, agent aireproto.Agent) error
- func (s *Server) RegisterLLMAgent(agentID string, backend llm.LLM, systemPrompt string) error
- func (s *Server) RegisterLLMAgentStreaming(agentID string, backend llm.LLM, systemPrompt string) error
- func (s *Server) Stop() error
- type StreamChunk
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// Signer provides the local node's cryptographic identity for the
// signed HELLO (aire-spec §5.4): its DID is the NodeID on the wire.
// If nil, aire-go generates an ephemeral did:key signer per
// connection — fine for development; long-lived deployments should
// supply a stable Signer so peers can pin the identity.
Signer aireproto.Signer
// Resolve maps a reference to a peer Address. If nil, the package-level
// aireproto.Resolve (DNS TXT + HTTPS .well-known + DID Document fetch)
// is used.
Resolve ResolveFunc
// TLSConfig is used for outbound QUIC connections. If nil, a development
// self-signed config is used (NOT FOR PRODUCTION).
TLSConfig *tls.Config
// contains filtered or unexported fields
}
Client is a Vega-side AIRE client. One Client manages a pool of outbound AIRE connections (one per resolved endpoint) and dispatches Operations to remote agents identified by handle or DID.
Client is safe for concurrent use.
func NewClient ¶
func NewClient() *Client
NewClient creates a Client. Set Signer for a stable identity; left nil, each connection handshakes with an ephemeral did:key.
func (*Client) Close ¶
Close drains all peer connections held by the Client. Subsequent Sends will redial as needed.
func (*Client) Send ¶
func (c *Client) Send(ctx context.Context, ref, agentID, opName string, args []byte) ([]byte, error)
Send invokes a remote AIRE agent and returns the first reply frame's payload.
ref identifies the peer: a handle ("agent@host", "@agent@host") or a DID ("did:web:...", "did:key:..."). agentID names the agent on that peer; if empty, the AgentID resolved from the reference is used. opName is the operation name (carried in the INVOKE payload). args is the operation's argument bytes.
Send is suitable for request/reply patterns. For streamed responses, use the lower-level aireproto.Conn.Invoke directly (this method reads exactly one reply frame).
func (*Client) SendStream ¶ added in v0.7.13
func (c *Client) SendStream(ctx context.Context, ref, agentID, opName string, args []byte) (<-chan []byte, <-chan error, error)
SendStream invokes a remote agent and returns a channel of inbound frame payloads plus an error channel. The payload channel closes when the remote operation closes (FIN); the error channel is non-empty only if the operation aborted abnormally.
Callers must drain the payload channel even on error to release the underlying QUIC stream.
type Reply ¶ added in v0.7.13
type Reply struct {
Content string `json:"content,omitempty"`
Error string `json:"error,omitempty"`
}
Reply is the JSON-encoded response payload a Server-hosted LLM agent returns to the caller.
type Request ¶ added in v0.7.13
Request is the JSON-encoded INVOKE payload format expected by a Server-hosted LLM agent.
type ResolveFunc ¶
ResolveFunc maps a reference (handle like "agent@host", or DID like "did:web:...") to a fully resolved peer Address. Callers may inject a custom ResolveFunc for testing or to plug in a non-default resolver.
type Server ¶ added in v0.7.13
type Server struct {
// contains filtered or unexported fields
}
Server hosts AIRE agents addressable over QUIC. Each registered agent is backed by an LLM: incoming INVOKE frames carry a JSON-encoded Request, the LLM generates a reply, and the Server sends a single JSON-encoded Reply back as a FrameStream.
Server is the natural counterpart to Client: a govega instance acting as an AIRE peer hosts a Server (inbound) and uses a Client (outbound).
func NewServer ¶ added in v0.7.13
NewServer creates a Server whose identity is signer's DID, carried in the signed HELLO (aire-spec §5.4). A nil signer gets an ephemeral did:key — fine for development; long-lived deployments should supply a stable Signer so peers can pin the identity.
func (*Server) Addr ¶ added in v0.7.13
Addr returns the bound listener address. Only valid after Listen.
func (*Server) Listen ¶ added in v0.7.13
Listen starts accepting QUIC connections on addr. If tlsConf is nil, a dev self-signed config is used (NOT FOR PRODUCTION).
func (*Server) RegisterAgent ¶ added in v0.7.13
RegisterAgent registers an arbitrary aireproto.Agent under the given ID. Use this when the standard request/reply or streaming LLM handlers don't fit and the caller wants full control over frame handling.
func (*Server) RegisterLLMAgent ¶ added in v0.7.13
RegisterLLMAgent registers an agent that runs backend on each inbound INVOKE. If systemPrompt is non-empty, it is prepended as a system message before the request's messages.
func (*Server) RegisterLLMAgentStreaming ¶ added in v0.7.13
func (s *Server) RegisterLLMAgentStreaming(agentID string, backend llm.LLM, systemPrompt string) error
RegisterLLMAgentStreaming registers an agent that streams backend's GenerateStream output as a sequence of FrameStream frames, each carrying a JSON-encoded StreamChunk. The operation closes when the LLM stream ends.
type StreamChunk ¶ added in v0.7.13
type StreamChunk struct {
Delta string `json:"delta,omitempty"`
Error string `json:"error,omitempty"`
}
StreamChunk is the JSON payload of each FrameStream frame returned by an LLM agent registered via RegisterLLMAgentStreaming. Either Delta or Error is populated per chunk. Stream end is signalled by operation close (FIN), not by a sentinel chunk.