⚠️ Experimental — This resource is part of the Guild platform and may change in future releases.
Manages a scheduled (cron) task attached to an sg_agent, sg_workflow, or installed app, using the same target_type / target_name pairing as sg_webhook (agent, workflow, or app). For app targets set endpoint_path (and optionally endpoint_payload).
Set provider workspace_id to keep the schedule in the same workspace as agents, workflows, and webhooks. Import using the schedule ID.
# Set provider workspace_id to keep schedules in the same workspace as agents and workflows
# (same org as agents, workflows, and sg_webhook).
resource "sg_agent" "example" {
name = "scheduled-agent"
}
resource "sg_agent_schedule" "example" {
target_type = "agent"
target_name = sg_agent.example.name
name = "nightly-summary"
expression = "0 7 * * *"
action = "Summarize open incidents and post to the team channel."
enabled = true
}
# Workflow example (requires an sg_workflow resource):
# resource "sg_agent_schedule" "workflow_cron" {
# target_type = "workflow"
# target_name = sg_workflow.my_pipeline.name
# name = "hourly-workflow"
# expression = "0 * * * *"
# action = "Default input for each scheduled workflow run."
# enabled = true
# }
Import an existing sg_agent_schedule using its schedule ID:
terraform import sg_agent_schedule.example '123e4567-e89b-12d3-a456-426614174000'
expression (String) Cron expression (5-field). Example: ‘*/5 * * * *’ runs every 5 minutes.name (String) Human-readable name for the scheduled task.target_name (String) Name of the agent, workflow, or installed app this cron schedule invokes.target_type (String) Either agent, workflow, or app — must match the resource named by target_name (same semantics as sg_webhook).action (String) Prompt or instruction sent on each run (agent/workflow targets). Empty for app schedules.enabled (Boolean) Whether the schedule is active. Defaults to true.endpoint_path (String) Relative POST path on the app install endpoint. Required when target_type is app; empty for agent and workflow targets.endpoint_payload (String) Raw request body POSTed to endpoint_path on each tick (app targets only). Base64-encoded in the Guild API.notification_channel_ids (List of String) UUIDs of sg_notification_channel resources notified on run success or failure. Empty list clears all channels.id (String) Server-assigned schedule identifier.