A Go library for running agentic applications as A2A Servers, following the Agent2Agent (A2A) Protocol.
- A2A Protocol Compliant: Build agentic applications that adhere to the Agent2Agent (A2A) Protocol.
- Extensible: Easily add support for different communication protocols and database backends.
Requires Go 1.24.4 or newer:
go get github.com/a2aproject/a2a-go/v2Visit pkg.go for a full documentation.
The first two digits of a release version are reserved for the version of the A2A Protocol Spec which the release implements.
The third digit is SDK API Minor version which gets incremented for patches or minor API changes. Major breaking SDK API changes increment the version suffix in the module ID.
github.com/a2aproject/a2a-go/vn@x.y.z
^ ^ ^ ^
SDK API Major β | | ββ SDK API Minor
| ββββ Protocol Spec Minor Version
ββββββ Protocol Spec Major Version
For a simple example refer to the helloworld example.
For a full documentation visit pkg.go.dev/a2asrv.
-
Create a transport-agnostic A2A request handler:
var options []a2asrv.RequestHandlerOption = newCustomOptions() var agentExecutor a2asrv.AgentExecutor = newCustomAgentExecutor() requestHandler := a2asrv.NewHandler(agentExecutor, options...)
-
Wrap the handler into a transport implementation:
grpcHandler := a2agrpc.NewHandler(requestHandler) // or jsonrpcHandler := a2asrv.NewJSONRPCHandler(requestHandler) // or restHandler := a2asrv.NewRESTHandler(requestHandler)
-
Register handler with a server, for example:
import "google.golang.org/grpc" ... server := grpc.NewServer() grpcHandler.RegisterWith(server) err := server.Serve(listener) // or http.Handle("/", restOrJSONRPCHandler) err := http.ListenAndServe(":8080", nil)
For a full documentation visit pkg.go.dev/a2aclient.
-
Resolve an
AgentCardto get an information about how an agent is exposed.card, err := agentcard.DefaultResolver.Resolve(ctx)
-
Create a transport-agnostic client from the
AgentCard:var options a2aclient.FactoryOption = newCustomClientOptions() client, err := a2aclient.NewFromCard(ctx, card, options...)
-
The connection is now open and can be used to send requests to a server:
msg := a2a.NewMessage(a2a.MessageRoleUser, a2a.NewTextPart("...")) resp, err := client.SendMessage(ctx, &a2a.SendMessageRequest{Message: msg})
You can find a variety of more detailed examples in the a2a-samples repository.
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.
This project is licensed under the Apache 2.0 License. See the LICENSE file for more details.