---
title: Go Packages
description: Quick reference for all Sentinel Go packages and their public APIs.
---

All Sentinel packages are importable from `github.com/xraph/sentinel`.

## Core packages

### `github.com/xraph/sentinel`

Root package. Exports context helpers, error constants, and shared types.

| Export | Description |
|--------|-------------|
| `WithTenant(ctx, id)` | Inject tenant ID into context |
| `WithApp(ctx, id)` | Inject app ID into context |
| `TenantFromContext(ctx)` | Read tenant ID from context |
| `AppFromContext(ctx)` | Read app ID from context |
| `Config` | Engine configuration struct |
| `DefaultConfig()` | Returns default Config values |
| `Entity` | Base type with timestamps |
| `NewEntity()` | Returns Entity with current timestamps |
| `ErrNoStore`, `ErrStoreClosed`, `ErrMigrationFailed` | Store errors |
| `ErrSuiteNotFound`, `ErrCaseNotFound`, `ErrRunNotFound` | Not-found errors |
| `ErrBaselineNotFound`, `ErrPromptVersionNotFound` | Not-found errors |
| `ErrSuiteAlreadyExists` | Conflict error |
| `ErrInvalidState`, `ErrEmptyInput` | State errors |
| `ErrNoTarget`, `ErrNoScorers` | Evaluation errors |

### `github.com/xraph/sentinel/engine`

The central Engine and all CRUD operations.

| Export | Description |
|--------|-------------|
| `New(...Option) (*Engine, error)` | Create an engine |
| `Engine.Start(ctx)` | Initialize the engine |
| `Engine.Stop(ctx)` | Graceful shutdown |
| `Engine.CreateSuite` | Create a suite |
| `Engine.GetSuite` | Get suite by ID |
| `Engine.GetSuiteByName` | Get suite by name |
| `Engine.ListSuites` | List suites |
| `Engine.UpdateSuite` | Update a suite |
| `Engine.DeleteSuite` | Delete a suite |
| `Engine.CreateCase` | Create a case |
| `Engine.CreateCaseBatch` | Create multiple cases |
| `Engine.GetCase` | Get case by ID |
| `Engine.UpdateCase` | Update a case |
| `Engine.DeleteCase` | Delete a case |
| `Engine.ListCases` | List cases for a suite |
| `Engine.CountCases` | Count cases for a suite |
| `Engine.ImportCases` | Import cases from file |
| `Engine.GetRun` | Get run by ID |
| `Engine.ListRuns` | List runs with filter |
| `Engine.ListRunsBySuite` | List runs for a suite |
| `Engine.ListResults` | List results for a run |
| `Engine.GetResultStats` | Get aggregate run stats |
| `Engine.SaveBaseline` | Save a baseline |
| `Engine.GetBaseline` | Get baseline by ID |
| `Engine.GetLatestBaseline` | Get latest baseline for suite |
| `Engine.ListBaselines` | List baselines for suite |
| `Engine.DeleteBaseline` | Delete a baseline |
| `Engine.CreatePromptVersion` | Create a prompt version |
| `Engine.GetPromptVersion` | Get prompt version by ID |
| `Engine.ListPromptVersions` | List prompt versions |
| `Engine.GetCurrentPromptVersion` | Get current prompt version |
| `Engine.SetCurrentPromptVersion` | Set current prompt version |
| `WithStore`, `WithConfig`, `WithExtension`, `WithLogger` | Engine options |

## Entity packages

### `github.com/xraph/sentinel/suite`

Suite entity and store interface. See [Entities](/docs/sentinel/concepts/entities).

### `github.com/xraph/sentinel/testcase`

Case entity, `ScenarioType` constants, `ScorerConfig`. See [Entities](/docs/sentinel/concepts/entities).

### `github.com/xraph/sentinel/evalrun`

Run, Result, RunTrace, ScorerResult, ResultStats. See [Runs](/docs/sentinel/execution/runs).

### `github.com/xraph/sentinel/baseline`

Baseline and BaselineResult. See [Baselines](/docs/sentinel/execution/checkpoints).

### `github.com/xraph/sentinel/promptversion`

PromptVersion entity and store interface.

## Evaluation packages

### `github.com/xraph/sentinel/scorer`

Scorer interface, registry, and 22 built-in scorers.

**Traditional scorers:** `exact`, `contains`, `not_contains`, `regex`, `json_valid`, `json_schema`, `length`, `latency`, `cost`, `llm_judge`, `semantic`, `hallucination`, `factual`, `custom`

**Persona-aware scorers:** `skill_usage`, `trait_consistency`, `behavior_trigger`, `cognitive_phase`, `communication_style`, `perception_focus`, `persona_coherence`

### `github.com/xraph/sentinel/target`

Target adapters for evaluation:

| Type | Description |
|------|-------------|
| `LLMTarget` | Direct LLM API calls |
| `AgentTarget` | Agent invocation with trace capture |
| `FuncTarget` | Wrap a plain function |

### `github.com/xraph/sentinel/scenario`

6 scenario generators: `skill_challenge`, `trait_probe`, `behavior_trigger`, `cognitive_stress`, `comms_adaptation`, `perception_test`

### `github.com/xraph/sentinel/redteam`

5 adversarial attack generators: injection, jailbreak, leakage, hallucination, off-topic

### `github.com/xraph/sentinel/comparison`

Multi-model comparison and baseline diff/regression detection.

### `github.com/xraph/sentinel/dataset`

Data loaders (JSON, CSV, JSONL) and LLM-generated test case creation.

### `github.com/xraph/sentinel/report`

Report generators: terminal, JSON, HTML, CI-friendly output.

## Store packages

### `github.com/xraph/sentinel/store`

Composite store interface embedding all subsystem stores.

### `github.com/xraph/sentinel/store/postgres`

PostgreSQL backend via bun ORM with embedded migrations.

### `github.com/xraph/sentinel/store/sqlite`

SQLite backend via bun ORM.

### `github.com/xraph/sentinel/store/memory`

In-memory backend for testing.

## Infrastructure packages

### `github.com/xraph/sentinel/plugin`

Extension interfaces (16 hooks) and type-cached Registry.

### `github.com/xraph/sentinel/observability`

```go
func NewMetricsExtension() *MetricsExtension
func NewMetricsExtensionWithFactory(factory gu.MetricFactory) *MetricsExtension
```

### `github.com/xraph/sentinel/audit_hook`

Audit trail extension with `Recorder` interface and `RecorderFunc` adapter.

### `github.com/xraph/sentinel/api`

Forge-native HTTP handlers. `New(eng, router)` creates the API, `RegisterRoutes(router)` mounts all endpoints.

### `github.com/xraph/sentinel/extension`

Forge framework extension adapter. `New(...Option)` creates the Forge extension.

## ID package

### `github.com/xraph/sentinel/id`

```go
func NewSuiteID() SuiteID
func NewCaseID() CaseID
func NewEvalRunID() EvalRunID
func NewEvalResultID() EvalResultID
func NewBaselineID() BaselineID
func NewRedTeamID() RedTeamID
func NewPromptVersionID() PromptVersionID

func ParseSuiteID(s string) (SuiteID, error)
func ParseCaseID(s string) (CaseID, error)
func ParseEvalRunID(s string) (EvalRunID, error)
func ParseEvalResultID(s string) (EvalResultID, error)
func ParseBaselineID(s string) (BaselineID, error)
func ParseRedTeamID(s string) (RedTeamID, error)
func ParsePromptVersionID(s string) (PromptVersionID, error)
```

All IDs implement `String() string` and are based on TypeID (UUIDv7, K-sortable).
