Aims. We report the γ-ray activity from the intermediate BL Lac S5 0716+714 during observations acquired by the AGILE satellite in September and October 2007. These detections of activity were contemporaneous with a period of intense optical activity, which was monitored by GASP-WEBT. This simultaneous optical and γ-ray coverage allows us to study in detail the light curves, time lags, γ-ray photon spectrum, and Spectral Energy Distributions (SEDs) during different states of activity.Methods. AGILE observed the source with its two co-aligned imagers, the Gamma-Ray Imaging Detector (GRID) and the hard X-ray imager (Super-AGILE), which are sensitive to the 30 MeV-50 GeV and 18-60 keV energy ranges, respectively. Observations were completed in two different periods, the first between 2007 September 4-23, and the second between 2007 October 24-November 1.Results. Over the period 2007 September 7-12, AGILE detected γ-ray emission from the source at a significance level of 9.6-Û with an average flux ( > 100 MeV) of (97 15) 10 photons cm -2s-1, which increased by a factor of at least four within three days. No emission was detected by Super-AGILE for the energy range 18-60 keV to a 3-Û upper limit of 10 mCrab in 335 ks. In October 2007, AGILE repointed toward S5 0716+714 following an intense optical flare, measuring an average flux of (47 11) 10 photons cm-2s-1 at a significance level of 6.0-Û. Conclusions. The γ-ray flux of S5 0716+714 detected by AGILE is the highest ever detected for this blazar and one of the most intense γ-ray fluxes detected from a BL Lac object. The SED of mid-September appears to be consistent with the synchrotron self-Compton (SSC) emission model, but only by including two SSC components of different variabilities.