  Using a (3+1)-dimensional hybrid framework with parametric initial
conditions, we study the rapidity-dependent directed flow $v_1(y)$ of
identified particles, including pions, kaons, protons, and lambdas in heavy-ion
collisions. Cases involving Au+Au collisions are considered, performed at
$\sqrt{s_{\rm NN}}$ ranging from 7.7 to 200 GeV. The dynamics in the beam
direction is constrained using the measured pseudo-rapidity distribution of
charged particles and the net proton rapidity distribution. Within this
framework, the directed flow of mesons is driven by the sideward pressure
gradient from the tilted source, and that of baryons mainly due to the initial
asymmetric baryon distribution with respect to the beam axis driven by the
transverse expansion. Our approach successfully reproduces the rapidity- and
beam energy-dependence of $v_1$ for both mesons and baryons. We find that the
$v_1(y)$ of baryons has strong constraining power on the initial baryon
stopping, and together with that of mesons, the directed flow probes the
equation of state of the dense nuclear matter at finite chemical potentials.
