Official Go SDK for PromptRails — the AI agent orchestration platform.
The SDK has two independent parts:
- API client (
github.com/promptrails/go-sdk) — manage agents, prompts, executions, and more. - Tracing (
github.com/promptrails/go-sdk/tracing) — send spans to PromptRails from any code, without managing your prompts/agents on the platform. Standard library only.
go get github.com/promptrails/go-sdkpackage main
import (
"context"
"fmt"
"log"
promptrails "github.com/promptrails/go-sdk"
)
func main() {
client := promptrails.NewClient("pr_key_...")
result, err := client.Agents.Execute(context.Background(), "agent-id", &promptrails.ExecuteAgentParams{
Input: map[string]any{"query": "Summarise this week's sales"},
})
if err != nil {
log.Fatal(err)
}
fmt.Println(result.Output)
}See the API client guide for resources, error handling, media studio, and configuration.
import "github.com/promptrails/go-sdk/tracing"
tracer := tracing.NewTracer("pr_...")
defer tracer.Shutdown()
_ = tracer.Span(ctx, "agent-run", tracing.KindAgent, func(ctx context.Context, root *tracing.Span) error {
root.SetInput(map[string]any{"q": "weather?"})
return tracer.Span(ctx, "llm-call", tracing.KindLLM, func(ctx context.Context, llm *tracing.Span) error {
llm.SetModel("gpt-4o").SetUsage(120, 30, -1)
return nil
})
})See the tracing guide for manual spans, span kinds, configuration, and the OpenTelemetry bridge.
- API client — resources, error handling, media studio, configuration
- Tracing — spans, batching, configuration, OpenTelemetry
go test ./... -v -race
go vet ./...
gofmt -w .MIT