Experimental Go SDK for the local Codex app-server JSON-RPC protocol.
This package starts codex app-server --listen stdio://, initializes the app-server session, and exposes Go APIs for login, models, threads, turns, streaming notifications, approval handling, and retryable app-server errors.
go get github.com/ewhauser/codex-sdk-goYou also need a local codex binary available on PATH, or an explicit binary path through AppServerConfig.
package main
import (
"context"
"fmt"
"log"
codex "github.com/ewhauser/codex-sdk-go"
)
func main() {
ctx := context.Background()
client, err := codex.NewCodex(ctx)
if err != nil {
log.Fatal(err)
}
defer client.Close()
thread, err := client.ThreadStart(ctx)
if err != nil {
log.Fatal(err)
}
result, err := thread.Run(ctx, "Say hello in one sentence.")
if err != nil {
log.Fatal(err)
}
if result.FinalResponse != nil {
fmt.Println(*result.FinalResponse)
}
}The generated/ package is produced from:
codex app-server generate-json-schemaRefresh it with:
go generate ./generatedRun tests with:
go test ./...Runnable examples live in examples/:
go run ./examples/01_quickstart_constructor