跳转至

public.agent_execution_threads

列

名称 类型 默认值 可空 子表 父表 注释
accessScope varchar(16) 'user'::character varying false user:私有会话;project:共享集成、工作流或任务会话
agentId varchar(36) false public.agents
agentName varchar(255) false
createdAt timestamp(3) with time zone CURRENT_TIMESTAMP(3) false
emoji varchar(8) true
id varchar(128) false public.agent_attention_flags public.agent_execution public.agent_message_queue public.agent_plan public.agent_thread_grants
isTestChat boolean false false 测试聊天时为 True:其工具调用会进入模拟环境,而非真实服务。
ownerId uuid true public.user 启动此私有会话的用户
parentAgentId varchar(36) true 委托此子代理运行的父代理的已保存代理 ID。
parentThreadId varchar(128) true 委托此子代理运行的父会话线程 ID。
projectId varchar(255) false public.project
sessionNumber integer 0 false
taskId varchar(32) true 触发此会话的已发布任务 ID;不是 FK,因为已发布的运行可能比草稿任务定义行存在更久
taskStop json true 最新的任务停止边界及未解决的停止错误
taskVersionId varchar(36) true public.agent_history 提供任务快照的已发布 agent_history 版本
title varchar(255) true
totalCompletionTokens integer 0 false
totalCost double precision 0 false
totalDuration integer 0 false
totalPromptTokens integer 0 false
updatedAt timestamp(3) with time zone CURRENT_TIMESTAMP(3) false

约束

名称 类型 定义
CHK_agent_execution_threads_accessScope CHECK CHECK ((("accessScope")::text = ANY ((ARRAY['user'::character varying, 'project'::character varying])::text[])))
FK_0468a9dc35597314e641d4722aa FOREIGN KEY FOREIGN KEY ("agentId") REFERENCES agents(id) ON DELETE CASCADE
FK_0e2f8bf92a7a9c88b89670f701c FOREIGN KEY FOREIGN KEY ("projectId") REFERENCES project(id) ON DELETE CASCADE
FK_agent_execution_threads_owner FOREIGN KEY FOREIGN KEY ("ownerId") REFERENCES "user"(id) ON DELETE SET NULL
FK_f00b52d74fe11838e1fe086deea FOREIGN KEY FOREIGN KEY ("taskVersionId") REFERENCES agent_history("versionId") ON DELETE SET NULL
PK_22373dbf6ba6929d8ac50093309 PRIMARY KEY PRIMARY KEY (id)
agent_execution_threads_accessScope_not_null n NOT NULL "accessScope"
agent_execution_threads_agentId_not_null n NOT NULL "agentId"
agent_execution_threads_agentName_not_null n NOT NULL "agentName"
agent_execution_threads_createdAt_not_null n NOT NULL "createdAt"
agent_execution_threads_id_not_null n NOT NULL id
agent_execution_threads_isTestChat_not_null n NOT NULL "isTestChat"
agent_execution_threads_projectId_not_null n NOT NULL "projectId"
agent_execution_threads_sessionNumber_not_null n NOT NULL "sessionNumber"
agent_execution_threads_totalCompletionTokens_not_null n NOT NULL "totalCompletionTokens"
agent_execution_threads_totalCost_not_null n NOT NULL "totalCost"
agent_execution_threads_totalDuration_not_null n NOT NULL "totalDuration"
agent_execution_threads_totalPromptTokens_not_null n NOT NULL "totalPromptTokens"
agent_execution_threads_updatedAt_not_null n NOT NULL "updatedAt"

索引

名称 定义
IDX_0468a9dc35597314e641d4722a CREATE INDEX "IDX_0468a9dc35597314e641d4722a" ON public.agent_execution_threads USING btree ("agentId")
IDX_0e2f8bf92a7a9c88b89670f701 CREATE INDEX "IDX_0e2f8bf92a7a9c88b89670f701" ON public.agent_execution_threads USING btree ("projectId")
IDX_agent_execution_threads_ownerId CREATE INDEX "IDX_agent_execution_threads_ownerId" ON public.agent_execution_threads USING btree ("ownerId")
IDX_agent_execution_threads_taskVersionId CREATE INDEX "IDX_agent_execution_threads_taskVersionId" ON public.agent_execution_threads USING btree ("taskVersionId")
PK_22373dbf6ba6929d8ac50093309 CREATE UNIQUE INDEX "PK_22373dbf6ba6929d8ac50093309" ON public.agent_execution_threads USING btree (id)

