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

# task - Background Tasks & Approvals

> Hand work to an agent in the background and follow it on a board. Set per task where it stops for your approval, and get results and approvals in Feishu or another chat.

Background tasks free the agent from working step by step inside a conversation. Once the goal is clear it works on its own in the background, while you keep chatting about something else or close the page, and it tells you when it is done or needs a decision. Each task can have **approval points**: write in one sentence where it should check with you, and the agent stops there to ask.

## Settings

The board, tasks added on it and scheduled runs handed to it need nothing turned on. The settings button at the right end of the tabs under Tasks → Board adjusts two things, applied as soon as they are saved:

| Setting | Default | Description |
| - | - | - |
| Create tasks from chat (`chat_create`) | on | Off, conversations can no longer create background tasks but can still check, follow up and stop existing ones; tasks added on the board and scheduled runs are unaffected |
| Tasks running at once (`max_concurrency`) | `5` | Background tasks that run at the same time (1–99); the rest wait in the queue. Scheduled tasks don't count |

Both can also be set in `config.json`, along with one setting that lives only there:

```json theme={null}
{
  "task": {
    "chat_create": true,
    "max_concurrency": 5,
    "notify_webhook": ""
  }
}
```

| Key | Default | Description |
| - | - | - |
| `notify_webhook` | empty | Optional. A JSON notice is POSTed here when something awaits approval, or a task finishes or fails |

## Creating tasks

There are three ways in:

* **From the board**: click **New task** under Tasks → Board and describe the work. You can pick the agent, the model, the chat to notify, and the approval points (see below).
* **From a schedule**: scheduled tasks of the "Agent task" type run as background tasks when they fire and appear on the board. They start on time without taking a concurrency slot, and results still go to the receiver the schedule is configured with, images and files included. A firing is skipped while the previous run of the same schedule is still going. If the task says to check with you before a step, the run asks for approval there too.
* **From a conversation**: say so explicitly, e.g. "do this in the background" or "let me know when it's done". The agent creates the task with the `task` tool, replies right away and leaves the conversation free. It only does this when you ask; ordinary requests are still handled in the conversation. You can add "show me the PR list before merging", "ask me before pushing", "send the result to the Feishu product group" or "run it on claude-sonnet-5" and the agent sets the task's approval points, target and model that way. The first few times, the reply adds a hint: reply "do it now" if you didn't need it in the background, and the agent stops the task and does the work in the chat.

## Splitting a task

When a task covers a batch of independent items (each pull request, each issue, each email), say so in its brief, e.g. "split each PR into a task of its own". While it runs, the Agent uses the `task` tool to create one task per item. Each runs, asks for approval and reports on its own, and can be followed up or rerun from its own detail page.

* **No duplicates**: each item is split off with a key such as `github:owner/repo#123`. If that key already has a task, the existing task is returned instead of a new one, so a schedule going over the same PRs every time only creates tasks for new ones. To review a PR again after new commits, put the version in the key, e.g. `github:owner/repo#123@<commit sha>`. Once a task is deleted, its key can be used again.
* **Model**: a task runs on its Agent's own model unless it names another one, picked when creating it on the board or written in the brief, e.g. "split each PR into a task of its own and run them on claude-sonnet-5". Split-off tasks keep the parent's model unless told otherwise. A model that is not set up, misspelled or failing falls back to the Agent's own.
* **Each reports its own result**: split-off tasks keep the parent's Agent and notify target. Those split off by a scheduled task send their results to the schedule's receiver (and stay quiet if the schedule is quiet). They don't count as the schedule's previous run, so they never hold back its next firing.
* **Limits**: one task can split off at most 20 tasks, and those cannot split again. Inside a background task, the `task` tool can only split; it cannot stop or change other tasks.

On the board, split-off tasks show **Split** as their source and their detail page links back to the task they came from. The parent's detail page lists every task it split off with its status.

