> AI agents: For documentation discovery and navigation, see [llms.txt](/llms.txt).
# Tutorial: Continue a cloud agent session in your terminal
Start an agent task in Visual Studio Code, close the application, and continue the same conversation from GitHub Copilot CLI in a regular terminal. The agent runs in a managed cloud environment, so your development machine doesn't need to stay online for the task to run.
In this tutorial, you ask an agent to explore one of your private repositories and suggest improvements. Then you connect from your terminal and turn one suggestion into an implementation plan without repeating the repository context. You don't need to clone the repository, install its dependencies, or change any code.
If you haven't worked with agents before, start with the [agents quickstart](/docs/agents/quickstart.md).
## Prerequisites
* [Install VS Code](/download) and [set up GitHub Copilot](/docs/setup/copilot.md).
* Use a GitHub account with access to cloud sessions. Availability depends on your account and organization.
* Have an existing repository on GitHub.com.
* Ensure the `setting(chat.agentHost.cloudSandbox.enabled)` setting is on in VS Code.
* [Install the latest Copilot CLI](https://docs.github.com/en/copilot/how-tos/copilot-cli/set-up-copilot-cli/install-copilot-cli). Choose a native installation option if you don't already have Node.js. Your account and organization must allow CLI access and cloud connections.
> [!NOTE]
> Requests use your Copilot plan's allowance. Review [AI credits and model costs](/docs/agents/concepts/language-models.md#ai-credits-and-model-costs) before starting.
## 1. Choose a repository
Choose a repository from your own projects that is available for cloud sessions. Pick a small project or focus on one feature to keep the exploration manageable.
The task only reads repository files and returns its findings in the conversation. You don't need to install dependencies or run the project for this walkthrough.
The cloud session works with the code available on GitHub.com. Uncommitted changes, local dependencies, and files that exist only on your computer aren't copied to the cloud environment.
## 2. Start the task in a cloud session
A cloud session provides an isolated environment for the agent to explore the repository without affecting your local setup. It runs on GitHub's infrastructure.
1. In VS Code, select **Open in Agents** in the title bar to open the Agents window.
1. Select **New** to start a session.
1. Choose the **Cloud** environment from the environment dropdown, then select **Work in Repository** from the workspace dropdown, and choose your private repository.

1. Keep other options at their defaults.
1. Enter the following prompt:
```prompt
Explore this repository to help me understand where to make a small contribution.
1. Summarize the project's purpose and main directories.
2. Trace one main feature from its entry point or data source to its output.
3. Suggest three small improvements, numbered so I can refer to them later.
Cite the relevant file paths for the explanation and each suggestion.
Don't edit files, install dependencies, execute project code, or create
issues or pull requests. Return your findings in this conversation.
```
To focus the exploration, add the name of a feature you're interested in and ask the agent to trace how it works.
1. Wait for the cloud environment to connect and for the agent to start working. Review any approval requests before accepting them.
1. Note the session title so you can recognize it in the CLI, then close the VS Code application.
This task starts in the cloud. Connecting from another app doesn't move a local session or upload a local workspace. Because a cloud session runs on the remote cloud infrastructure, it is independent of your local application state. Closing the application doesn't stop cloud execution.
## 3. Continue in the Copilot CLI
You can connect and interact with Copilot agents sessions from different Copilot clients. In this section, you use the Copilot CLI to continue working with the cloud session you started in VS Code. Alternatively, use another supported Copilot client, like the Copilot app.
You can use the same computer or another computer with Copilot CLI installed.
1. If you haven't signed in to the CLI, run:
```shell
copilot login
```
Sign in with the same GitHub account you used to start the cloud session.
1. Type `/sessions` to view the list of sessions. Use `kbstyle(right)` to select the **Remote** tab.
1. Choose the cloud session you started in VS Code. Match its title and repository to the task from the previous section.

1. Wait for the connection, then check that the conversation includes your repository exploration prompt and the agent's progress or findings.

1. Observe that the terminal now shows the ongoing conversation and the agent's progress. You can continue interacting with the agent as if you were in the original client.
The terminal is another client for the same session. Repository access and agent tools still run in the cloud environment, not in your terminal's current directory. You don't need a local clone.
If you already know the session ID or task ID, you can connect directly with `copilot --connect=