The thermal and electronic transport properties of Ag-based quaternary compounds, GaAgSnSe4 and InAgGeSe4, have been explored by using density functional theory and the Boltzmann transport equation. Both the compounds exhibit ultralow lattice thermal conductivities (kappa(l)) that originate from the anharmonicity induced by the rattling effects of the loosely bound Ag atoms in their crystals. The lattice thermal conductivities (kappa(l,xx(yy)), kappa(l,zz)) at 300 and 800 K are (0.19, 0.23) and (0.07, 0.08) W m(-1) K-1, respectively, for GaAgSnSe4, and those for InAgGeSe4 are (1.07, 0.97) and (0.40, 0.36) W m(-1) K-1, respectively. Due to the huge and steep total density of states (TDOS) at the band edges in the vicinity of the Fermi level, both direct band gap semiconductors exhibit high Seebeck coefficients (S) with optimum electrical (sigma) and electronic thermal conductivities (kappa(e)). We have projected an outstanding figure of merit (ZT) for both the p-type and n-type of the two compounds. For the p-type and n-type GaAgSnSe4, the maximum ZT estimated at 800 K along the (x(y), z)-directions are (2.74, 2.35) and (2.51, 1.84), respectively; for the p-type and n-type InAgGeSe4, the values are (1.31, 1.20) and (0.94, 0.90), respectively. Our study suggests both GaAgSnSe4 and InAgGeSe4 as prospective thermoelectric materials.