Ai Tasks

An AI Task defines a Files.com AI prompt that can run on a schedule or in response to file actions.

Resource Schema

Required

PropertyDescription
name
String
AI Task name.
prompt
String
Prompt sent when this AI Task is invoked.

Optional

PropertyDescription
workspace_id
Int64
Workspace ID. 0 means the default workspace.
description
String
AI Task description.
permission_set
String
Permissions used by the internal API key for this AI Task. Valid values are full and files_only.
Possible values: full, files_only
path
String
Path scope used for action-triggered AI Tasks. This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
source
String
Source glob used with path for action-triggered AI Tasks.
disabled
Bool
If true, this AI Task will not run.
trigger
String
How this AI Task is triggered.
Possible values: manual, daily, custom_schedule, action
trigger_actions
List
If trigger is action, the file action types that invoke this AI Task. Valid actions are create, copy, move, archived_delete, update, read, destroy.
interval
String
If trigger is daily, this specifies how often to run the AI Task.
recurring_day
Int64
If trigger is daily, this selects the day number inside the chosen interval.
recurring_days
List
If trigger is daily, this selects one or more day numbers inside a week, month, quarter, or year interval.
schedule_id
Int64
If trigger is custom_schedule, the reusable Schedule used instead of the AI Task's schedule fields.
schedule_days_of_week
List
If trigger is custom_schedule, the 0-based weekdays used by the schedule.
schedule_times_of_day
List
Times of day in HH:MM format for the AI Task schedule.
schedule_time_zone
String
Time zone used by the AI Task schedule.
holiday_region
String
Optional holiday region used by the AI Task schedule.

Read Only

PropertyDescription
id
Int64
AI Task ID.
human_readable_schedule
String
Human-readable schedule description.
last_run_at
String
Most recent successful invocation time.
master_admin_user_id
Int64
Master User ID used for AI Task invocations.
created_at
String
Creation time.
updated_at
String
Last update time.

Example Resource

resource "files_ai_task" "example_ai_task" {
  description           = "Summarizes files uploaded by the accounting team."
  disabled              = true
  holiday_region        = "us"
  interval              = "day"
  name                  = "Summarize daily reports"
  path                  = "incoming/reports"
  permission_set        = "files_only"
  prompt                = "Summarize the uploaded file and identify follow-up actions."
  recurring_day         = 1
  recurring_days        = [1, 15]
  schedule_id           = 1
  schedule_days_of_week = [1, 3, 5]
  schedule_time_zone    = "Eastern Time (US & Canada)"
  schedule_times_of_day = ["06:30"]
  source                = "*.pdf"
  trigger               = "daily"
  trigger_actions       = ["create"]
  workspace_id          = 0
}

Resource Import

This Resource supports importing using the following syntax:

Example Import Command

# Ai Tasks can be imported by specifying the id.
terraform import files_ai_task.example_ai_task 1

Data Source Schema

Required

PropertyDescription
id
Int64
AI Task ID.

Read Only

PropertyDescription
workspace_id
Int64
Workspace ID. 0 means the default workspace.
name
String
AI Task name.
description
String
AI Task description.
prompt
String
Prompt sent when this AI Task is invoked.
permission_set
String
Permissions used by the internal API key for this AI Task. Valid values are full and files_only.
Possible values: full, files_only
path
String
Path scope used for action-triggered AI Tasks. This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
source
String
Source glob used with path for action-triggered AI Tasks.
disabled
Bool
If true, this AI Task will not run.
trigger
String
How this AI Task is triggered.
Possible values: manual, daily, custom_schedule, action
trigger_actions
List
If trigger is action, the file action types that invoke this AI Task. Valid actions are create, copy, move, archived_delete, update, read, destroy.
interval
String
If trigger is daily, this specifies how often to run the AI Task.
recurring_day
Int64
If trigger is daily, this selects the day number inside the chosen interval.
recurring_days
List
If trigger is daily, this selects one or more day numbers inside a week, month, quarter, or year interval.
schedule_id
Int64
If trigger is custom_schedule, the reusable Schedule used instead of the AI Task's schedule fields.
schedule_days_of_week
List
If trigger is custom_schedule, the 0-based weekdays used by the schedule.
schedule_times_of_day
List
Times of day in HH:MM format for the AI Task schedule.
schedule_time_zone
String
Time zone used by the AI Task schedule.
holiday_region
String
Optional holiday region used by the AI Task schedule.
human_readable_schedule
String
Human-readable schedule description.
last_run_at
String
Most recent successful invocation time.
master_admin_user_id
Int64
Master User ID used for AI Task invocations.
created_at
String
Creation time.
updated_at
String
Last update time.

Example Data Source

data "files_ai_task" "example_ai_task" {
  id = 1
}