Identity (TypeID)
How Sentinel uses prefix-qualified, globally unique identifiers for every entity.
Every entity in Sentinel has a TypeID. TypeIDs are globally unique, sortable, URL-safe identifiers built on UUIDv7 with a human-readable prefix that tells you what kind of entity you're looking at.
A TypeID looks like this:
suite_01h455vb4pex5vsknk084sn02qThe suite prefix identifies this as a suite. The suffix is a base32-encoded UUIDv7 that encodes creation time, so IDs sort chronologically.
The id package
The id package wraps the TypeID Go library (v2) with a single ID struct. All entity types share the same struct -- the prefix distinguishes them.
Creating IDs
import "github.com/xraph/sentinel/id"
suiteID := id.New(id.PrefixSuite) // suite_01h455vb...
caseID := id.New(id.PrefixCase) // tcase_01h455vb...
evalRunID := id.New(id.PrefixEvalRun) // erun_01h455vb...
evalResultID := id.New(id.PrefixEvalResult) // eres_01h455vb...
baselineID := id.New(id.PrefixBaseline) // base_01h455vb...
redTeamID := id.New(id.PrefixRedTeam) // rteam_01h455vb...
promptVersionID := id.New(id.PrefixPromptVersion) // pver_01h455vb...Convenience constructors: id.NewSuiteID(), id.NewCaseID(), id.NewEvalRunID(), id.NewEvalResultID(), id.NewBaselineID(), id.NewRedTeamID(), id.NewPromptVersionID().
Parsing IDs
parsed, err := id.Parse("suite_01h455vb4pex5vsknk084sn02q")
parsed, err := id.ParseWithPrefix("suite_01h455vb...", id.PrefixSuite) // validates prefix
parsed, err := id.ParseSuiteID("suite_01h455vb...") // convenienceNil ID
var empty id.ID
empty.IsNil() // true
empty.String() // ""
id.Nil.IsNil() // trueDatabase storage
id.ID implements Scanner and driver.Valuer. Stores as a string, returns NULL for nil IDs.
JSON serialization
id.ID implements TextMarshaler and TextUnmarshaler. Nil IDs serialize as empty strings.
Prefix reference
| Constant | Prefix | Entity |
|---|---|---|
id.PrefixSuite | suite | Suite |
id.PrefixCase | tcase | Test case |
id.PrefixEvalRun | erun | Eval run |
id.PrefixEvalResult | eres | Eval result |
id.PrefixBaseline | base | Baseline |
id.PrefixRedTeam | rteam | Red team |
id.PrefixPromptVersion | pver | Prompt version |