# Run a task

> For the complete documentation index, see [llms.txt](https://www.jetbrains.com/help/air/llms.txt).

A Air Teams task runs in a cloud environment instead of on your machine. Start it in the browser at [https://air.jetbrains.cloud](https://air.jetbrains.cloud), from an IntelliJ-based IDE, or from the Air app.

## What happens to your changes

A cloud environment has a limited lifetime. Air Teams suspends it after a period of inactivity and archives the task a day later, so nothing that lives only inside the environment is safe. To make the result durable, Air Teams doesn't wait for you: it commits what the agent produced to a separate task branch and pushes that branch to the remote repository.

This happens after every agent turn, not once at the end. A task you send back twice with feedback leaves three commits on its branch. Nothing is staged for you to accept, and nothing is left uncommitted for you to review before it lands – by the time you open the task, the change is already on the server.

What this leaves you is review and iteration. You read the result, comment on it, and let the agent answer – which adds another commit – until the branch is what you want. Then you [open a pull request](create-a-pull-request.html) from it.

```PLANTUML
            
@startuml
skinparam shadowing false
skinparam defaultTextAlignment center

cloud "Remote repository" as remote
node "Cloud environment" {
  rectangle "Agent" as agent
  rectangle "Task branch\nair/<task>" as branch
}

remote ..> branch : " (1) Air clones the repo\nand creates a task branch"
agent --> branch : " (2) the agent edits files  "
branch --> remote : " (3) Air commits and pushes\nafter every agent turn"
remote --> remote : " (4) you create a\npull request"
@enduml
            
```

### Edits you make yourself

Files you add or change by hand aren't part of that. They stay uncommitted, and you commit them yourself from the [Changes](changes.html) tool.

Do that before you send the next prompt. The agent's next commit takes everything in the working tree, so your edits go in with the agent's under the agent's commit message if you leave them uncommitted.

## Before you start

You can start with the default cloud environment, but for many projects it is useful to configure the environment first.

* To run tasks in the browser, you must first configure a repository connection. Without it, you cannot select a repository. [Learn how to connect repositories](connect-repositories.html).

* If your project needs specific dependencies, environment variables, secrets, or integrations, create an environment configuration for the repository in advance. [Learn how to configure environments](configure-environments.html).

## 1. Start the task

You can start a task in the browser or from the Air app.

From the web:

Procedure: Run a cloud task from the browser

1. Log in to [https://air.jetbrains.cloud](https://air.jetbrains.cloud) with your JetBrains Account.

2. On the New Task page, select an environment or a repository, and a branch. Selecting an environment runs the task with that configuration; selecting a repository uses the default environment.

![The New Task selector open, listing environment configurations under Environments and repositories under Repositories](images/airc-new-task-select-environment.png)

3. Choose the agent, the model and its effort level, and the permission mode.

The agent is fixed once the task starts, so this is the point to get it right. See [Set up a task before you
send it](work-in-the-browser.html#new_task_page).

4. Enter your task prompt and send the task.

5. After the task starts, it appears in the left pane.

![A started task shown in the left pane of Air Teams](images/airteam-started-task.png)

From the Air app:

Procedure: Run a cloud task from the Air app

1. Open your project in the Air app.

2. Start creating a new task.

3. In the task run environment selector, choose Cloud.

![The run environment selector in the Air app with Cloud selected](images/airteam-run-task-from-app.png)

4. Enter your task prompt and send the task.

## 2. Review the result and iterate

Open the task to see what the agent did. In the browser, this loads the Air Teams editor into the page, so you get the changed files, the diff, and code navigation alongside the conversation – see [Work on a running task](work-in-the-browser.html#task_editor).

Procedure: Review a cloud task

1. Open the task and read the agent's conversation and the diff.

2. Leave your feedback where it belongs in the code: select a line and use Add Comment for Selection, or send a fragment to the task with Add to Task.

You can also add context the agent didn't have: type `@` and reference files, folders, branches, commits, or the local changes.

3. Send the feedback.

The agent works on it and Air Teams commits the answer to the task branch, so each round of feedback adds a commit.

4. Repeat until the branch is what you want.

There is no built-in review pass in the browser. If the agent you selected ships a review command or skill, run it from the slash menu – type `/` in the task input. The Air app has [review with agent](agentic-review.html) built in, with its own review prompt and the option to review with a different agent than the one that wrote the code.

## 3. Create a pull request

The task branch is already pushed, so the last step is to open a pull request from it – see [Create a pull request](create-a-pull-request.html).

## Run cloud tasks from IntelliJ-based IDEs

You can start a cloud task from the [AI Assistant](https://www.jetbrains.com/help/ai-assistant/about-ai-assistant.html) plugin in your IntelliJ-based IDE. This lets you stay in the IDE while the task runs in the cloud. You can monitor the task execution in Air Teams in the Tasks tool. You can also open your account page at [air.jetbrains.cloud](https://air.jetbrains.cloud/) to see your running tasks.

Procedure: Run a cloud task in an IntelliJ-based IDE

1. In your IntelliJ-based IDE (for example, IntelliJ IDEA), open AI Chat.

2. If the agent supports remote runs, a panel with a switcher for running it in the cloud appears. Switch to Cloud mode.

![AI Assistant with the JetBrains Cloud agent selected](images/ai-assistant-cloud-agent.png)

3. If you run the cloud task for this repository for the first time, the plugin prompts you to authorize the [JetBrains Air](source-control.html) connection app to access your repository.

4. Select a branch and a model to run the task.

5. Type a task and click Send.

The agent runs in the cloud and writes its changes to a separate branch. When it finishes, you can review results by clicking View Commits and merge the changes into your working branch by clicking Merge.

Alternatively, click Open in JetBrains Cloud to open [air.jetbrains.cloud](https://air.jetbrains.cloud/) for monitoring your tasks in the web interface. If the task hasn't started yet, the link takes you to the New Task page instead – see [The task link from the IDE
opens the New Task page](troubleshoot-cloud-tasks.html#task_not_started_yet).

For more details, refer to the [JetBrains AI Assistant documentation](https://www.jetbrains.com/help/ai-assistant/cloud-agents.html).

## Resume a suspended task

After 75 minutes of inactivity, Air Teams suspends the task's cloud environment and marks the task Suspended. Your results are safe on the task branch, and you can start the environment again while the task stays suspended.

Procedure: Resume a suspended task

1. Open the suspended cloud task.

2. Click Resume. Air Teams starts the environment again, and you can continue reviewing or working on the task.

The environment returns as it was, with the working tree, installed packages, and caches. Running processes are the exception, so restart servers, watchers, and anything else the task had running. See [Snapshots and preserved state](tasks.html#state_between_runs).

You can resume a task only while it stays suspended. After 24 hours of inactivity, Air Teams archives the task – you can still open it to view the chat history, but Resume is no longer available, because the environment can't be restarted. Your results remain on the task branch. See [Cloud environment lifecycle](tasks.html#cloud-environment-lifecycle).

