> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dema.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Routines

> Schedule agents, app updates, or standalone instructions to run automatically.

<Badge color="yellow">Beta</Badge>

<Note>
  Routines is in beta and will roll out gradually over the coming weeks.
</Note>

A **routine** runs a task automatically on a daily or weekly schedule. Use routines for work that should happen consistently, such as reviewing stock every morning, updating a performance app each day, or preparing a channel summary every Monday.

Each run creates a session that you can open, review, and continue when the agent needs input.

***

## What a routine can run

When you create a routine, choose what it should schedule:

| Type                   | How it works                                                                                                                                                          | Best for                                                                  |
| ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- |
| **Agent**              | Runs one of your agents. It uses that agent's model, skills, integrations, and tool permissions. Add an optional instruction to give it a specific task on every run. | Recurring work that needs a configured agent and its resources.           |
| **App**                | Updates an app using its update setup. Add an optional instruction to refine what each update should do.                                                              | Keeping an app's data and outputs current.                                |
| **Custom instruction** | Runs a standalone prompt without creating a separate agent. Give the routine a name, instruction, and model.                                                          | A focused scheduled task that does not need its own conversational agent. |

Only apps that support background updates can be selected. If an agent is still a draft, add instructions to the agent before creating its routine.

***

## Create a routine

Go to **Agents → Routines** and select **Add**.

<Steps>
  <Step title="Choose what to schedule">
    Select an agent or app, or select **Write a custom instruction**.
  </Step>

  <Step title="Write the instruction">
    Describe what should happen on every run. The instruction is optional for an agent or app because the routine can use its existing setup.
  </Step>

  <Step title="Set the schedule">
    Choose **Daily** or **Weekly**, then select the day and time. Times follow your organization's timezone.
  </Step>

  <Step title="Review connections">
    Dema checks which integrations the task may need. Connect any missing accounts shown under **Approvals**.
  </Step>

  <Step title="Create the routine">
    Leave the status **Active** to start automatic runs, or set it to **Paused** to finish the setup without scheduling a run.
  </Step>
</Steps>

You can also create a routine from an agent's **Configuration** tab or an app's **Updates** tab. The agent or app is selected automatically when you start there.

<Note>
  The target cannot be changed after a routine is created. Create a new routine if you want to run a different agent or update a different app.
</Note>

***

## Review actions and approvals

After you create a standalone or app routine, Dema runs a setup check to identify the actions it may take. It checks again when you change what the routine should do. The check does not carry out write actions. While it runs, the routine has the **Configuring** status.

### Custom instruction routines

Open **Approvals** to control each action used by a custom instruction routine:

| Setting                  | What happens during a run                                                 |
| ------------------------ | ------------------------------------------------------------------------- |
| **Run automatically**    | The action can run without waiting for you.                               |
| **Ask before running**   | The session pauses and waits for someone to approve or reject the action. |
| **Blocked from running** | The routine cannot use the action.                                        |

### App routines

For an app routine, **Approvals** lists the actions that Dema identified during its setup check. Actions needed for the app's update are automatically allowed. If an action or connection is unavailable, follow the link in the routine to review the app or tool setup.

### Agent routines

For a routine that runs an agent, tool permissions are managed in the agent's configuration instead. Select **Managed by *agent name*** under **Approvals** to open them.

<Warning>
  Scheduled runs use the routine owner's connected accounts. Only the owner can connect a missing account for a routine.
</Warning>

***

## Monitor runs

The **Routines** page shows each routine's status, schedule, and latest activity. Use search, ownership, and status filters to find a routine, then select it to open its details.

| Status              | Meaning                                                                                                              |
| ------------------- | -------------------------------------------------------------------------------------------------------------------- |
| **Active**          | The routine is ready for its next scheduled run.                                                                     |
| **Configuring**     | Dema is checking the routine's integrations and actions.                                                             |
| **Running**         | A run is in progress.                                                                                                |
| **Paused**          | Automatic runs are turned off.                                                                                       |
| **Failing**         | Recent runs have failed. Open the latest session to investigate.                                                     |
| **Needs attention** | The routine needs a setup change or was paused automatically, for example because a connection needs to be restored. |

A dot next to a routine means its latest run needs input. Open the session to answer a question or review an approval.

Agent routines appear in the agent's **Sessions** tab. For app and custom routines, open the routine to see its recent runs. You can also select **Run now** to start a saved routine immediately.

<Info>
  If three consecutive runs fail or remain waiting for input, Dema pauses the routine automatically. Review the recent runs, fix the issue, then set the routine back to **Active**.
</Info>

***

## Manage a routine

Open a routine to change its status, instruction, schedule, or model when available. Changes to its approvals save automatically; other changes take effect when you select **Save**.

The actions menu also lets you:

* Duplicate the routine.
* Change its visibility.
* Review or restore an earlier version.
* Copy a direct link.
* Delete the routine.

Changing a routine's visibility does not change the visibility of its linked agent or app. See [Access and sharing](/guides/organization/access-and-sharing) for the general visibility rules.
