System Service Agent
This tutorial assumes you are familiar with setting up a delivery service agent.
The delivery service agent used an agent-specific variable for its SOURCE
which limits its utility if the service is general enough that an agent of this type would be desirable in multiple systems, as a copy of the agent would need the variable editing manually each time.
Another risk in using agent-specific variables is that if multiple agents depend on a single fleet then if that fleet is destroyed then every agent must be editted to point to its replacement. Instead a system-specific variable could be used to quickly designate a new source.
System Variables
For this class of agent, a fixed product source will be used as before, but dependent on the system. First we define the variable name and type by opening either a System Info Window or the Faction View and navigating to the Variables tab.

Unlike agent-local variables, setting up system-specific variables is a two-stage process where the variable needs to be first defined, and can then be set for individual systems, or even globally from the faction window. Global definitions can be useful if you have a small number of key fleets handling specific services, such as being a source for rare resources or performing research. Global variables are beyond the scope of this tutorial, but their application is almost identical.
Adding a new variable definition is identical to adding a local variable to an agent. Simply click the add icon and choose a name and type for the variable.

To set a value for a specific system go to the System Info Window and switch to the Values tab. Click the add icon and select the desired variable definition.

Now the variable definition visible in the system it can be pointed at a specific fleet as before by clicking the cog icon.


Behaviours
From the behaviours tab and create new Collect and Idle behaviours in the same manner as for the delivery service agent, except using a system variable rather than an agent variable

Using a system variable needs a reference to the system to take the variable from. Typically this will just be the local system the fleet is in, so the keyword local
can be used. In theory system variables could be used to provide a simulation of regional variables where agents refer to a variable defined in a primary system within a particular region.

The precondition can also be set referring to the system variable in a similar manner.
Service
The service can be defined exactly as for the delivery service agent.