关系

erDiagram

"public.agent_execution_threads" }o--|| "public.agents" : "FOREIGN KEY (#quot;agentId#quot;) REFERENCES agents(id) ON DELETE CASCADE"
"public.agent_attention_flags" }o--|| "public.agent_execution_threads" : "FOREIGN KEY (#quot;sessionId#quot;) REFERENCES agent_execution_threads(id) ON DELETE CASCADE"
"public.agent_execution" }o--|| "public.agent_execution_threads" : "FOREIGN KEY (#quot;threadId#quot;) REFERENCES agent_execution_threads(id) ON DELETE CASCADE"
"public.agent_message_queue" }o--|| "public.agent_execution_threads" : "FOREIGN KEY (#quot;threadId#quot;) REFERENCES agent_execution_threads(id) ON DELETE CASCADE"
"public.agent_plan" }o--|| "public.agent_execution_threads" : "FOREIGN KEY (#quot;threadId#quot;) REFERENCES agent_execution_threads(id) ON DELETE CASCADE"
"public.agent_thread_grants" }o--|| "public.agent_execution_threads" : "FOREIGN KEY (#quot;threadId#quot;) REFERENCES agent_execution_threads(id) ON DELETE CASCADE"
"public.agent_execution_threads" }o--o| "public.user" : "FOREIGN KEY (#quot;ownerId#quot;) REFERENCES #quot;user#quot;(id) ON DELETE SET NULL"
"public.agent_execution_threads" }o--|| "public.project" : "FOREIGN KEY (#quot;projectId#quot;) REFERENCES project(id) ON DELETE CASCADE"
"public.agent_execution_threads" }o--o| "public.agent_history" : "FOREIGN KEY (#quot;taskVersionId#quot;) REFERENCES agent_history(#quot;versionId#quot;) ON DELETE SET NULL"

"public.agent_execution_threads" {
  varchar_16_ accessScope
  varchar_36_ agentId FK
  varchar_255_ agentName
  timestamp_3__with_time_zone createdAt
  varchar_8_ emoji
  varchar_128_ id
  boolean isTestChat
  uuid ownerId FK
  varchar_36_ parentAgentId
  varchar_128_ parentThreadId
  varchar_255_ projectId FK
  integer sessionNumber
  varchar_32_ taskId
  json taskStop
  varchar_36_ taskVersionId FK
  varchar_255_ title
  integer totalCompletionTokens
  double_precision totalCost
  integer totalDuration
  integer totalPromptTokens
  timestamp_3__with_time_zone updatedAt
}
"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_attention_flags" {
  timestamp_3__with_time_zone createdAt
  uuid id
  varchar_128_ sessionId FK
  varchar_32_ type
  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
}
"public.agent_message_queue" {
  timestamp_3__with_time_zone createdAt
  varchar_36_ executionId FK
  bigint id
  varchar_36_ messageId FK
  json payload
  integer position
  varchar_36_ steeringExecutionId FK
  integer steeringOrder
  varchar_128_ threadId FK
  timestamp_3__with_time_zone updatedAt
}
"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_thread_grants" {
  timestamp_3__with_time_zone createdAt
  varchar_512_ grantKey
  varchar_128_ threadId FK
  timestamp_3__with_time_zone updatedAt
}
"public.user" {
  timestamp_3__with_time_zone createdAt
  boolean disabled
  varchar_255_ email
  varchar_32_ firstName
  uuid id
  varchar_16_ kind
  date lastActiveAt
  varchar_32_ lastName
  boolean mfaEnabled
  text mfaRecoveryCodes
  text mfaSecret
  varchar_255_ password
  json personalizationAnswers
  varchar_128_ roleSlug FK
  json settings
  timestamp_3__with_time_zone updatedAt
}
"public.project" {
  timestamp_3__with_time_zone createdAt
  uuid creatorId FK
  json customTelemetryTags
  varchar_512_ description
  json icon
  varchar_36_ id
  varchar_255_ name
  varchar_36_ type
  timestamp_3__with_time_zone updatedAt
}
"public.agent_history" {
  varchar_36_ agentId FK
  varchar_255_ author
  timestamp_3__with_time_zone createdAt
  text description
  text name
  uuid publishedById FK
  json schema
  json skills
  json tools
  timestamp_3__with_time_zone updatedAt
  varchar_36_ versionId
}

由 tbls 生成

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