NASA's Parker Solar Probe mission recently plunged through the inner heliosphere of the Sun to its perihelia, about 24 million kilometres from the Sun. Previous studies farther from the Sun (performed mostly at a distance of 1 astronomical unit) indicate that solar energetic particles are accelerated from a few kiloelectronvolts up to near-relativistic energies via at least two processes: "impulsive" events, which are usually associated with magnetic reconnection in solar flares and are typically enriched in electrons, helium-3 and heavier ions, and "gradual" events, which are typically associated with large coronal-mass-ejection-driven shocks and compressions moving through the corona and inner solar wind and are the dominant source of protons with energies between 1 and 10 megaelectronvolts. However, some events show aspects of both processes and the electron-proton ratio is not bimodally distributed, as would be expected if there were only two possible processes. These processes have been very difficult to resolve from prior observations, owing to the various transport effects that affect the energetic particle population en route to more distant spacecraft. Here we report observations of the near-Sun energetic particle radiation environment over the first two orbits of the probe. We find a variety of energetic particle events accelerated both locally and remotely including by corotating interaction regions, impulsive events driven by acceleration near the Sun, and an event related to a coronal mass ejection. We provide direct observations of the energetic particle radiation environment in the region just above the corona of the Sun and directly explore the physics of particle acceleration and transport.