endedAtinstantoptionalWhen it ended
Becomes the column ended_at of agent_run.
One task of an agent, in one version, perhaps under a delegation, perhaps started by another run
Model identityAgent. Written in commons/data/models/identity-agent/mod.ts:114. Identified by runId.
endedAtinstantoptionalWhen it ended
Becomes the column ended_at of agent_run.
inputHashtextoptionalA hash of its input
Becomes the column input_hash of agent_run.
purposetextoptionalWhat it is for
Becomes the column purpose of agent_run.
runIdidentifierrequiredWhat identifies the run, made by the application
Becomes the column run_id of agent_run.
startedAtinstantrequiredWhen it started
Becomes the column started_at of agent_run.
statuscode of runStatusrequiredWhere it is
Becomes the column status of agent_run.
Annotations: quality.transitions={"allowed":{"running":["succeeded","failed","cancelled","killed","expired"],"succeeded":[],"failed":[],"cancelled":[],"killed":[],"expired":[]}}
traceIdtextoptionalThe trace it is part of
Becomes the column trace_id of agent_run.
agentoneThe agent To agent. Written at commons/data/models/identity-agent/mod.ts:127
delegationoptionalThe delegation it acts under To delegation. Written at commons/data/models/identity-agent/mod.ts:131
initiatoroptionalWho started it To principal. Written at commons/data/models/identity-agent/mod.ts:130
parentRunoptionalThe run that started it, for a sub-agent To agentRun. Written at commons/data/models/identity-agent/mod.ts:132
tenantoneThe tenant it runs in To tenant. Written at commons/data/models/identity-agent/mod.ts:129
versiononeThe version it runs To agentVersion. Written at commons/data/models/identity-agent/mod.ts:128
Projects to the table agent_run with the primary key run_id.
| Column | Type | Null | Role | From |
|---|---|---|---|---|
agent_principal_id | text | false | reference | agentRun.agent |
delegation_id | text | true | reference | agentRun.delegation |
ended_at | timestamp | true | attribute | agentRun.endedAt |
initiator_principal_id | text | true | reference | agentRun.initiator |
input_hash | text | true | attribute | agentRun.inputHash |
parent_run_agent_run_run_id | text | true | reference | agentRun.parentRun |
purpose | text | true | attribute | agentRun.purpose |
run_id | text | false | attribute | agentRun.runId |
started_at | timestamp | false | attribute | agentRun.startedAt |
status | text | false | attribute | agentRun.status |
tenant_id | text | false | reference | agentRun.tenant |
trace_id | text | true | attribute | agentRun.traceId |
version_agent_version_id | text | false | reference | agentRun.version |
CREATE TABLE IF NOT EXISTS "agent_run" (
"run_id" VARCHAR NOT NULL PRIMARY KEY,
"started_at" TIMESTAMPTZ NOT NULL,
"ended_at" TIMESTAMPTZ,
"status" VARCHAR NOT NULL,
"trace_id" VARCHAR,
"purpose" VARCHAR,
"input_hash" VARCHAR,
"agent_principal_id" VARCHAR NOT NULL,
"version_agent_version_id" VARCHAR NOT NULL,
"tenant_id" VARCHAR NOT NULL,
"initiator_principal_id" VARCHAR,
"delegation_id" VARCHAR,
"parent_run_agent_run_run_id" VARCHAR,
CONSTRAINT "agent_run_agent_principal_id_fk" FOREIGN KEY ("agent_principal_id") REFERENCES "agent" ("principal_id"),
CONSTRAINT "agent_run_version_agent_version_id_fk" FOREIGN KEY ("version_agent_version_id") REFERENCES "agent_version" ("agent_version_id"),
CONSTRAINT "agent_run_tenant_id_fk" FOREIGN KEY ("tenant_id") REFERENCES "tenant" ("tenant_id"),
CONSTRAINT "agent_run_initiator_principal_id_fk" FOREIGN KEY ("initiator_principal_id") REFERENCES "principal" ("principal_id"),
CONSTRAINT "agent_run_delegation_id_fk" FOREIGN KEY ("delegation_id") REFERENCES "delegation" ("delegation_id"),
CONSTRAINT "agent_run_parent_run_agent_run_run_id_fk" FOREIGN KEY ("parent_run_agent_run_run_id") REFERENCES "agent_run" ("run_id"),
CONSTRAINT "agent_run_status_ck" CHECK ("status" IN ('running', 'succeeded', 'failed', 'cancelled', 'killed', 'expired'))
);CREATE TABLE IF NOT EXISTS "agent_run" (
"run_id" TEXT NOT NULL PRIMARY KEY,
"started_at" TIMESTAMPTZ NOT NULL,
"ended_at" TIMESTAMPTZ,
"status" TEXT NOT NULL,
"trace_id" TEXT,
"purpose" TEXT,
"input_hash" TEXT,
"agent_principal_id" TEXT NOT NULL,
"version_agent_version_id" TEXT NOT NULL,
"tenant_id" TEXT NOT NULL,
"initiator_principal_id" TEXT,
"delegation_id" TEXT,
"parent_run_agent_run_run_id" TEXT,
CONSTRAINT "agent_run_agent_principal_id_fk" FOREIGN KEY ("agent_principal_id") REFERENCES "agent" ("principal_id"),
CONSTRAINT "agent_run_version_agent_version_id_fk" FOREIGN KEY ("version_agent_version_id") REFERENCES "agent_version" ("agent_version_id"),
CONSTRAINT "agent_run_tenant_id_fk" FOREIGN KEY ("tenant_id") REFERENCES "tenant" ("tenant_id"),
CONSTRAINT "agent_run_initiator_principal_id_fk" FOREIGN KEY ("initiator_principal_id") REFERENCES "principal" ("principal_id"),
CONSTRAINT "agent_run_delegation_id_fk" FOREIGN KEY ("delegation_id") REFERENCES "delegation" ("delegation_id"),
CONSTRAINT "agent_run_parent_run_agent_run_run_id_fk" FOREIGN KEY ("parent_run_agent_run_run_id") REFERENCES "agent_run" ("run_id"),
CONSTRAINT "agent_run_status_ck" CHECK ("status" IN ('running', 'succeeded', 'failed', 'cancelled', 'killed', 'expired'))
);CREATE TABLE IF NOT EXISTS "agent_run" (
"run_id" TEXT NOT NULL PRIMARY KEY,
"started_at" TEXT NOT NULL,
"ended_at" TEXT,
"status" TEXT NOT NULL,
"trace_id" TEXT,
"purpose" TEXT,
"input_hash" TEXT,
"agent_principal_id" TEXT NOT NULL,
"version_agent_version_id" TEXT NOT NULL,
"tenant_id" TEXT NOT NULL,
"initiator_principal_id" TEXT,
"delegation_id" TEXT,
"parent_run_agent_run_run_id" TEXT,
CONSTRAINT "agent_run_agent_principal_id_fk" FOREIGN KEY ("agent_principal_id") REFERENCES "agent" ("principal_id"),
CONSTRAINT "agent_run_version_agent_version_id_fk" FOREIGN KEY ("version_agent_version_id") REFERENCES "agent_version" ("agent_version_id"),
CONSTRAINT "agent_run_tenant_id_fk" FOREIGN KEY ("tenant_id") REFERENCES "tenant" ("tenant_id"),
CONSTRAINT "agent_run_initiator_principal_id_fk" FOREIGN KEY ("initiator_principal_id") REFERENCES "principal" ("principal_id"),
CONSTRAINT "agent_run_delegation_id_fk" FOREIGN KEY ("delegation_id") REFERENCES "delegation" ("delegation_id"),
CONSTRAINT "agent_run_parent_run_agent_run_run_id_fk" FOREIGN KEY ("parent_run_agent_run_run_id") REFERENCES "agent_run" ("run_id"),
CONSTRAINT "agent_run_status_ck" CHECK ("status" IN ('running', 'succeeded', 'failed', 'cancelled', 'killed', 'expired'))
);Read and written from TypeScript with the types the model gives: import { agentRun } 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 { agentRun } from "@intellectual-frontiers/data/sql/typed/models";
const rows = await from(agentRun).select((s) => ({ runId: s.agentRun.runId, startedAt: s.agentRun.startedAt })).run(runner);