跳转至

public.agent_background_job

列

名称 类型 默认值 可空 子表 父表 注释
callerExecutionId integer true public.execution_entity 等待此审批的工作流执行
childExecutionId varchar(36) true 仅工作流作业
childThreadId varchar(128) true 仅子代理作业;在分发时生成,链接到 agent_execution_threads
createdAt timestamp(3) with time zone CURRENT_TIMESTAMP(3) false
error text true
files json true 作业为父线程存储的输出文件
id varchar(36) false
kind varchar(16) false subagent: 独立代理;workflow: 后台工作流;approval: 为挂起的代理所做的决策工作流
notifiedAt timestamp(3) with time zone true 父级收到最新结果或审批请求的时间
parentAgentId varchar(36) false public.agents
parentPrincipalHash varchar(64) false 父代理运行的沙箱主体哈希
parentResourceId varchar(255) false 父代理运行的内存资源
parentRunId varchar(128) true 此审批请求保留的 Agent SDK 运行 ID
parentThreadId varchar(128) false
pauseRequestId uuid true 按一个用户请求分组的已停止作业
planId uuid true public.agent_plan 拥有此工作的计划
planTaskId uuid true 保存的计划文档中的任务 ID
result text true 已结束的子代理作业的最终答案
settledAt timestamp(3) with time zone true
skippedFiles json true 因过大而无法存储的输出文件
sourceExecutionId varchar(36) true public.agent_execution 分发此作业的执行
status varchar(16) false running: 子任务运行中;suspended: 子任务等待审批;paused: 用户已停止子任务;completed、failed、cancelled: 终止状态
subAgentId varchar(36) true 仅子代理作业
timeoutAt timestamp(3) with time zone true 当协调机制将作业判定为超时;NULL 表示无超时
title varchar(255) false 任务名称或工作流名称,会在状态检查列表中回显
updatedAt timestamp(3) with time zone CURRENT_TIMESTAMP(3) false
wakeAttemptId uuid true 随此结果开始的唤醒尝试。恢复操作会将结果标记为已消费,而不是再次运行唤醒。
workflowId varchar(36) true 仅工作流作业;限定取消范围

约束

名称 类型 定义
CHK_agent_background_job_kind CHECK CHECK (((kind)::text = ANY ((ARRAY['subagent'::character varying, 'workflow'::character varying, 'approval'::character varying])::text[])))
CHK_agent_background_job_status CHECK CHECK (((status)::text = ANY ((ARRAY['running'::character varying, 'suspended'::character varying, 'paused'::character varying, 'completed'::character varying, 'failed'::character varying, 'cancelled'::character varying])::text[])))
FK_4db3b7ebea4ed4f69649982018c FOREIGN KEY FOREIGN KEY ("sourceExecutionId") REFERENCES agent_execution(id) ON DELETE SET NULL
FK_agent_approval_caller_execution FOREIGN KEY FOREIGN KEY ("callerExecutionId") REFERENCES execution_entity(id) ON DELETE SET NULL
FK_ce131bff629d89015893e350e9c FOREIGN KEY FOREIGN KEY ("planId") REFERENCES agent_plan(id) ON DELETE SET NULL
FK_d46c6f00730c2ef8bcb6ee24b67 FOREIGN KEY FOREIGN KEY ("parentAgentId") REFERENCES agents(id) ON DELETE CASCADE
PK_6e0db58281aa2b4c956dc0d58e9 PRIMARY KEY PRIMARY KEY (id)
agent_background_job_createdAt_not_null n NOT NULL "createdAt"
agent_background_job_id_not_null n NOT NULL id
agent_background_job_kind_not_null n NOT NULL kind
agent_background_job_parentAgentId_not_null n NOT NULL "parentAgentId"
agent_background_job_parentPrincipalHash_not_null n NOT NULL "parentPrincipalHash"
agent_background_job_parentResourceId_not_null n NOT NULL "parentResourceId"
agent_background_job_parentThreadId_not_null n NOT NULL "parentThreadId"
agent_background_job_status_not_null n NOT NULL status
agent_background_job_title_not_null n NOT NULL title
agent_background_job_updatedAt_not_null n NOT NULL "updatedAt"

索引

名称 定义
IDX_93d62baabe9858816b5adafb44 CREATE INDEX "IDX_93d62baabe9858816b5adafb44" ON public.agent_background_job USING btree ("parentThreadId", status)
IDX_agent_approval_parent_run CREATE INDEX "IDX_agent_approval_parent_run" ON public.agent_background_job USING btree ("parentAgentId", "parentRunId") WHERE (((kind)::text = 'approval'::text) AND ("notifiedAt" IS NULL))
IDX_agent_background_job_callerExecutionId CREATE INDEX "IDX_agent_background_job_callerExecutionId" ON public.agent_background_job USING btree ("callerExecutionId")
IDX_agent_background_job_childExecutionId CREATE UNIQUE INDEX "IDX_agent_background_job_childExecutionId" ON public.agent_background_job USING btree ("childExecutionId") WHERE ("childExecutionId" IS NOT NULL)
IDX_agent_background_job_parentThreadId CREATE INDEX "IDX_agent_background_job_parentThreadId" ON public.agent_background_job USING btree ("parentThreadId") WHERE (((status)::text <> 'running'::text) AND ("notifiedAt" IS NULL))
IDX_agent_background_job_planId_planTaskId CREATE INDEX "IDX_agent_background_job_planId_planTaskId" ON public.agent_background_job USING btree ("planId", "planTaskId")
IDX_agent_background_job_sourceExecutionId CREATE INDEX "IDX_agent_background_job_sourceExecutionId" ON public.agent_background_job USING btree ("sourceExecutionId")
IDX_agent_background_job_timeoutAt CREATE INDEX "IDX_agent_background_job_timeoutAt" ON public.agent_background_job USING btree ("timeoutAt") WHERE ((status)::text = ANY ((ARRAY['running'::character varying, 'suspended'::character varying])::text[]))
IDX_d46c6f00730c2ef8bcb6ee24b6 CREATE INDEX "IDX_d46c6f00730c2ef8bcb6ee24b6" ON public.agent_background_job USING btree ("parentAgentId")
IDX_e43e630272995a93dfeb94ab3e CREATE INDEX "IDX_e43e630272995a93dfeb94ab3e" ON public.agent_background_job USING btree ("settledAt")
PK_6e0db58281aa2b4c956dc0d58e9 CREATE UNIQUE INDEX "PK_6e0db58281aa2b4c956dc0d58e9" ON public.agent_background_job USING btree (id)

