Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PromptRails Go SDK

Go Reference License: MIT

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.

Installation

go get github.com/promptrails/go-sdk

Quick Start

API client

package 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.

Tracing

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.

Documentation

  • API client — resources, error handling, media studio, configuration
  • Tracing — spans, batching, configuration, OpenTelemetry

Contributing

go test ./... -v -race
go vet ./...
gofmt -w .

License

MIT

Releases

Packages

Contributors

Languages