a2a-go

module
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2026 License: Apache-2.0

README ΒΆ

A2A Go SDK

License Nightly Check Go Doc Ask DeepWiki

A2A Logo

A Go library for running agentic applications as A2A Servers, following the Agent2Agent (A2A) Protocol.


✨ Features

  • A2A Protocol Compliant: Build agentic applications that adhere to the Agent2Agent (A2A) Protocol.
  • Extensible: Easily add support for different communication protocols and database backends.

πŸš€ Getting Started

Requires Go 1.24.4 or newer:

go get github.com/a2aproject/a2a-go

Visit pkg.go for a full documentation.

Examples

For a simple example refer to the helloworld example.

Server

For a full documentation visit pkg.go.dev/a2asrv.

  1. Create a transport-agnostic A2A request handler:

    var options []a2asrv.RequestHandlerOption = newCustomOptions()
    var agentExecutor a2asrv.AgentExecutor = newCustomAgentExecutor()
    requestHandler := a2asrv.NewHandler(agentExecutor, options...)
    
  2. Wrap the handler into a transport implementation:

    grpcHandler := a2agrpc.NewHandler(requestHandler)
    
    // or
    
    jsonrpcHandler := a2asrv.NewJSONRPCHandler(requestHandler)
    
  3. Register handler with a server, for example:

    import "google.golang.org/grpc"
    ...
    server := grpc.NewServer()
    grpcHandler.RegisterWith(server)
    err := server.Serve(listener)
    
Client

For a full documentation visit pkg.go.dev/a2aclient.

  1. Resolve an AgentCard to get an information about how an agent is exposed.

    card, err := agentcard.DefaultResolver.Resolve(ctx)
    
  2. Create a transport-agnostic client from the AgentCard:

    var options a2aclient.FactoryOption = newCustomClientOptions()
    client, err := a2aclient.NewFromCard(ctx, card, options...)
    
  3. The connection is now open and can be used to send requests to a server:

    msg := a2a.NewMessage(a2a.MessageRoleUser, a2a.TextPart{Text: "..."})
    resp, err := client.SendMessage(ctx, &a2a.MessageSendParams{Message: msg})
    

🌐 More Examples

You can find a variety of more detailed examples in the a2a-samples repository.


🀝 Contributing

Contributions are welcome! Please see the CONTRIBUTING.md file for guidelines on how to get involved.

Before starting work on a new feature or significant change, please open an issue to discuss your proposed approach with the maintainers. This helps ensure your contribution aligns with the project's goals and prevents duplicated effort or wasted work.


πŸ“„ License

This project is licensed under the Apache 2.0 License. See the LICENSE file for more details.

Directories ΒΆ

Path Synopsis
Package a2a contains core types and constants from the A2A protocol shared by client and server implementations.
Package a2a contains core types and constants from the A2A protocol shared by client and server implementations.
Package a2aclient provides a transport-agnostic A2A client implementation.
Package a2aclient provides a transport-agnostic A2A client implementation.
agentcard
Package agentcard provides utilities for fetching public a2a.AgentCard.
Package agentcard provides utilities for fetching public a2a.AgentCard.
Package a2agrpc provides an A2A gRPC service implementation which can be registered with grpc.Server.
Package a2agrpc provides an A2A gRPC service implementation which can be registered with grpc.Server.
Package a2apb contains types and interfaces generated from published official A2A .proto specification.
Package a2apb contains types and interfaces generated from published official A2A .proto specification.
pbconv
Package pbconv provides conversion functions between A2A protobufs and native Go types.
Package pbconv provides conversion functions between A2A protobufs and native Go types.
Package a2asrv provides a configurable A2A protocol server implementation.
Package a2asrv provides a configurable A2A protocol server implementation.
eventqueue
Package eventqueue provides implementation for in-memory queue management and event processing.
Package eventqueue provides implementation for in-memory queue management and event processing.
limiter
Package limiter provides configurations for controlling concurrency limit.
Package limiter provides configurations for controlling concurrency limit.
push
Package push provides a basic implementation of push notification functionality.
Package push provides a basic implementation of push notification functionality.
e2e
tck command
examples
internal
eventpipe
Package eventpipe provides a simple eventqueue.Queue implementation which is used to connect [a2asrv.AgentExecutor] with event processor.
Package eventpipe provides a simple eventqueue.Queue implementation which is used to connect [a2asrv.AgentExecutor] with event processor.
sse
taskexec
Package taskexec provides a concurrent agent invocation manager.
Package taskexec provides a concurrent agent invocation manager.
taskstore
Package taskstore provides types and utilities for storing a2a.Task snapshots.
Package taskstore provides types and utilities for storing a2a.Task snapshots.
taskupdate
Package taskupdate provides types and utilities for performing a2a.Task updates in response to a2a.Event-s.
Package taskupdate provides types and utilities for performing a2a.Task updates in response to a2a.Event-s.
testutil
Package testutil provides utilities for easier test setup
Package testutil provides utilities for easier test setup
Package log provides utilities for attaching an slog.Logger configured with request-specific attributes to context.Context.
Package log provides utilities for attaching an slog.Logger configured with request-specific attributes to context.Context.

Jump to

Keyboard shortcuts

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