Skip to content

Build an agent

Implement the baseline methods and stream session updates.

Start from the minimal agent example.

Implement Initialize, NewSession, Prompt, and Cancel on acp.Agent. Use typed Session updates to send output to the client.

Optional methods are separate interfaces. Advertise a capability only when its implementation is present; an omitted optional interface returns JSON-RPC method-not-found.

The lifecycle below is an excerpt; agent and ctx are supplied by your application.

connection, err := stdio.NewAgentConnection(agent, acp.ConnectionOptions{})
if err != nil {
return err
}
defer connection.Close()
return connection.Wait(ctx)

Import github.com/caelis-labs/acp-go-sdk/transport/stdio. Keep application logs on stderr; stdout carries protocol messages.

Next, connect a client and complete a real initialize → new session → prompt cycle.

Based on the public project documentationacp-go-sdk · ed838d7 ↗