All Java agents have an attachment named ”%%source%%.jar” which contains the source of the agent in a Jar file. There is also a compiled version, with the name ”%%object%%.jar”.
These are reqular attachments, so you can use a URL like http://server.com/db.nsf/agent/$FILE/%%source%%.jar?OpenElement and http://server.com/db.nsf/agent/$FILE/%%object%%.jar?OpenElement to download them with a browser. You must have reader access to the agents to be able to do that of course.
Inside an agent, you can get access to the source code with this line, as described in Access resources in a Java agent:
InputStream is = new BufferedInputStream( this.getClass().getResourceAsStream( "%%source%%.jar"));