Go SDK API
The Go SDK is published as the module
github.com/valon-technologies/gestalt/sdk/go.
Its canonical API reference is hosted on pkg.go.dev:
package example
import (
"context"
"net/http"
gestalt "github.com/valon-technologies/gestalt/sdk/go"
)
type EchoProvider struct{}
func (p *EchoProvider) Configure(ctx context.Context, name string, config map[string]any) error {
return nil
}
func New() *EchoProvider { return &EchoProvider{} }
var Router = gestalt.MustRouter(
gestalt.Register(
gestalt.Operation[struct{ Message string }, struct{ Echoed string }]{
ID: "echo",
Method: http.MethodPost,
},
func(_ *EchoProvider, _ context.Context, input struct{ Message string }, _ gestalt.Request) (gestalt.Response[struct{ Echoed string }], error) {
return gestalt.OK(struct{ Echoed string }{Echoed: input.Message}), nil
},
),
)pkg.go.dev renders the source comments directly, so package and symbol docs
there are the primary Go reference surface.
The same module also exposes the agent-provider runtime:
package exampleagent
import (
"context"
gestalt "github.com/valon-technologies/gestalt/sdk/go"
proto "github.com/valon-technologies/gestalt/sdk/go/gen/v1"
)
type Agent struct {
proto.UnimplementedAgentProviderServer
}
func (a *Agent) CreateSession(_ context.Context, req *proto.CreateAgentProviderSessionRequest) (*proto.AgentSession, error) {
return &proto.AgentSession{
Id: req.GetSessionId(),
ProviderName: "example",
Model: req.GetModel(),
State: proto.AgentSessionState_AGENT_SESSION_STATE_ACTIVE,
}, nil
}
func (a *Agent) CreateTurn(_ context.Context, req *proto.CreateAgentProviderTurnRequest) (*proto.AgentTurn, error) {
return &proto.AgentTurn{
Id: req.GetTurnId(),
SessionId: req.GetSessionId(),
ProviderName: "example",
Model: req.GetModel(),
Status: proto.AgentExecutionStatus_AGENT_EXECUTION_STATUS_RUNNING,
Messages: req.GetMessages(),
ExecutionRef: req.GetExecutionRef(),
}, nil
}
func (a *Agent) GetCapabilities(context.Context, *proto.GetAgentProviderCapabilitiesRequest) (*proto.AgentProviderCapabilities, error) {
return &proto.AgentProviderCapabilities{
StreamingText: true,
ToolCalls: true,
Interactions: true,
ResumableTurns: true,
}, nil
}
func main() {
_ = gestalt.ServeAgentProvider(context.Background(), &Agent{})
}