Skip to Content
SDKsGoSessions

Go Sessions

Use session start to establish identity and reusable defaults for policy, route, and risk.

Go

session, err := client.SessionStart(ctx, driftgate.SessionStartRequest{
  Agent: "refund-agent",
  Subject: "customer:42",
  Metadata: map[string]any{"channel": "support"},
  Policy: &driftgate.PolicyRef{Ref: "policy/default", Version: "2026-02-27"},
  Route: &driftgate.RouteRef{Provider: "openai", Model: "gpt-4o-mini", Region: "us-east-1"},
  Risk: &driftgate.RiskRef{Score: 22, Decision: "allow"},
})

Session Default Inheritance

  • Session-level policy and route are optional
  • If omitted in execute calls, DriftGate inherits from session
  • If omitted in both places, backend org/workspace defaults apply

Operational Guidance

  • Set subject for tenant-level attribution
  • Store session ID for deterministic replay workflows
Last updated on