IF Commons GitHub

agentRun

concept

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.

Governance: attributes

endedAtinstantoptional

When it ended

Becomes the column ended_at of agent_run.

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

inputHashtextoptional

A hash of its input

Becomes the column input_hash of agent_run.

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

purposetextoptional

What it is for

Becomes the column purpose of agent_run.

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

runIdidentifierrequired

What identifies the run, made by the application

Becomes the column run_id of agent_run.

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

startedAtinstantrequired

When it started

Becomes the column started_at of agent_run.

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

statuscode of runStatusrequired

Where it is

Becomes the column status of agent_run.

Annotations: quality.transitions={"allowed":{"running":["succeeded","failed","cancelled","killed","expired"],"succeeded":[],"failed":[],"cancelled":[],"killed":[],"expired":[]}}

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

traceIdtextoptional

The trace it is part of

Becomes the column trace_id of agent_run.

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

Governance: relationships

agentone

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

delegationoptional

The delegation it acts under To delegation. Written at commons/data/models/identity-agent/mod.ts:131

initiatoroptional

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

parentRunoptional

The run that started it, for a sub-agent To agentRun. Written at commons/data/models/identity-agent/mod.ts:132

tenantone

The tenant it runs in To tenant. Written at commons/data/models/identity-agent/mod.ts:129

versionone

The version it runs To agentVersion. Written at commons/data/models/identity-agent/mod.ts:128

Logical: the table

Projects to the table agent_run with the primary key run_id.

ColumnTypeNullRoleFrom
agent_principal_idtextfalsereferenceagentRun.agent
delegation_idtexttruereferenceagentRun.delegation
ended_attimestamptrueattributeagentRun.endedAt
initiator_principal_idtexttruereferenceagentRun.initiator
input_hashtexttrueattributeagentRun.inputHash
parent_run_agent_run_run_idtexttruereferenceagentRun.parentRun
purposetexttrueattributeagentRun.purpose
run_idtextfalseattributeagentRun.runId
started_attimestampfalseattributeagentRun.startedAt
statustextfalseattributeagentRun.status
tenant_idtextfalsereferenceagentRun.tenant
trace_idtexttrueattributeagentRun.traceId
version_agent_version_idtextfalsereferenceagentRun.version

Physical: SQL

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'))
);

Physical: the typed table

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);

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