More information would help. What is your engine model number (see label on engine)?
Here is a guess at the service manual for your Kohler engine:
http://www.kohlerengines.com/onlinecatalog/pdf/sm_24_690_07.pdf
The
http://www.kohlerengines.com/onlinecatalog/pdf/sm_24_690_07.pdf
If this is not your engine, other manuals are available at this link:
Kohler Engines: Owners and Service Manuals: Manuals and Maintenance
The troubleshooting guide on page 18, under "Engine Starts But Does Not Keep Running", lists a number of possible problems:
● Faulty carburetor.
● Faulty cylinder head gasket.
● Faulty or mis-adjusted choke or throttle controls.
● Fuel pump malfunction-vacuum hose clogged or leaking.
● Intake system leak.
● Loose wires or connections that intermittently ground ignition kill circuit.
● Quality of fuel (dirt, water, stale, mixture).
● Restricted fuel tank cap vent.
Does the engine always run 3 - 4 seconds before stalling? Will it keep running if you leave the choke on? Will it restart immediately if you try to restart it after it stalls? Will it run longer at low RPM before stalling? When it quits, does it die quickly, or does it stumble and surge, then stop? Quick shutdown is more likely ignition/electrical; slow shutdown fuel related.
Your engine does have a fuel cut off solenoid on the carburetor (see illustration in manual page 25). It helps to quickly stop the engine when the ignition switch is turned off by blocking the fuel flow to the main jet. I doubt that this is your problem, as the engine probably would not start if it was inoperative (in the closed, no power mode).
Good luck.