IF Commons GitHub

agentVersion

concept

A version of an agent: which model, which prompt and which tools, pinned, so that a bad one can be pulled from every run

Model identityAgent. Written in commons/data/models/identity-agent/mod.ts:59. Identified by agentVersionId.

Governance: attributes

agentVersionIdidentifierrequired

What identifies the version, made by the application

Becomes the column agent_version_id of agent_version.

Written at commons/data/models/identity-agent/mod.ts:62

approvedAtinstantoptional

When it was approved

Becomes the column approved_at of agent_version.

Written at commons/data/models/identity-agent/mod.ts:71

codeReftextoptional

The commit of its code

Becomes the column code_ref of agent_version.

Written at commons/data/models/identity-agent/mod.ts:69

createdAtinstantrequired

When it was made

Becomes the column created_at of agent_version.

Written at commons/data/models/identity-agent/mod.ts:72

modelNametextrequired

The model

Becomes the column model_name of agent_version.

Written at commons/data/models/identity-agent/mod.ts:65

modelProvidertextrequired

Who makes the model

Becomes the column model_provider of agent_version.

Written at commons/data/models/identity-agent/mod.ts:64

modelVersiontextrequired

The pinned snapshot of the model, never an alias that moves

Becomes the column model_version of agent_version.

Written at commons/data/models/identity-agent/mod.ts:66

promptHashtextrequired

A hash of the system prompt; the prompt is not kept here

Becomes the column prompt_hash of agent_version.

Written at commons/data/models/identity-agent/mod.ts:67

statuscode of versionStatusrequired

Where the version is

Becomes the column status of agent_version.

Annotations: quality.transitions={"allowed":{"candidate":["approved","revoked"],"approved":["active","retired","revoked"],"active":["retired","revoked"],"retired":["revoked"],"revoked":[]}}

Written at commons/data/models/identity-agent/mod.ts:70

toolManifestHashtextrequired

A hash of the tools it is given

Becomes the column tool_manifest_hash of agent_version.

Written at commons/data/models/identity-agent/mod.ts:68

versionKeytextrequired

A hash of the agent and the label, unique

Becomes the column version_key of agent_version.

Written at commons/data/models/identity-agent/mod.ts:73

versionLabeltextrequired

What the version is called, unique for its agent

Becomes the column version_label of agent_version.

Written at commons/data/models/identity-agent/mod.ts:63

Governance: relationships

agentone

The agent To agent. Written at commons/data/models/identity-agent/mod.ts:127

approvedByoptional

Who approved it To principal. Written at commons/data/models/identity-agent/mod.ts:59

Logical: the table

Projects to the table agent_version with the primary key agent_version_id.

ColumnTypeNullRoleFrom
agent_principal_idtextfalsereferenceagentVersion.agent
agent_version_idtextfalseattributeagentVersion.agentVersionId
approved_attimestamptrueattributeagentVersion.approvedAt
approved_by_principal_idtexttruereferenceagentVersion.approvedBy
code_reftexttrueattributeagentVersion.codeRef
created_attimestampfalseattributeagentVersion.createdAt
model_nametextfalseattributeagentVersion.modelName
model_providertextfalseattributeagentVersion.modelProvider
model_versiontextfalseattributeagentVersion.modelVersion
prompt_hashtextfalseattributeagentVersion.promptHash
statustextfalseattributeagentVersion.status
tool_manifest_hashtextfalseattributeagentVersion.toolManifestHash
version_keytextfalseattributeagentVersion.versionKey
version_labeltextfalseattributeagentVersion.versionLabel

Physical: SQL

CREATE TABLE IF NOT EXISTS "agent_version" (
    "agent_version_id" VARCHAR NOT NULL PRIMARY KEY,
    "version_label" VARCHAR NOT NULL,
    "model_provider" VARCHAR NOT NULL,
    "model_name" VARCHAR NOT NULL,
    "model_version" VARCHAR NOT NULL,
    "prompt_hash" VARCHAR NOT NULL,
    "tool_manifest_hash" VARCHAR NOT NULL,
    "code_ref" VARCHAR,
    "status" VARCHAR NOT NULL,
    "approved_at" TIMESTAMPTZ,
    "created_at" TIMESTAMPTZ NOT NULL,
    "version_key" VARCHAR NOT NULL,
    "agent_principal_id" VARCHAR NOT NULL,
    "approved_by_principal_id" VARCHAR,
    CONSTRAINT "agent_version_agent_principal_id_fk" FOREIGN KEY ("agent_principal_id") REFERENCES "agent" ("principal_id"),
    CONSTRAINT "agent_version_approved_by_principal_id_fk" FOREIGN KEY ("approved_by_principal_id") REFERENCES "principal" ("principal_id"),
    CONSTRAINT "agent_version_version_key_uq" UNIQUE ("version_key"),
    CONSTRAINT "agent_version_status_ck" CHECK ("status" IN ('candidate', 'approved', 'active', 'retired', 'revoked'))
);

Physical: the typed table

Read and written from TypeScript with the types the model gives: import { agentVersion } from "@intellectual-frontiers/data/sql/typed/models". Generated in commons/data/sql/typed/models/identity-agent.auto.ts: do not edit.

import { from } from "@intellectual-frontiers/data/sql/typed";
import { agentVersion } from "@intellectual-frontiers/data/sql/typed/models";

const rows = await from(agentVersion).select((s) => ({ agentVersionId: s.agentVersion.agentVersionId, versionLabel: s.agentVersion.versionLabel })).run(runner);

Titles, headings, exports, tables, columns and requirements. Esc closes.