# agent_message_queue ## Description
Table Definition ```sql CREATE TABLE "agent_message_queue" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "agentId" varchar(36) NOT NULL, "threadId" varchar(128) NOT NULL, "source" varchar(16) NOT NULL, "kind" varchar(16) NOT NULL, "status" varchar(16) NOT NULL, "payload" text NOT NULL, "executionId" varchar(36), "createdAt" datetime(3) NOT NULL DEFAULT (STRFTIME('%Y-%m-%d %H:%M:%f', 'NOW')), "updatedAt" datetime(3) NOT NULL DEFAULT (STRFTIME('%Y-%m-%d %H:%M:%f', 'NOW')), CONSTRAINT "CHK_agent_message_queue_source" CHECK ("source" IN ('preview', 'integration')), CONSTRAINT "CHK_agent_message_queue_kind" CHECK ("kind" IN ('message', 'hitl')), CONSTRAINT "CHK_agent_message_queue_status" CHECK ("status" IN ('queued', 'processing', 'cancelling')), CONSTRAINT "FK_8a5699c954416a2172688ff39fa" FOREIGN KEY ("agentId") REFERENCES "agents" ("id") ON DELETE CASCADE, CONSTRAINT "FK_2349d84b4f2a660fc264f38fef3" FOREIGN KEY ("executionId") REFERENCES "agent_execution" ("id") ON DELETE SET NULL) ```
## Columns | Name | Type | Default | Nullable | Children | Parents | Comment | | ---- | ---- | ------- | -------- | -------- | ------- | ------- | | agentId | varchar(36) | | false | | [agents](agents.md) | | | createdAt | datetime(3) | STRFTIME('%Y-%m-%d %H:%M:%f', 'NOW') | false | | | | | executionId | varchar(36) | | true | | [agent_execution](agent_execution.md) | | | id | INTEGER | | false | | | | | kind | varchar(16) | | false | | | | | payload | TEXT | | false | | | | | source | varchar(16) | | false | | | | | status | varchar(16) | | false | | | | | threadId | varchar(128) | | false | | | | | updatedAt | datetime(3) | STRFTIME('%Y-%m-%d %H:%M:%f', 'NOW') | false | | | | ## Constraints | Name | Type | Definition | | ---- | ---- | ---------- | | - | CHECK | CHECK ("source" IN ('preview', 'integration')) | | - | CHECK | CHECK ("kind" IN ('message', 'hitl')) | | - | CHECK | CHECK ("status" IN ('queued', 'processing', 'cancelling')) | | - (Foreign key ID: 0) | FOREIGN KEY | FOREIGN KEY (executionId) REFERENCES agent_execution (id) ON UPDATE NO ACTION ON DELETE SET NULL MATCH NONE | | - (Foreign key ID: 1) | FOREIGN KEY | FOREIGN KEY (agentId) REFERENCES agents (id) ON UPDATE NO ACTION ON DELETE CASCADE MATCH NONE | | id | PRIMARY KEY | PRIMARY KEY (id) | ## Indexes | Name | Definition | | ---- | ---------- | | IDX_0d7ab2b181c282217497591502 | CREATE INDEX "IDX_0d7ab2b181c282217497591502" ON "agent_message_queue" ("threadId", "status", "kind", "id") | | IDX_832d536d7954194b88e0edb5bd | CREATE INDEX "IDX_832d536d7954194b88e0edb5bd" ON "agent_message_queue" ("status", "updatedAt") | | IDX_8a5699c954416a2172688ff39f | CREATE INDEX "IDX_8a5699c954416a2172688ff39f" ON "agent_message_queue" ("agentId") | | IDX_agent_message_queue_executionId | CREATE UNIQUE INDEX "IDX_agent_message_queue_executionId" ON "agent_message_queue" ("executionId") WHERE "executionId" IS NOT NULL | ## Relations ```mermaid erDiagram "agent_message_queue" }o--|| "agents" : "FOREIGN KEY (agentId) REFERENCES agents (id) ON UPDATE NO ACTION ON DELETE CASCADE MATCH NONE" "agent_message_queue" }o--o| "agent_execution" : "FOREIGN KEY (executionId) REFERENCES agent_execution (id) ON UPDATE NO ACTION ON DELETE SET NULL MATCH NONE" "agent_message_queue" { varchar_36_ agentId FK datetime_3_ createdAt varchar_36_ executionId FK INTEGER id varchar_16_ kind TEXT payload varchar_16_ source varchar_16_ status varchar_128_ threadId datetime_3_ updatedAt } "agents" { varchar_36_ activeVersionId FK boolean availableInMCP datetime_3_ createdAt varchar_36_ id PK TEXT integrations varchar_128_ name varchar_255_ projectId FK INTEGER revision TEXT schema datetime_3_ setupCompletedAt TEXT skills TEXT tools datetime_3_ updatedAt varchar_36_ versionId } "agent_execution" { TEXT attachments TEXT author INTEGER completionTokens REAL cost datetime_3_ createdAt INTEGER duration TEXT error TEXT failureSummary varchar_16_ hitlStatus varchar_36_ id PK varchar_255_ model INTEGER promptTokens varchar_32_ source datetime_3_ startedAt varchar_16_ status datetime_3_ stoppedAt varchar_2_ storedAt varchar_128_ threadId FK TEXT timeline INTEGER totalTokens datetime_3_ updatedAt TEXT userMessage } ``` --- > Generated by [tbls](https://github.com/k1LoW/tbls)