https://github.com/a2aproject/a2a-go
Golang SDK for A2A Protocol
https://github.com/a2aproject/a2a-go
a2a a2a-client a2a-protocol a2a-server agent-server agent-to-agent agents ai go multiagent-systems protocol sdk
Last synced: 3 months ago
JSON representation
Golang SDK for A2A Protocol
- Host: GitHub
- URL: https://github.com/a2aproject/a2a-go
- Owner: a2aproject
- License: apache-2.0
- Created: 2025-05-30T19:42:21.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2026-03-16T16:28:10.000Z (3 months ago)
- Last Synced: 2026-03-16T22:03:10.269Z (3 months ago)
- Topics: a2a, a2a-client, a2a-protocol, a2a-server, agent-server, agent-to-agent, agents, ai, go, multiagent-systems, protocol, sdk
- Language: Go
- Homepage: https://a2a-protocol.org/
- Size: 1.36 MB
- Stars: 292
- Watchers: 11
- Forks: 63
- Open Issues: 20
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Agents: AGENTS.md
Awesome Lists containing this project
- awesome-a2a-libraries - A2A Go SDK
- awesome-agentic-commerce - Go SDK
- awesome-a2a - A2A Go - 2.0` - Official Go SDK for the A2A Protocol. High-level server (`a2asrv`) and client (`a2aclient`) APIs, multi-transport (gRPC, REST, JSON-RPC), and a CLI for agent discovery. (🛠️ Tools & Libraries / 🏛️ Official A2A SDKs)
- awesome-agentic-commerce - Go SDK - `go get github.com/a2aproject/a2a-go` (A2A - Agent2Agent Protocol / 🐍 Official SDKs)
- awesome-a2a - a2a-go - go?style=social)](https://github.com/a2aproject/a2a-go) - **Official** Go SDK for the A2A Protocol with high-level server (`a2asrv`) and client (`a2aclient`) APIs, multi-transport support (gRPC, REST, JSON-RPC), extensible architecture, and a CLI tool for agent discovery and messaging. (⚙️ Implementations & Libraries)
- awesome-agent-payments-protocol - a2aproject/a2a-go
README
# A2A Go SDK
[](LICENSE)
[](https://github.com/a2aproject/a2a-go/actions/workflows/nightly.yaml)
[](https://pkg.go.dev/github.com/a2aproject/a2a-go)
[](https://deepwiki.com/a2aproject/a2a-go)
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:
```bash
go get github.com/a2aproject/a2a-go/v2
```
Visit [**pkg.go**](https://pkg.go.dev/github.com/a2aproject/a2a-go) for a full documentation.
## 📦 Versioning
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
└───── Protocol Spec Major
```
## 💡 Examples
For a simple example refer to the [helloworld](./examples/helloworld) example.
### Server
For a full documentation visit [**pkg.go.dev/a2asrv**](https://pkg.go.dev/github.com/a2aproject/a2a-go/a2asrv).
1. Create a transport-agnostic A2A request handler:
```go
var options []a2asrv.RequestHandlerOption = newCustomOptions()
var agentExecutor a2asrv.AgentExecutor = newCustomAgentExecutor()
requestHandler := a2asrv.NewHandler(agentExecutor, options...)
```
2. Wrap the handler into a transport implementation:
```go
grpcHandler := a2agrpc.NewHandler(requestHandler)
// or
jsonrpcHandler := a2asrv.NewJSONRPCHandler(requestHandler)
// or
restHandler := a2asrv.NewRESTHandler(requestHandler)
```
3. Register handler with a server, for example:
```go
import "google.golang.org/grpc"
...
server := grpc.NewServer()
grpcHandler.RegisterWith(server)
err := server.Serve(listener)
// or
http.Handle("/", restOrJSONRPCHandler)
err := http.ListenAndServe(":8080", nil)
```
### Client
For a full documentation visit [**pkg.go.dev/a2aclient**](https://pkg.go.dev/github.com/a2aproject/a2a-go/a2aclient).
1. Resolve an `AgentCard` to get an information about how an agent is exposed.
```go
card, err := agentcard.DefaultResolver.Resolve(ctx)
```
2. Create a transport-agnostic client from the `AgentCard`:
```go
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:
```go
msg := a2a.NewMessage(a2a.MessageRoleUser, a2a.NewTextPart("..."))
resp, err := client.SendMessage(ctx, &a2a.SendMessageRequest{Message: msg})
```
---
## 🌐 More Examples
You can find a variety of more detailed examples in the [a2a-samples](https://github.com/a2aproject/a2a-samples) repository.
---
## 🤝 Contributing
Contributions are welcome! Please see the [CONTRIBUTING.md](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](LICENSE) file for more details.