a2adocsMenu
quickstart
a2a docslanguagesgo

Go

This page is generated from the A2A Pack language SDK metadata.

Scaffold

a2a init math-agent --language go

Implementation Contract

Implement the a2apack.Agent interface and call a2apack.CompileAgent / a2apack.ServeAgent.

type MathAgent struct{}

func (MathAgent) Definition() a2apack.AgentDefinition {
    return a2apack.AgentDefinition{Name: "math-agent", Description: "Math helper", Version: "0.1.0"}
}

func (MathAgent) Sum(ctx context.Context, request a2apack.SumRequest) (a2apack.SumResponse, error) {
    return a2apack.SumResponse{Value: request.Left + request.Right}, nil
}

Local Commands

go run . compile
go run . worker

SDK Package

a2acloud.io/a2a-pack-go vendored at third_party/a2a-pack-go.

The compiled .a2a/agent.dsl.json is the sidecar contract. The sidecar owns public A2A, MCP, frontend, and invoke endpoints; the language SDK owns native handler execution through the worker protocol.