# public.agent_task_definition

## Columns

| Name | Type | Default | Nullable | Children | Parents | Comment |
| ---- | ---- | ------- | -------- | -------- | ------- | ------- |
| agentId | varchar(36) |  | false |  | [public.agents](public.agents.md) | Owning agent; task definitions are deleted when the agent is deleted |
| createdAt | timestamp(3) with time zone | CURRENT_TIMESTAMP(3) | false |  |  |  |
| cronExpression | varchar(128) |  | false |  |  | Cron schedule evaluated using the instance timezone |
| id | varchar(32) |  | false |  |  | Application-generated task ID referenced from agent JSON config |
| name | varchar(128) |  | false |  |  |  |
| objective | text |  | false |  |  | User-authored instruction sent to the agent when this task runs |
| updatedAt | timestamp(3) with time zone | CURRENT_TIMESTAMP(3) | false |  |  |  |

## Constraints

| Name | Type | Definition |
| ---- | ---- | ---------- |
| FK_f45d0535a2ed59b6c2dd6da98a0 | FOREIGN KEY | FOREIGN KEY ("agentId") REFERENCES agents(id) ON DELETE CASCADE |
| PK_1756c11c637903e97629a7a784a | PRIMARY KEY | PRIMARY KEY (id) |
| agent_task_definition_agentId_not_null | n | NOT NULL "agentId" |
| agent_task_definition_createdAt_not_null | n | NOT NULL "createdAt" |
| agent_task_definition_cronExpression_not_null | n | NOT NULL "cronExpression" |
| agent_task_definition_id_not_null | n | NOT NULL id |
| agent_task_definition_name_not_null | n | NOT NULL name |
| agent_task_definition_objective_not_null | n | NOT NULL objective |
| agent_task_definition_updatedAt_not_null | n | NOT NULL "updatedAt" |

## Indexes

| Name | Definition |
| ---- | ---------- |
| IDX_f45d0535a2ed59b6c2dd6da98a | CREATE INDEX "IDX_f45d0535a2ed59b6c2dd6da98a" ON public.agent_task_definition USING btree ("agentId") |
| PK_1756c11c637903e97629a7a784a | CREATE UNIQUE INDEX "PK_1756c11c637903e97629a7a784a" ON public.agent_task_definition USING btree (id) |

## Relations

```mermaid
erDiagram

"public.agent_task_definition" }o--|| "public.agents" : "FOREIGN KEY (#quot;agentId#quot;) REFERENCES agents(id) ON DELETE CASCADE"

"public.agent_task_definition" {
  varchar_36_ agentId FK
  timestamp_3__with_time_zone createdAt
  varchar_128_ cronExpression
  varchar_32_ id
  varchar_128_ name
  text objective
  timestamp_3__with_time_zone updatedAt
}
"public.agents" {
  varchar_36_ activeVersionId FK
  timestamp_3__with_time_zone createdAt
  varchar_36_ id
  json integrations
  varchar_128_ name
  varchar_255_ projectId FK
  json schema
  json skills
  json tools
  timestamp_3__with_time_zone updatedAt
  varchar_36_ versionId
}
```

---

> Generated by [tbls](https://github.com/k1LoW/tbls)
