# Server Agent

The **Server Agent** is responsible for the execution of scheduled tasks and data alerts, as well as sending e-mail messages.

It runs its tasks on multiple worker threads to optimize execution performance. The **Server Agent** communicates with the Report Server Manager through the [SignalR](https://en.wikipedia.org/wiki/SignalR) technology to allow fast and reliable two-way communication.

![Server Agents Configuration page with one agent created.](https://www.telerik.com/report-server/documentation/assets/75f8287595cb57a82fa35362ea21457a/created-server-agent-view.png)

## Worker Count

This is the total number of threads that will be used when executing scheduled tasks and data alerts. By default, the worker thread count is equal to 0.

This value means that the Worker Count will match the count of the *available* logical processors on the agent machine.

## Queued Tasks

A queued task represents a Scheduled task or Data alert that is currently being executed by any Server Agent. It allows canceling the execution of a selected task.

The table displays the name of the Scheduled task or Data Alert, the target Server Agent, and when was the task scheduled for execution.

![The Queued Tasks Grid with one task scheduled for execution.](https://www.telerik.com/report-server/documentation/assets/22486da8bd390ce70310a94ff2ab9436/queued-tasks-grid-server-agent.png)

## Creating Server Agents on Windows

1. Open the Report Server Manager(by default - [http://localhost:81](http://localhost:81/)), and then open the **Configuration** page.

2. Click on the **SERVER AGENT** tab and start the creation of a new Server Agent by pressing the **CONFIGURE NEW AGENT** button.

3. In the pop-up window with title **Configure New Agent**, enter the Report Server base URL or [http://telerik-report-server](http://telerik-report-server/). This should automatically route to the Report Server Manager application.

   ![Configuring a new Server Agent in the Report Server for .NET - Step 1](https://www.telerik.com/report-server/documentation/assets/d804ed868d6dbc51c39df0609d9a7929/configure-new-agent-step1.png)

4. Press the **GENERATE CONFIGURATION** pop-up and copy the JSON-based configuration from the **APPSETTINGS.JSON** tab:

   ![Configuring a new Server Agent in the Report Server for .NET - Step 2](https://www.telerik.com/report-server/documentation/assets/1c510d9791e3e801feb6d9d938a87ab4/configure-new-agent-step2-json.png)

   The Report Server has generated a configuration containing the server address, authentication token, and ID of the new Server Agent.

5. Navigate to the `C:\Program Files (x86)\Progress\Telerik Report Server .NET\Services\` folder and open the `appsettings.json` file in a text editor of choice.

6. Paste the JSON-based Server Agent configuration in the file:

   ```JSON
   "Agent": {
   	"ServerAddress": "http://localhost:82",
   	"AuthenticationToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
   	"Id": "f4093cf0-c259-4642-a8f2-cb314d00ee88"
   }
   ```

## Creating Server Agents in Linux Containers

> important The Report Server for .NET should be completely set and configured before adding Server Agents - [Installing ReportServer.NET on Docker Container](https://www.telerik.com/report-server/documentation/dotnet-docs/installation/docker-installation).

1. Open the Report Server Manager(by default - [http://localhost:82](http://localhost:82/)), and then open the **Configuration** page.

2. Click on the **SERVER AGENT** tab and start the creation of a new Server Agent by pressing the **CONFIGURE NEW AGENT** button.

3. In the pop-up window with title **Configure New Agent**, enter the Report Server base URL or [http://telerik-report-server](http://telerik-report-server/). This should automatically route to the Report Server Manager application.

   ![Configuring a new Server Agent in the Report Server for .NET - Step 1](https://www.telerik.com/report-server/documentation/assets/d804ed868d6dbc51c39df0609d9a7929/configure-new-agent-step1.png)

4. Press the **GENERATE CONFIGURATION** pop-up and copy the tokens from the **ENVIRONMENT VARIABLES** tab:

   ![Configuring a new Server Agent in the Report Server for .NET - Step 2](https://www.telerik.com/report-server/documentation/assets/49681cd70835b2a1c0fae6af170b288e/configure-new-agent-step2.png)

5. Open the `\ReportServer\docker-configs\docker-compose.yml` file in a text editor again, and uncomment the section with the `telerik-report-server-agent` element. This section should be present by default in the file and it looks as follows:

   ```yml
   telerik-report-server-agent:
     environment:
       - Agent__ServerAddress=http://telerik-report-server
       - Agent__AuthenticationToken=PASTE_THE_AGENT_AUTH_TOKEN_HERE
       - Agent__Id=PASTE_THE_AGENT_ID_HERE
     image: telerik-report-server-agent:local
     restart: always
     command: dockerize -wait tcp://telerik-report-server:80 -timeout 1200s
   ```

6. Run the command `docker stack deploy -c docker-compose.yml report-server` to re-deploy with the updated `docker-compose.yml`.

7. Open the **Configuration** page with the Server Agents again, now there should be one agent visible in the Server Agents table in the middle of the page:

   ![Server Agents Configuration page with one agent created](https://www.telerik.com/report-server/documentation/assets/75f8287595cb57a82fa35362ea21457a/created-server-agent-view.png)
