Skip to Content
SDKsPythonSessions

Python Sessions

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

Python

session = client.session.start(
  agent="refund-agent",
  subject="customer:42",
  metadata={"channel": "support"},
  policy={"ref": "policy/default", "version": "2026-02-27"},
  route={"provider": "openai", "model": "gpt-4o-mini", "region": "us-east-1"},
  risk={"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