Hello,
Your Agilus should have a number of digital outputs on its axis 4 (the connector where you screw off the cap). At least the valves (which are right next to it) are in my experience preconfigured, so you can just put a multimeter there and try out the first couple of digital outputs (Display/Outputs on the smartPAD) until you see a change in voltage.
The proper way to do it would be first look into the KRC4 compact controller. Inside there is probably an EtherCAT coupler like that:
http://www.beckhoff.com/images/EtherCAT/EK1100__web.jpgOn the right side of the coupler you can add modules with inputs or outputs. Chances are good that there is already at least one installed. They each have got a number like EL2808 - go to the
beckhoff.com homepage and try to find the one that gives you digital outputs, like e.g. that one:
http://download.beckhoff.com/download/Document/Catalog/Main_Catalog/english/separate-pages/EtherCAT/EL2808.pdfAs the next step, you have to configure the robot in a way so that he knows that when you switch the output 33 (or any number) you actually want to switch the third (or whatever) output of the Beckhoff terminal.
This configuration is done within the KUKA WorkVisual software (which is included with every robot). Do you have someone who knows how to use WorkVisual?
Before going into WorkVisual it makes sense just to try the first 20 or so digital outputs and see if something happens. Maybe whoever set up the robot already configured some outputs. Every Beckhoff terminal has got a number of signal LEDs on top that light up when the IO is on.
The standard Beckhoff digital output provides 0.5A at 24V which should be (more than!) enough for most LEDs. It probably still makes sense to use a relay, though.
On the KUKA|prc side it's easy, you just use the Digital Output component or - if you're using the trial version - write the code as you described into a Custom KRL Component.
Hope that helps!
Best,
Johannes