Is agar powder heated so that it will form a gel when it is cooled? if not then what is the purpose of boiling it?
An agar gel sets as it cools, like almost every other thermoreversible gel - including those made from gelatin, carrageenan, and various types of gellan and pectin.
One of the properties of almost any gel is that the gelling agent needs to be dispersed and then dissolved in the solution, otherwise you'd never be able to mix it - you'd just instantly get a solid lump as soon as you tried to mix it in. The particles need to be very small and the molecules fairly far apart from each other in order to work their magic.
Most substances dissolve more easily at higher temperatures. You've probably seen this with sugar if you've ever tried to make a candy or syrup. You can saturate cold water and up with... well, sugar-water, but to get a syrup (or hard candy) you need it to be supersaturated - i.e. to have a higher concentration at some temperature than would normally be possible by just mixing at that temperature.
Here is a more detailed explanation. It's due to the second law of thermodynamics, and it's a little hard to explain in simple terms; but basically, higher concentration implies lower entropy at some given temperature, and you cannot lower the entropy of an isolated system. It needs to be able to transfer that entropy to another system, and in this case it does so by dissipating heat (and to dissipate heat, it must be given heat). It's really not the best explanation - if anyone with a stronger physics/chemistry background can summarize it better in one paragraph, feel free to make an edit.
Anyway, hydrocolloids like agar and gelatin have exactly the same issue. They'll disperse in cold water, but won't dissolve. To dissolve them, you need to heat the solution first. Agar just happens to be the most dramatic because it won't dissolve at all until you reach temperatures of about 90° C. Technically you don't actually need to boil it, but it's easier to just boil than it is to try to hold it slightly below boiling. Precision isn't necessary, as long as it's at or above the dissolution (AKA hydration) temperature.
Only once these agents are properly dissolved will they exhibit any gel-forming properties. So, you need to heat them past the dissolution temperature first.
It depends on how you are using it. Most likely, as the other users suggest, you must heat it when combining with other ingredients so they bond together via the heat, and your recipe will set into a gel by chilling the mixture. For instance, if you are creating a silky gel topping - less firm (example: raspberry foam topped Prosecco), it is also best to use equipment that will do most of the work for you, such as a Cream Whipper/Siphon (iSi is top choice - best quality & durability).
In this case, the agar must be heated together with your raspberry/syrup mixture to allow all molecules to combine under heat, preventing separation.
Note: With Whippers, it's important to run any mixture except heavy cream -with or without liquid flavoring- through a fine chinois before pouring into the Whipper, because even a speck of cinnamon could get stuck in the whipper when dispensing and trust me, you don't want to see that :-)
The mixture must be allowed to chill for a few hours in order to properly set and create the texture of a silky gel - otherwise it will be too runny if dispensed before it's fully set. You can't rush the process, unfortunately, but I have found that chilling in an ice bath sets it quicker than in the fridge. I usually test after 2 hours to see if it has reached my desired consistency. If not, try another hour. Different flavors/ingredients respond differently, so there is no Universal "setting" time. Leaving the Whipper chilled for longer will not continue the solidification process any further than the amount of stabilizer you use. It can only over-solidify if your agar (or any other hydrocoilloid, ie: gelatin) ratio is off and you have used too much- I have ended up with many "jelly-like" textures for smoother, structured foams when my conversion of sheet gelatin to powder was off. (Many resources for sheet to powder ratio are available online)
Planning ahead and keeping in mind the amount of time it takes to set is crucial - especially for high volume/high demand scenarios such as an event or restaurant service, because you don't want to get stuck plating a dish that requires the gel/foam, when the mixture is not yet fully set.
Are you substituting agar for gelatin for Vegan purposes, or is this a recipe that specifically calls for agar? If substitution is the answer, there are many free online tools to assess the proper conversion amounts for gelatin substitutes, including agar and carrageen.
Test, experiment, and after a few times, it will become an innate.
I hope this helps. Great question!