Any agent can be exposed as an A2A HTTP server. Call RunA2A(ctx) after NewAgent — the server blocks until the context is cancelled, then shuts down gracefully.Endpoints:
JSON-RPC v2 only — SendMessage, SendStreamingMessage, GetTask, etc.
The server accepts JSON-RPC v2 only (PascalCase methods: SendMessage, SendStreamingMessage, GetTask). Legacy slash-style method strings and HTTP REST paths are not supported.
a, err := agent.NewAgent( agent.WithName("my-agent"), agent.WithDescription("Helpful assistant exposed as an A2A server."), agent.WithLLMClient(llmClient), agent.WithStream(true), // advertises streaming capability in agent card agent.WithA2ADefaultServer(), // binds to localhost:9999, no auth)if err != nil { return err}defer a.Close()ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)defer stop()if err := a.RunA2A(ctx); err != nil { log.Fatal(err)}
Remote A2A agents connect as tool providers. The SDK resolves the agent card, discovers skills, and registers each skill as a tool (a2a_<server>_<skillId>). Failing fast if a server is unreachable at NewAgent.