Data Model

This reference documents the core entities in 2Signal, their fields, and relationships. All entities use UUID primary keys and include createdAt / updatedAt timestamps.


Trace

A trace represents one complete execution of your agent. Traces contain spans and can have scores attached.

FieldTypeDescription
idUUIDUnique trace identifier (set by the SDK)
projectIdUUIDProject this trace belongs to
namestringName of the trace (usually the agent or function name)
startTimeISO 8601When the trace started
endTimeISO 8601 | nullWhen the trace ended (null if still running)
durationMsinteger | nullComputed duration in milliseconds
statusenumOK or ERROR
totalCostdecimalSum of all span costs in USD
totalTokensintegerSum of all span token counts
metadataJSONArbitrary metadata set at trace creation
tagsstring[]Tags for filtering and grouping

Span

A span represents a single operation within a trace: an LLM call, tool invocation, retrieval step, or custom logic. Spans can be nested via parentSpanId.

FieldTypeDescription
idUUIDUnique span identifier
traceIdUUIDParent trace
parentSpanIdUUID | nullParent span for nesting
projectIdUUIDProject this span belongs to
namestringDescriptive name for the operation
typeenumAGENT, TOOL, LLM, CHAIN, RETRIEVAL, CUSTOM, DELEGATION, VOICE, HUMAN_HANDOFF, GUARDRAIL
startTimeISO 8601When the span started
endTimeISO 8601 | nullWhen the span ended
durationMsinteger | nullComputed duration in milliseconds
inputJSONInput to the operation (e.g., messages for LLM calls)
outputJSONOutput of the operation (e.g., LLM response)
modelstring | nullModel name for LLM spans (e.g., gpt-4o)
modelParametersJSON | nullParameters like temperature, max_tokens
promptTokensinteger | nullInput token count
completionTokensinteger | nullOutput token count
totalTokensinteger | nullSum of prompt + completion tokens
costdecimal | nullCost in USD for this span
statusenumOK or ERROR
errorMessagestring | nullError details when status is ERROR
metadataJSONArbitrary metadata

Span Types

TypeWhen to UseExample
LLMAny LLM API callOpenAI chat.completions.create()
TOOLTool or function invocationCalculator, web search, code execution
RETRIEVALData retrieval from external sourceVector DB query, API call for context
CHAINMulti-step processing pipelineLangChain chain execution
AGENTAutonomous agent decision loopReAct agent, CrewAI agent
CUSTOMAnything elseCustom business logic, validation

Score

Scores are evaluator results attached to traces or individual spans.

FieldTypeDescription
idUUIDUnique score identifier
traceIdUUIDTrace being scored
spanIdUUID | nullSpecific span being scored (null for trace-level scores)
projectIdUUIDProject this score belongs to
evaluatorNamestringName of the evaluator that produced this score
valuefloatScore value between 0 and 1
labelstring | nullHuman-readable label (e.g., pass, fail)
reasoningstring | nullExplanation for the score (especially useful for LLM Judge)

Evaluator Config

Defines an evaluator that automatically runs on new traces.

FieldTypeDescription
idUUIDConfig identifier
projectIdUUIDProject this evaluator belongs to
namestringUnique name within the project
typeenumLLM_JUDGE, CONTAINS, JSON_SCHEMA, REGEX_MATCH, SIMILARITY, LATENCY, COST, CUSTOM
configJSONType-specific configuration (see Evaluators)
enabledbooleanWhether this evaluator runs on new traces

Dataset & Dataset Item

Datasets hold test cases for systematic evaluation.

FieldTypeDescription
idUUIDDataset identifier
projectIdUUIDProject this dataset belongs to
namestringUnique name within the project
descriptionstring | nullOptional description

Dataset Item:

FieldTypeDescription
idUUIDItem identifier
datasetIdUUIDParent dataset
inputJSONTest input for the agent
expectedOutputJSON | nullReference output for similarity evaluators
metadataJSON | nullAdditional context (category, difficulty, etc.)

Organization

FieldTypeDescription
idUUIDOrganization identifier
namestringOrganization display name
planenumFREE, PRO, TEAM, ENTERPRISE
stripeCustomerIdstring | nullStripe customer for billing
stripeSubscriptionIdstring | nullActive Stripe subscription

Organization Member

FieldTypeDescription
organizationIdUUIDOrganization
userIdUUIDSupabase user ID
emailstringMember email
roleenumOWNER, ADMIN, MEMBER, VIEWER

Model Routing Config

FieldTypeDescription
idUUIDConfig identifier
projectIdUUIDProject this config belongs to
namestringUnique name within the project
enabledbooleanWhether this routing config is active
defaultModelstringFallback model when no rule matches
rulesJSON[]Array of routing rules (see Model Routing Guide)

Usage Record

FieldTypeDescription
organizationIdUUIDOrganization
projectIdUUIDProject
monthstringCalendar month (YYYY-MM)
traceCountintegerTraces ingested this month
spanCountintegerSpans ingested this month
evalRunCountintegerEvaluator executions this month

Project

