Go SDK
158 methods for Go backends. Covers the core eval / security / gateway / trace surface; the TypeScript SDK has the broadest method coverage.
go get github.com/EvalGuardAi/evalguard-go
Security — the published module is affected (SEC-051)
Every published version up to and including v1.6.0 — what a bare go get resolves to today — follows HTTP redirects on the guardrail-verdict transport, because net/http follows whenever CheckRedirect is nil and the client never set it. A 302 anywhere on the API path (an nginx trailing-slash rule or a load balancer is enough — no attacker required) rewrites the check to a bodyless GET: the screened text is never transmitted, and the reply comes back as an authoritative allow. On 307/308 the body survives and the screened text is re-POSTed to the redirect target; a same-hostname/different-port hop also forwards your Authorization header. This is scoped to the redirect path: v1.6.0's verdict guards are correct on malformed or truncated bodies, but a redirected reply is well formed — an answer about nothing — so shape checks cannot see it. No fixed tag is on proxy.golang.org yet. Until one is, do not rely on the firewall methods to block anything: configure a base URL that is the exact path the API serves (no trailing slash, no apex-to-www hop) and terminate TLS at an origin you control. Questions: security@evalguard.ai.
Installation
go get github.com/EvalGuardAi/evalguard-goQuick Start
package main
import (
"context"
"fmt"
"log"
"github.com/EvalGuardAi/evalguard-go"
)
func main() {
client, err := evalguard.NewClient("eg_live_your_key",
evalguard.WithBaseURL("https://evalguard.ai/api/v1"),
)
if err != nil {
log.Fatal(err)
}
// Run an evaluation (async — returns a run handle)
result, err := client.RunEval(context.Background(), &evalguard.RunEvalRequest{
Name: "regression-suite",
ProjectID: "proj_abc123",
Model: "gpt-4o",
Prompt: "Answer concisely: {{input}}",
Cases: []evalguard.EvalCase{{Input: "2+2?", ExpectedOutput: "4"}},
Scorers: []string{"exact-match"},
})
if err != nil {
log.Fatal(err)
}
// RunEval is async; poll client.GetEval(ctx, result.ID) for results
fmt.Printf("Run %s started: %s\n", result.ID, result.Status)
}Configuration
// Custom timeout
client, _ := evalguard.NewClient("eg_...",
evalguard.WithTimeout(60 * time.Second),
)
// Custom HTTP client (for proxies, mTLS, etc.)
client, _ := evalguard.NewClient("eg_...",
evalguard.WithHTTPClient(&http.Client{
Transport: customTransport,
}),
)Common Methods (68 of 158)
Evaluations
- RunEval()
- GetEval()
- ListEvals()
- ListEvalRuns()
Security
- RunSecurityScan()
- GetSecurityGraders()
- GetSecurityEffectiveness()
- GetSecurityReport()
- CodeScan()
Shadow AI
- AnalyzeShadowAI()
AI-SPM
- GetAIPosture()
Smart Copilot
- AnalyzeCopilot()
Gateway
- GetGatewayHealth()
- GetGatewayStats()
Traces
- GetTraces()
- GetTrace()
- SearchTraces()
- CreateTrace()
- IngestOTLP()
Cost / FinOps
- GetCost()
- GetCostForecast()
- GetCostSavings()
- GetCostBudget()
- GetCostAnomalies()
- GetCostRecommendations()
Monitoring
- GetMonitoringAlerts()
- GetMonitoringDrift()
- GetMonitoringAnalytics()
- GetMonitoringSLA()
Compliance
- GetCompliance()
- CheckCompliance()
- GetComplianceGaps()
- GetEUAIAct()
- GetModelCards()
Prompts
- CreatePrompt()
- ListPrompts()
Datasets
- CreateDataset()
- ListDatasets()
Firewall & Guardrails
- ListFirewallRules()
- ListGuardrails()
- GenerateGuardrails()
Team & Org
- ListTeam()
- ListApiKeys()
- ListWebhooks()
- GetAuditLogs()
Other
- Ask()
- FormalVerify()
- GetLeaderboard()
- SubmitTicket()
- GetThreatIntelligence()
- GetAISBOM()
- GenerateAISBOM()
- GetSIEMConnectors()
- GetSettings()
- ListNotifications()
- ListTemplates()
- GetMarketplace()
- ListEvalSchedules()
- ListIncidents()
- GetDashboardStats()
- DetectDrift()
- SmartRoute()
- GetAutopilotConfig()
- ListPipelines()
- ListAnnotations()
- CreateAnnotation()
- Search()
- ListTickets()
Error Handling
// Typed errors for precise handling
result, err := client.RunEval(ctx, req)
if err != nil {
var authErr *evalguard.AuthError
var rlErr *evalguard.RateLimitError
switch {
case errors.As(err, &authErr):
log.Fatal("Invalid API key:", authErr.Message)
case errors.As(err, &rlErr):
log.Printf("Rate limited, retry after %v", rlErr.RetryAfter)
time.Sleep(rlErr.RetryAfter)
default:
log.Fatal("API error:", err)
}
}Shadow AI Detection
result, err := client.AnalyzeShadowAI(ctx, &evalguard.ShadowAIRequest{
Input: "My SSN is 123-45-6789 and CC 4111-1111-1111-1111",
Provider: "openai",
Model: "gpt-4o",
})
// result.PIIDetails["types"] = ["ssn", "creditCard"]
// result.Event["riskScore"] = 25AI-SPM (Security Posture)
posture, err := client.GetAIPosture(ctx, "project-id")
// posture.Posture.OverallScore = 85
// posture.Models[0]["name"] = "gpt-4o"
// posture.Models[0]["misconfigurations"] = [...]
// posture.DataFlows[0]["crossBorder"] = trueSmart Copilot
analysis, err := client.AnalyzeCopilot(ctx, &evalguard.CopilotAnalyzeRequest{
Type: "security",
Model: "gpt-4o",
PassRate: 0.6,
Findings: []map[string]any{
{"type": "prompt-injection", "severity": "critical", "title": "Injection", "description": "...", "passed": false},
},
})
// analysis.Analysis["overallRisk"] = "critical"
// analysis.Analysis["immediateActions"] = [...]
// analysis.Analysis["complianceImpact"] = [{framework: "GDPR", status: "at-risk"}]