AgentX is a master/sub-agent protocol that allows for notifications to be sent from a subagent to the master agent. The master agent will then retransmit that trap to all of its configured notification destinations.
The agentxtrap application is designed to simulate a subagent that simply connects to a running snmpd that is running as a master agent and ask it to send a notification.
For example, if in your snmpd.conf file you had:
trapv2sink host1.example.com myCommunity trapsess tls:host2.example.com master all
And then you ran:
# agentxtrap linkUp.0
It would cause snmpd to send a linkUp trap to both host1 and host2.
By default, snmpd uses the /var/agentx/master unix socket to listen for AgentX connections on. Because this is a root-owned file you'll likely only be able to run agentxtrap as root, unless you set up different permissions using the agentxsocket and agentxperms config tokens. If you change this model, be careful as you only want trusted people to be able to send notifications from your agents.