A project is a sub-tenant within an organization. Traces, evaluators, API keys, and all other resources are scoped to a project.

FieldTypeDescription
idUUIDProject identifier
organizationIdUUIDParent organization
namestringProject display name
descriptionstring | nullOptional description

API Key

Project-scoped credentials for SDK and API authentication. The raw key is shown once at creation; only the bcrypt hash is stored.

FieldTypeDescription
idUUIDKey identifier
projectIdUUIDProject this key belongs to
namestringDescriptive name
keyHashstringBcrypt hash of the API key
keyPrefixstringFirst characters for identification (e.g., ts_...abc)
revokedAttimestamp | nullWhen the key was revoked (null if active)
lastUsedAttimestamp | nullLast time the key was used for authentication

Trace Annotation

Human feedback attached to traces. Annotations allow team members to review and rate agent outputs.

FieldTypeDescription
idUUIDAnnotation identifier
traceIdUUIDTrace being annotated
projectIdUUIDProject
userIdUUIDSupabase user who created the annotation
userEmailstringAnnotator email
sentimentenumPOSITIVE, NEGATIVE, NEUTRAL
notestring | nullFree-text feedback
scoreOverridesJSON | nullManual score overrides for evaluators

Eval Run & Eval Run Result

Batch evaluation runs execute evaluators across dataset items for systematic testing.

FieldTypeDescription
idUUIDEval run identifier
projectIdUUIDProject
datasetIdUUIDDataset being evaluated
evaluatorConfigIdUUIDEvaluator configuration used
statusenumPENDING, RUNNING, COMPLETED, FAILED
totalItemsintegerTotal dataset items to evaluate
completedItemsintegerItems evaluated so far
failedItemsintegerItems that failed evaluation
avgScorefloat | nullAverage score across all items
passRatefloat | nullPercentage of items that passed

Eval Run Result:

FieldTypeDescription
idUUIDResult identifier
evalRunIdUUIDParent eval run
datasetItemIdUUIDDataset item evaluated
scorefloatScore value (0–1)
labelstring | nullPass/fail label
reasoningstring | nullExplanation
errorstring | nullError message if evaluation failed
durationMsinteger | nullEvaluation duration

Prompt Template & Version

Version-controlled prompt storage for managing and tracking prompt changes over time.

FieldTypeDescription
idUUIDTemplate identifier
projectIdUUIDProject
namestringUnique template name within project
descriptionstring | nullOptional description

Prompt Template Version:

FieldTypeDescription
idUUIDVersion identifier
promptTemplateIdUUIDParent template
versionintegerAuto-incrementing version number
contenttextThe prompt text
variablesstring[]Variable names extracted from the content
commitMessagestring | nullDescription of what changed in this version

Alert Rule & Alert Event

Configurable alert rules that fire when quality or performance metrics cross thresholds.

FieldTypeDescription
idUUIDRule identifier
projectIdUUIDProject
namestringRule display name
enabledbooleanWhether this rule is active
metricenumEVAL_PASS_RATE, EVAL_SCORE_AVG, ERROR_RATE, P95_LATENCY, TRACE_COST_AVG
evaluatorNamestring | nullFor eval-specific metrics
operatorstringlt or gt
thresholdfloatValue that triggers the alert
windowMinutesintegerTime window for metric aggregation
cooldownMinutesintegerMinimum time between repeated alerts
channelenumEMAIL, SLACK, WEBHOOK
destinationJSONChannel-specific delivery config (email address, webhook URL, etc.)

Alert Event:

FieldTypeDescription
idUUIDEvent identifier
alertRuleIdUUIDRule that triggered
projectIdUUIDProject
metricenumMetric that was evaluated
valuefloatActual metric value
thresholdfloatThreshold that was crossed
channelenumDelivery channel used
deliveredbooleanWhether notification was successfully delivered
errorstring | nullDelivery error if failed

Trace Replay

Re-execute traces with different models or prompt templates to compare results.

FieldTypeDescription
idUUIDReplay identifier
projectIdUUIDProject
originalTraceIdUUIDTrace being replayed
replayedTraceIdUUID | nullNew trace created by replay (null until complete)
statusenumPENDING, RUNNING, COMPLETED, FAILED
modelstring | nullModel override for replay
promptTemplateVersionIdUUID | nullPrompt template version override
modelParametersJSON | nullModel parameter overrides (temperature, etc.)
errorstring | nullError message if replay failed
triggeredByUUIDUser who triggered the replay

Entity Relationships

Organization ─┬── OrganizationMember
              ├── Project ─┬── ApiKey
              │            ├── EvaluatorConfig ── EvalRun ── EvalRunResult
              │            ├── Dataset ── DatasetItem
              │            ├── ModelRoutingConfig
              │            ├── PromptTemplate ── PromptTemplateVersion
              │            ├── AlertRule ── AlertEvent
              │            ├── TraceReplay
              │            ├── Trace ─┬── Span ── Score
              │            │          ├── Score
              │            │          └── TraceAnnotation
              │            └── UsageRecord
              └── UsageAlert

Have questions? Join our community!

Connect with other developers and the 2Signal team.

Join Discord