Docs > Automations
Creating automations
# Creating automations Because automations are Factory files owned by an agent, creating one is a repeatable sequence: define the actor in `AGENT.md`, define the trigger and per-run task in `automations/<name>.md`, preview, push, and verify live state. ## Automation lifecycle ```mermaid flowchart LR Trigger["Trigger fires<br/>(cron / datetime / event / manual)"] --> Admit["Admission & eligibility<br/>(enabled, Scope, requires, billing)"] Admit --> Cond{"Optional condition<br/>or event classifier"} Cond -->|Does not match| Skip["Skipped<br/>(recorded with reason)"] Cond -->|Matches| Run["Agent run executes<br/>(dex / claude / codex)"] Run --> Outcome["Outcome applied<br/>(Pending Actions, Auto Mode,<br/>or read-only report)"] ``` ## Step-by-step authoring ### 1. Define the agent (`AGENT.md`) Make sure the parent agent declares its standing instructions, `requires`, and write policy (`requireWriteApproval: true` by default; optional `autoMode`). ### 2. Write the automation file (`automations/<name>.md`) Create the automation file under `agents/<slug>/automations/` (personal) or `workspace/agents/<id>/automations/` (shared): ```markdown title="users/sam--.../agents/pipeline-digest/automations/weekday-morning.md" --- schemaVersion: 4 enabled: true trigger: type: cron schedule: "0 8 * * 1-5" timezone: America/Los_Angeles condition: Only run if there are new customer emails or Slack messages since the previous weekday run. --- Review open customer threads from the past 24 hours and check the `Open Q4 commitments` View (`dex views query`). Summarize new commitments, blockers, and overdue items, and draft a short Slack recap for my review. ``` Rules enforced at validation time: - **Use `schemaVersion: 4`.** - **Put the task in the Markdown body**, never in an `instructions` frontmatter field. - **Set `enabled` explicitly** (`true` or `false`). An automation with `enabled: true` requires a non-empty Markdown body. - **Never duplicate agent fields.** Do not write `title`, `harness`, `model`, `requireWriteApproval`, or `autoMode` in the automation file—they belong exclusively to `AGENT.md`. - **Omit legacy `autoExecute`.** Write approval is controlled by `requireWriteApproval` and `autoMode` on `AGENT.md`. ### 3. Preview, push, and confirm Apply ```bash dex factory add factories/*/users/*/agents/pipeline-digest dex factory commit -m "Add weekday morning pipeline digest automation" dex factory preview dex factory push ``` Commit success and **Apply** success are separate steps. Do not assume an automation is scheduled until Apply succeeds; verify its live state in `/nexus/automations` or via `dex agents get <id>`. ### 4. Validate the first run safely - **Personal automations** — Trigger a manual run (`Run now`) and inspect the transcript and any Pending Action cards in `/nexus/inbox`. - **Shared automations** — Do **not** click Admin `Run now` just to test an unproven edit (that dispatches to every live member or runs the live coordinator). Preview with `dex factory preview`, validate on a dry run or your own member run first, and keep `requireWriteApproval: true` until outputs are consistently accurate. ### Pausing or stopping an automation To pause an automation without deleting it, set `enabled: false` in `automations/<name>.md`, commit, preview, and push. On a [shared agent](/agents/shared-agents/), individual teammates can pause only themselves with `dex agents off <id>` without affecting the rest of the team. ## Related pages - [Triggers](/automations/triggers/) - Cron, datetime, event, and manual trigger formats - [Runs and troubleshooting](/automations/runs-and-troubleshooting/) - Inspecting run logs and resolving skipped/failed runs - [Factory definition as code](/factory/workspace-structure/) - Complete `AGENT.md` and `automations/*.md` reference - [Runs, dry runs, and self-improvement](/factory/measure-and-improve/) - Validating edits with dry runs and feedbackAuthor automation files under an agent in Factory, configure triggers and pre-run conditions, preview changes, and verify live scheduling after Apply.
Because automations are Factory files owned by an agent, creating one is a repeatable sequence: define the actor in AGENT.md, define the trigger and per-run task in automations/<name>.md, preview, push, and verify live state.
Automation lifecycle
Section titled “Automation lifecycle”flowchart LR
Trigger["Trigger fires<br/>(cron / datetime / event / manual)"] --> Admit["Admission & eligibility<br/>(enabled, Scope, requires, billing)"]
Admit --> Cond{"Optional condition<br/>or event classifier"}
Cond -->|Does not match| Skip["Skipped<br/>(recorded with reason)"]
Cond -->|Matches| Run["Agent run executes<br/>(dex / claude / codex)"]
Run --> Outcome["Outcome applied<br/>(Pending Actions, Auto Mode,<br/>or read-only report)"]
Step-by-step authoring
Section titled “Step-by-step authoring”1. Define the agent (AGENT.md)
Section titled “1. Define the agent (AGENT.md)”Make sure the parent agent declares its standing instructions, requires, and write policy (requireWriteApproval: true by default; optional autoMode).
2. Write the automation file (automations/<name>.md)
Section titled “2. Write the automation file (automations/<name>.md)”Create the automation file under agents/<slug>/automations/ (personal) or workspace/agents/<id>/automations/ (shared):
---schemaVersion: 4enabled: truetrigger: type: cron schedule: "0 8 * * 1-5" timezone: America/Los_Angelescondition: Only run if there are new customer emails or Slack messages since the previous weekday run.---
Review open customer threads from the past 24 hours and check the `Open Q4 commitments`View (`dex views query`). Summarize new commitments, blockers, and overdue items,and draft a short Slack recap for my review.Rules enforced at validation time:
- Use
schemaVersion: 4. - Put the task in the Markdown body, never in an
instructionsfrontmatter field. - Set
enabledexplicitly (trueorfalse). An automation withenabled: truerequires a non-empty Markdown body. - Never duplicate agent fields. Do not write
title,harness,model,requireWriteApproval, orautoModein the automation file—they belong exclusively toAGENT.md. - Omit legacy
autoExecute. Write approval is controlled byrequireWriteApprovalandautoModeonAGENT.md.
3. Preview, push, and confirm Apply
Section titled “3. Preview, push, and confirm Apply”dex factory add factories/*/users/*/agents/pipeline-digestdex factory commit -m "Add weekday morning pipeline digest automation"dex factory previewdex factory pushCommit success and Apply success are separate steps. Do not assume an automation is scheduled until Apply succeeds; verify its live state in /nexus/automations or via dex agents get <id>.
4. Validate the first run safely
Section titled “4. Validate the first run safely”- Personal automations — Trigger a manual run (
Run now) and inspect the transcript and any Pending Action cards in/nexus/inbox. - Shared automations — Do not click Admin
Run nowjust to test an unproven edit (that dispatches to every live member or runs the live coordinator). Preview withdex factory preview, validate on a dry run or your own member run first, and keeprequireWriteApproval: trueuntil outputs are consistently accurate.
Pausing or stopping an automation
Section titled “Pausing or stopping an automation”To pause an automation without deleting it, set enabled: false in automations/<name>.md, commit, preview, and push. On a shared agent, individual teammates can pause only themselves with dex agents off <id> without affecting the rest of the team.
Related pages
Section titled “Related pages”- Triggers - Cron, datetime, event, and manual trigger formats
- Runs and troubleshooting - Inspecting run logs and resolving skipped/failed runs
- Factory definition as code - Complete
AGENT.mdandautomations/*.mdreference - Runs, dry runs, and self-improvement - Validating edits with dry runs and feedback