The rapid development of additive manufacturing technologies has enabled the fabrication of truss metamaterials, i.e., a novel class of lightweight-yet-strong materials with engineered complex hierarchical structures. Manipulating the architecture over chemical composition dramatically expands the achievable materials design space, allowing to largely control the mechanical response of metamaterials. While methods such as topology optimization and machine learning have demonstrated to be powerful tools to discover structures with desired material properties, designing three-dimensional (3D) complex truss metamaterials with programmable mechanical behaviors is still a challenge. Here we propose a paradigm, based on graph neural networks (GNNs) and deep reinforcement learning, to design 3D truss metamaterials with programmable nonlinear quasi-static and dynamic responses. By combining the ability of our GNN-based model to accurately predict the mechanical response across multiple orders of magnitude and the explorative power of deep reinforcement learning, together with numerical simulations and mechanical testing, we inverse design truss metamaterials for compressive loading up to 30 % of strain and dynamic transmissibility with desired band gaps. Our method not only demonstrates a pathway to design mechanical metamaterials with desired mechanical behaviors but also provides a flexible framework that can be applied to tailor the response of 3D photonic or robotic metamaterials.