## Managing tasks from a conversation

The conversation is where you talk; the tasks are where the work runs. The agent can look up this conversation's background tasks and their status at any time (unfinished ones, plus those finished in the last 6 hours), so just say what you want:

| You say | The agent |
| - | - |
| "How far along is the report?" "Did that one work?" | Answers, looking up the steps, the result or the reason it failed when needed |
| "Add a chart to #3" | Passes it on to task #3: a running task takes it after its current step, and a finished one carries on with its full context |
| "Stop the report task" | Stops that task |
| "Delete #3" | Deletes the task and its record (only when you say delete) |

The agent does not redo a task's work in the chat or create a second task for the same work, and asks when it is unclear which task you mean. A conversation only sees and manages the tasks started from it; a console chat can manage every task on the board. Background runs of scheduled tasks can be checked and stopped; to change what future runs do, edit the schedule itself.

## The board

The **Board** tab of the Tasks page has five columns:

| Column | Meaning |
| - | - |
| Queued | Waiting for a free slot |
| Running | In progress, with the time spent so far |
| Needs you | Waiting for you to approve an action |
| Done | The result can be read and copied on the task page |
| Failed / stopped | Shows why it failed; run it again with one click. A run that uses up the step limit (`agent_max_steps`) before finishing counts as failed too; where it stopped is its last reply, adding instructions carries it on, and a link under the reason opens the Max Steps setting |

Click a card to open the task's page (at `/task/<id>`, so it can be bookmarked or shared with others using the same console). It reads like a ticket:

* **Under the title** is the task itself, what the agent was asked to do; a long one is folded and can be expanded.
* **Below is the activity**, in order: each round's reply from the agent, the instructions you added, every approval (what was asked, who handled it where, and their note), and why it failed or stopped. Each reply's trace (thinking, tool calls and output) is folded; click "Trace" to open it. While the task runs it opens by itself and updates live. Once the task is done, the last reply is marked "Result" and can be copied in one click.
* **On the right** are the task's properties: status, agent, source, duration, plus "Notify" and "Approval points", which can be changed at any time and are saved and applied at once.

Stop, rerun and delete are at the top of the page.

The box at the bottom of the page adds to the task at any time:

* **Running**: the instruction takes effect after the current step, without stopping the task.
* **Queued / waiting for approval**: the instruction is passed along when the run starts or once the approval is handled.
* **Done / failed / stopped**: the task carries on with its full context. For a task that came from a schedule, the follow-up result is read on the board and is not sent to the schedule's receiver again.

**Rerun** instead clears the execution log and starts over from the original task.

## Approval points

Approval points decide where a task stops to wait for you. With none, the task runs to the end without asking. When creating a task or on its page, write in one sentence where to check with you and click **Add**, e.g. "once you have the PRs to merge, show me the list first" or "show me the draft before sending the email".

When the agent gets there it calls the `request_approval` tool with what you need to decide (what it found, what it plans, the options) and waits. Approve and it goes on as planned; reject with a note and it adjusts to the note.

Approval points can be added or removed at any time and apply at once. The agent only asks you through approvals; it does not reach you by messages, email, command-line tools or other bots instead. Ordinary conversations are not affected.

> [!NOTE]
>
> The agent stops at an approval point on its own, following your words, so they suit steps like "show me before you go on". What a task is allowed to do at all (running commands, which files it may write) is set by the agent's permission mode; a task created from a conversation keeps that conversation's mode.

## Notify

Each task can choose where its result and approvals go, in two steps:

1. **The bot**: "Console only", or one of the chat bots running now (Feishu, DingTalk, Telegram and so on, named as the bot is named on that platform). API-style channels (such as the OpenAI-compatible API) and bots that are not running are not listed.
2. **Who to send to**: the chats that bot has had, direct or group, most recently active first. Picking a bot selects its most recent direct chat.

