Skip to Content
SDKsC#Sessions

C# Sessions

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

C#

var session = await client.Session.StartAsync(new SessionStartRequest {
  Agent = "refund-agent",
  Subject = "customer:42",
  Metadata = new Dictionary<string, object> { ["channel"] = "support" },
  Policy = new PolicyRef { Ref = "policy/default", Version = "2026-02-27" },
  Route = new RouteRef { Provider = "openai", Model = "gpt-4o-mini", Region = "us-east-1" },
  Risk = new 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