---
title: "Tasks"
id: "1698"
type: "page"
slug: "tasks"
published_at: "2026-09-20T19:50:18+00:00"
modified_at: "2026-09-21T01:36:28+00:00"
url: "https://xedant.com/agents/agent/docs/tasks"
markdown_url: "https://xedant.com/agents/agent/docs/tasks.md"
excerpt: "Tasks are automated scenarios that Xedant Agent runs on its own, without you: on a…"
---

# Tasks

[https://xedant.com/agents/agent/docs/tasks.md](https://xedant.com/agents/agent/docs/tasks.md)

Tasks are automated scenarios that Xedant Agent runs on its own, without you: on a schedule, after a script, or when a condition is met. A typical example: every day at nine in the morning, collect fresh data, hand it to the AI for analysis, and send the finished report to your Telegram.

Tasks live in the `.xedant/tasks.yml` file and are managed from the interface: the **Tasks** dialog (open it from Settings → “Scheduled Tasks”) shows the list of your tasks, their run logs, and the editor.

## What a task is made of

- **Schedule** — days of the week and start times (for example, “Mon–Fri at 09:00”), in any time zone. The scheduler checks schedules every 30 seconds;
- **Script** — an optional command (shell or python) that runs before the AI: collect data, run tests, make a backup, pull fresh commits;
- **Chat condition** — when the AI should step in: always, only when the script fails, when the output is not empty, or when it matches a trigger phrase (for example, “ERROR”);
- **AI chat** — the model, skill, and prompt. The AI receives the script output (the path to the log file is added automatically), analyzes it following your prompt, and answers in a regular agent chat;
- **Bot link** — the name of a Telegram bot from the “Bots” section: the task’s new chat is bound to the bot, and its replies, together with your follow-up questions, arrive through Telegram.

## How it works

The scheduler runs in the background as a separate service. On the assigned day and time it runs the task step by step:

1. The script runs first (if one is set) under a timeout — for example, `python3 scripts/collect.py`;
2. The script’s result is checked against the condition: on an error, empty output, or a trigger match, the task either stops or is handed to the AI — whichever way you configured it;
3. If the condition is met, a chat is created with the chosen model and skill, and the task’s prompt (plus the path to the script log) is sent to the AI;
4. If the task names a bot, the chat is bound to that Telegram bot: the AI’s reply arrives in your Telegram, and you can keep the conversation right there, asking follow-up questions;
5. Every run is written to the log: the time, the trigger, whether it succeeded, the script’s exit code, and a link to the created chat.

Missed runs (for example, the agent was off at the scheduled time) are never caught up — the task simply runs again at the next scheduled time.

## Examples of tasks and bots together

Things get truly interesting when a task not only runs on its own but is also linked to a Telegram bot. Here are a few working scenarios:

- **Daily report** — in the evening a script collects the day’s data (sales, traffic, metrics), the AI writes a short summary with conclusions from your prompt, and the bot delivers it to your Telegram. You can ask the bot right away — “why did sales drop?” — and continue the conversation with the same data;
- **Overnight build check** — at 6 a.m. the project builds; if the build breaks, the AI reads the log, finds the error, and suggests a fix; the bot wakes you with just that message, not with the noise of the whole log;
- **Trigger monitoring** — a script checks your site or database every 15 minutes; the AI joins only when a trigger matches (for example, the word “ERROR” or an uptime drop), analyzes the problem, and sends a report to Telegram;
- **Commit digest** — in the morning a script pulls yesterday’s commits from all branches, the AI groups them by topic, and a shared bot sends the team a clear summary;
- **Backups** — a script dumps the database and copies it to the cloud; a Telegram message arrives only on failure (the “nonzero-exit” condition), so it never disturbs you without a reason.

One detail makes all these scenarios work: the AI’s reply does not go “nowhere” — it lands in the bound chat, and you can keep the conversation while the task is still relevant. That is why it pays to combine a script (the data), the AI (the analysis), and a bot (delivery and conversation) in one task.

## Run log

Every task keeps a history of its recent runs: when and why it fired, whether it succeeded, what exit code the script returned, whether the timeout was exceeded, and which chat was created. From the log you can open the task’s chat right away and see exactly what the AI did. Script output is kept for 7 days.

## Creating a task

Open the **Tasks** dialog from Settings → “Scheduled Tasks” and click “New Task”. Fill in:

- **Title** — for example, “Morning digest”;
- **Schedule** — days of the week and times (every task needs at least one schedule entry; to run a task only by hand, disable it and use the “Run now” button);
- **Script** — shell or python, a path relative to the project root, and a timeout in minutes;
- **Prompt for the AI** — what to do with the data: “analyze the sales and write down the conclusions”;
- **Model and skill** — from your model list (plus, when needed, a skill the AI loads before starting work);
- **Chat condition** — always / only on failure / on non-empty output / on a trigger phrase;
- **Bot** — the Telegram bot the task’s chat will be bound to (optional).

## What else tasks can do

- **Several runs per day** — a schedule can list any number of times (for example, 09:00 and 18:00);
- **Time zone** — each task picks its own; by default, the server’s time zone;
- **Manual run** — any task can be run right now with one click, outside its schedule;
- **Log** — a history of runs with their triggers and outcomes;
- **Enable and disable** — tasks can be turned off without deleting their configuration;
- **Configuration file** — `tasks.yml` lives in the project folder, so task settings are versioned in Git and travel between servers.

## What’s next

To have tasks deliver their results to Telegram, first set up a bot — see [Bots](/agents/agent/docs/bots)
. More about choosing models — [Models](/agents/agent/docs/models)
.

**← Back:** [Settings](/agents/agent/docs/settings)

**Next:** [Bots](/agents/agent/docs/bots)
 →
