MCPcopy Index your code
hub / github.com/a2aproject/a2a-go

github.com/a2aproject/a2a-go @v2.3.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v2.3.1 ↗ · + Follow
2,862 symbols 10,738 edges 219 files 1,043 documented · 36% 9 cross-repo links updated 1d agonightly-metrics · 2026-05-13★ 4187 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
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 Compliance: Build agentic applications that adhere to the Agent2Agent (A2A) v1.0 Protocol Specification.
  • Client & Server SDKs: High-level APIs for both serving agentic functionality (a2asrv) and consuming it (a2aclient).
  • Multi-Transport Support: Protocol bindings for gRPC, REST, and JSON-RPC.
  • Extensible & Pluggable: Extension points for bringing your own transport implementations, authentication middlewares, messaging and database backends.

Note: The SDK version is distinct from the A2A specification version. The supported protocol version is exported in the codebase as a2a.Version


🚀 Getting Started

Requires Go 1.24.4 or newer:

go get github.com/a2aproject/a2a-go/v2

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:

    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.

  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})


🔧 CLI

The SDK ships with a command-line tool for working with A2A agents - send messages, inspect tasks, resolve agent cards, or setup simple a2a servers.

# Install
go install github.com/a2aproject/a2a-go/v2/cmd/a2a@latest

# Discover an agent
a2a discover https://agent.example.com

# Send a message
a2a send https://agent.example.com "Hello, what can you do?"

# Expose a local script as an A2A agent
a2a serve --exec "./my-script.sh" --port 8080

See cmd/README.md or run a2a help for the full command reference.


🌐 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.

Extension points exported contracts — how you extend this code

AgentExecutor (Interface)
AgentExecutor implementations translate agent outputs to A2A events. The provided [ExecutorContext] should be used as a [20 …
a2asrv/agentexec.go
CallInterceptor (Interface)
CallInterceptor can be attached to an [RequestHandler]. If multiple interceptors are added: - Before will be executed in [13 …
a2asrv/middleware.go
RequestHandler (Interface)
RequestHandler defines a transport-agnostic interface for handling incoming A2A requests. [14 implementers]
a2asrv/handler.go
ReadWriter (Interface)
ReadWriter is the necessary pull-queue dependency. Write is used by executor frontend to submit work when a message is r [8 …
a2asrv/workqueue/pullqueue.go
Executor (Interface)
Executor implementation starts an agent execution. [22 implementers]
internal/taskexec/api.go
TaskInfoProvider (Interface)
TaskInfoProvider provides information about the Task. [6 implementers]
a2a/core.go
Transport (Interface)
Transport defines a transport-agnostic interface for making A2A requests. Implementations are a translation layer betwee [10 …
a2aclient/transport.go
CallInterceptor (Interface)
CallInterceptor can be attached to a [Client]. If multiple interceptors are added: - Before will be executed in the orde [13 …
a2aclient/middleware.go

Core symbols most depended-on inside this repo

NewTextPart
called by 181
a2a/core.go
NewMessage
called by 136
a2a/core.go
NewTaskID
called by 118
a2a/core.go
Close
called by 114
a2asrv/eventqueue/queue.go
String
called by 90
a2a/core.go
Set
called by 78
a2aclient/auth.go
Error
called by 74
log/logger.go
NewHandler
called by 73
a2asrv/handler.go

Shape

Method 1,270
Function 1,121
Struct 371
Interface 52
TypeAlias 29
FuncType 19

Languages

Go100%
Python1%

Modules by API surface

a2apb/v1/a2av1.pb.go513 symbols
a2a/core.go106 symbols
a2apb/v1/a2av1_grpc.pb.go66 symbols
a2asrv/handler_test.go59 symbols
a2acompat/a2av0/conversions.go49 symbols
internal/taskexec/manager_test.go47 symbols
a2aclient/client_test.go46 symbols
a2apb/v1/pbconv/to_proto.go44 symbols
a2apb/v0/pbconv/to_proto.go44 symbols
a2aclient/transport.go44 symbols
a2a/auth.go42 symbols
a2asrv/handler.go39 symbols

Datastores touched

(mysql)Database · 1 repos

For agents

$ claude mcp add a2a-go \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact