a2a

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package a2a provides a factory for creating A2A protocol servers. This eliminates ~350 lines of boilerplate per agent.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Agent is the ADK agent to expose via A2A protocol.
	Agent agent.Agent

	// Port is the port to listen on. If empty, a random port is used.
	Port string

	// Description overrides the agent's description in the agent card.
	// If empty, uses the agent's built-in description.
	Description string

	// InvokePath is the path for the invoke endpoint. Default is "/invoke".
	InvokePath string

	// ReadHeaderTimeout is the timeout for reading request headers.
	// Default is 10 seconds.
	ReadHeaderTimeout time.Duration

	// SessionService is the session service for the executor.
	// If nil, uses in-memory session service.
	SessionService session.Service
}

Config holds the configuration for an A2A server.

type Server

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

Server wraps an A2A protocol server with convenient lifecycle methods.

func NewServer

func NewServer(cfg Config) (*Server, error)

NewServer creates a new A2A server for the given agent. This is a factory that eliminates ~70 lines of boilerplate per agent.

func (*Server) Addr

func (s *Server) Addr() net.Addr

Addr returns the address the server is listening on.

func (*Server) AgentCardURL

func (s *Server) AgentCardURL() string

AgentCardURL returns the URL of the agent card endpoint.

func (*Server) InvokeURL

func (s *Server) InvokeURL() string

InvokeURL returns the URL of the invoke endpoint.

func (*Server) Start

func (s *Server) Start(ctx context.Context) error

Start starts the A2A server. This method blocks until the server is stopped.

func (*Server) StartAsync

func (s *Server) StartAsync(ctx context.Context)

StartAsync starts the A2A server in the background. Returns immediately. Use Stop() to shut down the server.

func (*Server) Stop

func (s *Server) Stop(ctx context.Context) error

Stop gracefully shuts down the server.

func (*Server) URL

func (s *Server) URL() string

URL returns the base URL of the server.

Jump to

Keyboard shortcuts

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