If the chat you want is missing, message the bot there once and refresh. With "Console only", read results and approvals on the board and in the inbox; a task created from a console chat sends its result back to that chat.

A task created from an IM chat reports back there by default. When the target changes, approvals still pending move to the new chat and are sent there again. The board remembers your last choice for new tasks.

## Handling approvals

When something needs you, the inbox at the top right of the console shows a count; open it to handle items. Approval cards also appear in the task page's activity.

When a task finishes or fails, including one a schedule started, its result also lands under **New results** in the inbox. Open one to go to its task page, which marks it read, or click **Mark all read**. Results from the last 7 days are listed; tasks set to the silent notify level stay out.

* **Approve**: the agent goes on as planned. A note, if you add one, goes to the agent too.
* **Pick an option**: when there is more than one way to go on, the agent lists them as buttons, recommended first, in place of Approve. The agent goes on with the one you pick; a note goes along too.
* **Reject** takes an optional reason. The agent receives it and changes course instead of going ahead as planned.

The note box may also say what the agent would like to hear, e.g. "Anything to change in the comment?".

**Feishu** receives an approval card with the task, what needs confirming and the agent's explanation. Add a note if you like and tap a button; the card then shows the outcome. Only the chat the card was sent to can use it.

* Sending the card uses the bot's permission to send messages; nothing extra is needed.
* The buttons need **Card Action Trigger** (`card.action.trigger`) added under **Events & Callbacks → Callbacks** in the Feishu app, see [Feishu channel setup](https://docs.cowagent.ai/channels/feishu.md). Without it the buttons do nothing; the bottom of the card says how to reply in text instead.
* Chat and bot names are read with the `im:chat:readonly` and `contact:user.base:readonly` permissions. Without them chats show as "direct" or "group", which does not affect anything else.
* If the card cannot be sent, a text notice is sent instead.

WeChat, DingTalk and other channels receive a text notice; just reply:

```
approve 3
reject 3 don't push yet, let me check first
```

When the approval has options, the text notice numbers them: reply "approve 3 option 2" for the second, while "approve 3" alone picks the first.

"approve" and "reject" can leave out the number when only one item is pending. On WeChat and Feishu you can also quote the approval message and reply. An approval can only be handled from the chat it was sent to.

## Results and notices

* Results of tasks created on the board are read on the board, and the browser shows a notification (task notifications must be on in the console). To follow up or ask for changes, add to the task from its detail.
* A task created from a conversation sends its result back to that conversation and adds it to the conversation's context, so you can ask follow-up questions. In a console chat, the reply that started the task ends with a card for it, and the result shows **Background task #N** at the top of the bubble; click either to open the task's detail.
* When a schedule created in a console chat runs as a board task, its message in that chat shows **Scheduled task #N** at the top of the bubble; click it to open that run on the board.
* A task set to notify an IM chat sends its result there and adds it to that chat's context.
* On WeChat and Feishu you can also **quote** a task's done or failed message in your reply: the agent knows which task you mean and passes changes or additions on to it, and the task carries on with its full context and sends the new result back; a question about the result is simply answered.
* With `notify_webhook` set, a JSON notice is posted for pending approvals (`approval_pending`), finished tasks (`task_done`) and failures (`task_failed`). Background runs of scheduled tasks only post the events that need you, plus failures.

```json theme={null}
{
  "event": "approval_pending",
  "task_id": 12,
  "approval_id": 3,
  "title": "Weekly issue report",
  "text": "[Approval #3] Task #12 \"Weekly issue report\" wants to: Push code\nAction: bash  git push origin main\nReply \"approve 3\" or \"reject 3 <reason>\""
}
```

> [!TIP]
>
> Background tasks run in their own sessions, so they do not appear in the conversation list or trigger self-evolution. Tasks that were running when the service stopped carry on first after the next start, checking what was already done so external actions are not repeated. Tasks you followed up or decided on also go ahead of new ones.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.