argsHashtextrequiredA hash of its arguments
Becomes the column args_hash of tool_call.
A call of a tool in a run: what was decided, and a hash of its arguments, never the arguments
Model identityAgent. Written in commons/data/models/identity-agent/mod.ts:138. Identified by toolCallId.
argsHashtextrequiredA hash of its arguments
Becomes the column args_hash of tool_call.
argsSummarytextoptionalWhat it asked for, redacted by the caller, never the raw arguments
Becomes the column args_summary of tool_call.
callIndexintegerrequiredWhich call of the run it is
Becomes the column call_index of tool_call.
callKeytextrequiredA hash of the run and the index, unique
Becomes the column call_key of tool_call.
completedAtinstantoptionalWhen it ended
Becomes the column completed_at of tool_call.
costMicrosintegeroptionalWhat it cost, in millionths of a currency unit
Becomes the column cost_micros of tool_call.
decisioncode of callDecisionrequiredWhat was decided about it
Becomes the column decision of tool_call.
denyReasontextoptionalWhy it was refused
Becomes the column deny_reason of tool_call.
policyRefsstructuredoptionalThe roles, policies and grants that decided
Becomes the column policy_refs of tool_call.
requestedAtinstantrequiredWhen it was asked for
Becomes the column requested_at of tool_call.
resourceIdtextoptionalThe resource it was about
Becomes the column resource_id of tool_call.
resourceTypetextoptionalThe kind of resource it was about
Becomes the column resource_type of tool_call.
resultHashtextoptionalA hash of its result
Becomes the column result_hash of tool_call.
statuscode of callStatusrequiredWhere it is
Becomes the column status of tool_call.
tokensInintegeroptionalTokens sent to the model
Becomes the column tokens_in of tool_call.
tokensOutintegeroptionalTokens received from the model
Becomes the column tokens_out of tool_call.
toolCallIdidentifierrequiredWhat identifies the call, made by the application
Becomes the column tool_call_id of tool_call.
approvaloptionalThe approval it was given To approvalRequest. Written at commons/data/models/identity-agent/mod.ts:138
runoneThe run To agentRun. Written at commons/data/models/identity-agent/mod.ts:204
tooloneThe tool To agentTool. Written at commons/data/models/identity-agent/mod.ts:138
Projects to the table tool_call with the primary key tool_call_id.
| Column | Type | Null | Role | From |
|---|---|---|---|---|
approval_approval_request_id | text | true | reference | toolCall.approval |
args_hash | text | false | attribute | toolCall.argsHash |
args_summary | text | true | attribute | toolCall.argsSummary |
call_index | integer | false | attribute | toolCall.callIndex |
call_key | text | false | attribute | toolCall.callKey |
completed_at | timestamp | true | attribute | toolCall.completedAt |
cost_micros | integer | true | attribute | toolCall.costMicros |
decision | text | false | attribute | toolCall.decision |
deny_reason | text | true | attribute | toolCall.denyReason |
policy_refs | json | true | attribute | toolCall.policyRefs |
requested_at | timestamp | false | attribute | toolCall.requestedAt |
resource_id | text | true | attribute | toolCall.resourceId |
resource_type | text | true | attribute | toolCall.resourceType |
result_hash | text | true | attribute | toolCall.resultHash |
run_agent_run_run_id | text | false | reference | toolCall.run |
status | text | false | attribute | toolCall.status |
tokens_in | integer | true | attribute | toolCall.tokensIn |
tokens_out | integer | true | attribute | toolCall.tokensOut |
tool_agent_tool_id | text | false | reference | toolCall.tool |
tool_call_id | text | false | attribute | toolCall.toolCallId |
CREATE TABLE IF NOT EXISTS "tool_call" (
"tool_call_id" VARCHAR NOT NULL PRIMARY KEY,
"call_index" INTEGER NOT NULL,
"decision" VARCHAR NOT NULL,
"status" VARCHAR NOT NULL,
"args_hash" VARCHAR NOT NULL,
"args_summary" VARCHAR,
"resource_type" VARCHAR,
"resource_id" VARCHAR,
"result_hash" VARCHAR,
"deny_reason" VARCHAR,
"policy_refs" JSON,
"tokens_in" INTEGER,
"tokens_out" INTEGER,
"cost_micros" INTEGER,
"requested_at" TIMESTAMPTZ NOT NULL,
"completed_at" TIMESTAMPTZ,
"call_key" VARCHAR NOT NULL,
"run_agent_run_run_id" VARCHAR NOT NULL,
"tool_agent_tool_id" VARCHAR NOT NULL,
"approval_approval_request_id" VARCHAR,
CONSTRAINT "tool_call_run_agent_run_run_id_fk" FOREIGN KEY ("run_agent_run_run_id") REFERENCES "agent_run" ("run_id"),
CONSTRAINT "tool_call_tool_agent_tool_id_fk" FOREIGN KEY ("tool_agent_tool_id") REFERENCES "agent_tool" ("agent_tool_id"),
CONSTRAINT "tool_call_approval_approval_request_id_fk" FOREIGN KEY ("approval_approval_request_id") REFERENCES "approval_request" ("approval_request_id"),
CONSTRAINT "tool_call_call_key_uq" UNIQUE ("call_key"),
CONSTRAINT "tool_call_decision_ck" CHECK ("decision" IN ('allowed', 'denied', 'approval_required', 'budget_exceeded')),
CONSTRAINT "tool_call_status_ck" CHECK ("status" IN ('requested', 'running', 'succeeded', 'failed'))
);CREATE TABLE IF NOT EXISTS "tool_call" (
"tool_call_id" TEXT NOT NULL PRIMARY KEY,
"call_index" INTEGER NOT NULL,
"decision" TEXT NOT NULL,
"status" TEXT NOT NULL,
"args_hash" TEXT NOT NULL,
"args_summary" TEXT,
"resource_type" TEXT,
"resource_id" TEXT,
"result_hash" TEXT,
"deny_reason" TEXT,
"policy_refs" JSONB,
"tokens_in" INTEGER,
"tokens_out" INTEGER,
"cost_micros" INTEGER,
"requested_at" TIMESTAMPTZ NOT NULL,
"completed_at" TIMESTAMPTZ,
"call_key" TEXT NOT NULL,
"run_agent_run_run_id" TEXT NOT NULL,
"tool_agent_tool_id" TEXT NOT NULL,
"approval_approval_request_id" TEXT,
CONSTRAINT "tool_call_run_agent_run_run_id_fk" FOREIGN KEY ("run_agent_run_run_id") REFERENCES "agent_run" ("run_id"),
CONSTRAINT "tool_call_tool_agent_tool_id_fk" FOREIGN KEY ("tool_agent_tool_id") REFERENCES "agent_tool" ("agent_tool_id"),
CONSTRAINT "tool_call_approval_approval_request_id_fk" FOREIGN KEY ("approval_approval_request_id") REFERENCES "approval_request" ("approval_request_id"),
CONSTRAINT "tool_call_call_key_uq" UNIQUE ("call_key"),
CONSTRAINT "tool_call_decision_ck" CHECK ("decision" IN ('allowed', 'denied', 'approval_required', 'budget_exceeded')),
CONSTRAINT "tool_call_status_ck" CHECK ("status" IN ('requested', 'running', 'succeeded', 'failed'))
);CREATE TABLE IF NOT EXISTS "tool_call" (
"tool_call_id" TEXT NOT NULL PRIMARY KEY,
"call_index" INTEGER NOT NULL,
"decision" TEXT NOT NULL,
"status" TEXT NOT NULL,
"args_hash" TEXT NOT NULL,
"args_summary" TEXT,
"resource_type" TEXT,
"resource_id" TEXT,
"result_hash" TEXT,
"deny_reason" TEXT,
"policy_refs" TEXT,
"tokens_in" INTEGER,
"tokens_out" INTEGER,
"cost_micros" INTEGER,
"requested_at" TEXT NOT NULL,
"completed_at" TEXT,
"call_key" TEXT NOT NULL,
"run_agent_run_run_id" TEXT NOT NULL,
"tool_agent_tool_id" TEXT NOT NULL,
"approval_approval_request_id" TEXT,
CONSTRAINT "tool_call_run_agent_run_run_id_fk" FOREIGN KEY ("run_agent_run_run_id") REFERENCES "agent_run" ("run_id"),
CONSTRAINT "tool_call_tool_agent_tool_id_fk" FOREIGN KEY ("tool_agent_tool_id") REFERENCES "agent_tool" ("agent_tool_id"),
CONSTRAINT "tool_call_approval_approval_request_id_fk" FOREIGN KEY ("approval_approval_request_id") REFERENCES "approval_request" ("approval_request_id"),
CONSTRAINT "tool_call_call_key_uq" UNIQUE ("call_key"),
CONSTRAINT "tool_call_decision_ck" CHECK ("decision" IN ('allowed', 'denied', 'approval_required', 'budget_exceeded')),
CONSTRAINT "tool_call_status_ck" CHECK ("status" IN ('requested', 'running', 'succeeded', 'failed'))
);Read and written from TypeScript with the types the model gives: import { toolCall } 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 { toolCall } from "@intellectual-frontiers/data/sql/typed/models";
const rows = await from(toolCall).select((s) => ({ toolCallId: s.toolCall.toolCallId, callIndex: s.toolCall.callIndex })).run(runner);