# Assigning tests to an Endpoint Agent

Both Endpoint Agent and Endpoint Pulse can run a combination of multiple Scheduled and Dynamic Tests at a time. This number varies as per the license type of the agent. You can learn more about license types [here](https://docs.thousandeyes.com/product-documentation/global-vantage-points/endpoint-agents/endpoint-agent-licensing). However, you can assign more than 10 tests to an agent.

{% hint style="info" %}
You cannot assign a test to more than 150000 agents.
{% endhint %}

In case, more than 10 tests are assigned to an agent, the platform works on a mechanism that decides which tests should run on a given agent. For every agent, this mechanism runs at every check-in (10 minutes), or earlier, if the agent is connected to the WebSocket. Now, all enabled tests associated with the agent are gathered and sorted to determine which tests will run on the agent. To sort the tests, the following cascading (moving down to the next one if there is a tie) list of strategies is used to compare the tests:

1. Test priority is defined in the user interface (if toggled the task has higher precedence).
2. Type of test (from highest to lowest precedence)

* Test targeting this agent directly.
* Test targeting this agent through a label.
* Test targeting all agents.

3. Tests already assigned to the agent have higher precedence.
4. A tie-breaker (more details below).

**The tie-breaker**

Imagine a scenario with 20 enabled tests, all using the same priority and type. Based on the above strategy, they all have an equal chance of being assigned to an agent. To determine which 10 tests would be assigned to an agent, the mechanism randomly spreads the tests to all agents, while maintaining a deterministic and consistent behavior per agent. For example, the scenario could have the following spread:

* Agent1: Test# - \[1,3,5,7,9,12,14,16,18,20]
* Agent2: Test# - \[2,4,6,8,10,11,13,15,17,19]

{% hint style="info" %}
In the case of dynamic tests, there is an additional constraint that an agent can only run a test for a given application once. If multiple dynamic tests exist for the same application, the relevant test is picked according to the priority system mentioned above. If there are two application tests at the same priority level, then one of them gets picked at random. However, this choice will be consistent for a given agent (no flapping behavior). For example, consider the following scenario:

Here, agent1 may run the tests 3 and 1, and agent2 may run tests 3 and 2.
{% endhint %}

| TestID | Application | Target            |
| ------ | ----------- | ----------------- |
| 1      | Webex       | all agents        |
| 2      | Webex       | all agents        |
| 3      | Zoom        | \[agent1, agent2] |
| 4      | Zoom        | all agents        |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.thousandeyes.com/product-documentation/global-vantage-points/endpoint-agents/assign_tests_to_agents.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
