Agents are used to separate protocol states from nodes. They are always associated with nodes. An agent has a name, which is a unique identifier of the agent. It is shown as a square with its name inside, and a line link the square to its associated node. The following are commands that support agent tracing:
$ns add-agent-trace \<agent\> \<name\> \<optional:tracefile\> $ns delete-agent-trace \<agent\> $ns monitor-agent-trace \<agent\>
Once the above command is used to create an agent in nam trace, the tracevar method of the ns agent can be used to create feature traces of a given variable in the agent. For example, the following code segment creates traces of the variable C1_ in an SRM agent $srm(0):
$ns attach-agent $n($i) $srm(0) $ns add-agent-trace $srm($i) srm(0) $ns monitor-agent-trace $srm(0) ;\# turn nam monitor on from the start $srm(0) tracevar C1_