关系

erDiagram

"public.agent_background_job" }o--o| "public.execution_entity" : "FOREIGN KEY (#quot;callerExecutionId#quot;) REFERENCES execution_entity(id) ON DELETE SET NULL"
"public.agent_background_job" }o--|| "public.agents" : "FOREIGN KEY (#quot;parentAgentId#quot;) REFERENCES agents(id) ON DELETE CASCADE"
"public.agent_background_job" }o--o| "public.agent_plan" : "FOREIGN KEY (#quot;planId#quot;) REFERENCES agent_plan(id) ON DELETE SET NULL"
"public.agent_background_job" }o--o| "public.agent_execution" : "FOREIGN KEY (#quot;sourceExecutionId#quot;) REFERENCES agent_execution(id) ON DELETE SET NULL"

"public.agent_background_job" {
  integer callerExecutionId FK
  varchar_36_ childExecutionId
  varchar_128_ childThreadId
  timestamp_3__with_time_zone createdAt
  text error
  json files
  varchar_36_ id
  varchar_16_ kind
  timestamp_3__with_time_zone notifiedAt
  varchar_36_ parentAgentId FK
  varchar_64_ parentPrincipalHash
  varchar_255_ parentResourceId
  varchar_128_ parentRunId
  varchar_128_ parentThreadId
  uuid pauseRequestId
  uuid planId FK
  uuid planTaskId
  text result
  timestamp_3__with_time_zone settledAt
  json skippedFiles
  varchar_36_ sourceExecutionId FK
  varchar_16_ status
  varchar_36_ subAgentId
  timestamp_3__with_time_zone timeoutAt
  varchar_255_ title
  timestamp_3__with_time_zone updatedAt
  uuid wakeAttemptId
  varchar_36_ workflowId
}
"public.execution_entity" {
  bigint binaryDataSizeBytes
  timestamp_3__with_time_zone createdAt
  varchar_255_ deduplicationKey
  timestamp_3__with_time_zone deletedAt
  boolean finished
  integer id
  bigint jsonSizeBytes
  varchar mode
  smallint resumeAttempts
  varchar retryOf
  varchar retrySuccessId
  timestamp_3__with_time_zone startedAt
  varchar status
  timestamp_3__with_time_zone stoppedAt
  varchar_2_ storedAt
  json tracingContext
  boolean usedPrivateCredentials
  timestamp_3__with_time_zone waitTill
  varchar_36_ workflowId FK
  varchar_36_ workflowVersionId
}
"public.agents" {
  varchar_36_ activeVersionId FK
  varchar_36_ approvalWorkflowId FK
  boolean availableInMCP
  timestamp_3__with_time_zone createdAt
  varchar_36_ id
  uuid identityId FK
  json integrations
  boolean isArchived
  varchar_128_ name
  varchar_36_ parentFolderId FK
  varchar_255_ projectId FK
  integer publicationRevision
  integer revision
  json schema
  varchar_16_ scope
  timestamp_3__with_time_zone setupCompletedAt
  json skills
  json tools
  timestamp_3__with_time_zone updatedAt
  varchar_36_ versionId
}
"public.agent_plan" {
  timestamp_3__with_time_zone closedAt
  timestamp_3__with_time_zone createdAt
  json data
  integer formatVersion
  uuid id
  integer revision
  varchar_128_ threadId FK
  timestamp_3__with_time_zone updatedAt
}
"public.agent_execution" {
  boolean acceptsSteering
  json attachments
  json author
  integer cacheReadTokens
  integer cacheWriteTokens
  integer completionTokens
  double_precision cost
  timestamp_3__with_time_zone createdAt
  integer duration
  text error
  json failureSummary
  varchar_32_ finishReason
  varchar_64_ guardrailCode
  varchar_16_ hitlStatus
  varchar_36_ id
  varchar_255_ model
  varchar_36_ parentExecutionId FK
  integer promptTokens
  varchar_32_ source
  timestamp_3__with_time_zone startedAt
  varchar_16_ status
  timestamp_3__with_time_zone stoppedAt
  varchar_2_ storedAt
  varchar_128_ threadId FK
  json timeline
  integer totalTokens
  timestamp_3__with_time_zone updatedAt
  text userMessage
}

由 tbls 生成

本页原文 Markdown:在 AtomGit 查看·内容源自开源项目 n8/n8n